Class: Dev::TargetProcess::Time
- Defined in:
- lib/firespring_dev_commands/target_process/time.rb
Overview
The class to query time information from Target Process
Constant Summary collapse
- RESOURCE_TYPE =
The resource type for the api endpoint
'Time'.freeze
- PATH =
The api path for time requests
'/Time'.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#date ⇒ Object
Returns the value of attribute date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#hours ⇒ Object
Returns the value of attribute hours.
-
#id ⇒ Object
Returns the value of attribute id.
-
#story ⇒ Object
Returns the value of attribute story.
-
#type ⇒ Object
Returns the value of attribute type.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(data) ⇒ Time
constructor
A new instance of Time.
-
#parse_time(string) ⇒ Object
Parse the dot net time representation into something that ruby can use.
Constructor Details
#initialize(data) ⇒ Time
Returns a new instance of Time.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 13 def initialize(data) @data = data @id = data['Id'] @type = data['ResourceType'] @description = data['Description'] @hours = data['Spent'] @date = parse_time(data['Date']) @story = UserStory.new(data['Assignable']) if data['Assignable'] @user = User.new(data['User']) if data['User'] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def data @data end |
#date ⇒ Object
Returns the value of attribute date.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def date @date end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def description @description end |
#hours ⇒ Object
Returns the value of attribute hours.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def hours @hours end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def id @id end |
#story ⇒ Object
Returns the value of attribute story.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def story @story end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def type @type end |
#user ⇒ Object
Returns the value of attribute user.
11 12 13 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 11 def user @user end |
Instance Method Details
#parse_time(string) ⇒ Object
Parse the dot net time representation into something that ruby can use
25 26 27 28 29 |
# File 'lib/firespring_dev_commands/target_process/time.rb', line 25 def parse_time(string) return nil unless string && !string.empty? ::Time.at(string.slice(6, 10).to_i) end |