Class: Paymo::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/paymo/models/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ Entry

Returns a new instance of Entry.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/paymo/models/entry.rb', line 7

def initialize(result)
  @id             = result['id'].to_i
  @added_manually = !!result['added_manually']
  @billed         = !!result['billed']
  @start          = DateTime.parse(result['start']['_content'])
  @end            = DateTime.parse(result['end']['_content'])
  @description    = result['description']['_content']
  @user_id        = result['user']['id'].to_i
  @user_name      = result['user']['name']
  @task_id        = result['task']['id'].to_i
  @task_name      = result['task']['name']
  @project_id     = result['project']['id'].to_i
  @project_name   = result['project']['name']
end

Instance Attribute Details

#added_manuallyObject

Returns the value of attribute added_manually.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def added_manually
  @added_manually
end

#billedObject

Returns the value of attribute billed.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def billed
  @billed
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def description
  @description
end

#endObject

Returns the value of attribute end.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def end
  @end
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def id
  @id
end

#project_idObject

Returns the value of attribute project_id.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def project_id
  @project_id
end

#project_nameObject

Returns the value of attribute project_name.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def project_name
  @project_name
end

#startObject

Returns the value of attribute start.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def start
  @start
end

#task_idObject

Returns the value of attribute task_id.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def task_id
  @task_id
end

#task_nameObject

Returns the value of attribute task_name.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def task_name
  @task_name
end

#user_idObject

Returns the value of attribute user_id.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def user_id
  @user_id
end

#user_nameObject

Returns the value of attribute user_name.



4
5
6
# File 'lib/paymo/models/entry.rb', line 4

def user_name
  @user_name
end