Class: TrackerApi::Endpoints::Iteration
- Defined in:
- lib/tracker_api/endpoints/iteration.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #get(project_id, iteration_number) ⇒ Object
- #get_analytics_cycle_time_details(project_id, iteration_number) ⇒ Object
- #get_history(project_id, iteration_number) ⇒ Object
-
#initialize(client) ⇒ Iteration
constructor
A new instance of Iteration.
Constructor Details
#initialize(client) ⇒ Iteration
Returns a new instance of Iteration.
6 7 8 |
# File 'lib/tracker_api/endpoints/iteration.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/tracker_api/endpoints/iteration.rb', line 4 def client @client end |
Instance Method Details
#get(project_id, iteration_number) ⇒ Object
10 11 12 13 14 |
# File 'lib/tracker_api/endpoints/iteration.rb', line 10 def get(project_id, iteration_number) data = client.get("/projects/#{project_id}/iterations/#{iteration_number}").body Resources::Iteration.new({ client: client, project_id: project_id }.merge(data)) end |
#get_analytics_cycle_time_details(project_id, iteration_number) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tracker_api/endpoints/iteration.rb', line 16 def get_analytics_cycle_time_details(project_id, iteration_number) data = client.paginate("/projects/#{project_id}/iterations/#{iteration_number}/analytics/cycle_time_details") raise Errors::UnexpectedData, 'Array of cycle time details expected' unless data.is_a? Array data.map do |cycle_time_details| Resources::CycleTimeDetails.new( { project_id: project_id, iteration_number: iteration_number }.merge(cycle_time_details) ) end end |
#get_history(project_id, iteration_number) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/tracker_api/endpoints/iteration.rb', line 27 def get_history(project_id, iteration_number) data = client.get("/projects/#{project_id}/history/iterations/#{iteration_number}/days").body raise Errors::UnexpectedData, 'Hash of history data expected' unless data.is_a? Hash Resources::DailyHistoryContainer.new({ project_id: project_id, iteration_number: iteration_number }.merge(data)) end |