Class: TempoAPI::Models::Worklog

Inherits:
Object
  • Object
show all
Defined in:
lib/tempest_time/api/tempo_api/models/worklog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Worklog

Returns a new instance of Worklog.



6
7
8
9
10
11
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 6

def initialize(options)
  @id = options.fetch(:id)
  @issue = options.fetch(:issue)
  @seconds = options.fetch(:seconds)
  @description = options.fetch(:description)
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 4

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 4

def id
  @id
end

#issueObject (readonly)

Returns the value of attribute issue.



4
5
6
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 4

def issue
  @issue
end

#secondsObject (readonly)

Returns the value of attribute seconds.



4
5
6
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 4

def seconds
  @seconds
end

Instance Method Details

#hoursObject



25
26
27
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 25

def hours
  minutes / 60.to_f
end

#minutesObject



21
22
23
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 21

def minutes
  seconds / 60.to_f
end

#projectObject



17
18
19
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 17

def project
  issue.split('-').first
end

#to_sObject



13
14
15
# File 'lib/tempest_time/api/tempo_api/models/worklog.rb', line 13

def to_s
  "#{id}: #{issue}: #{time_output}: #{description}"
end