Class: TrackerApi::Endpoints::Stories
- Defined in:
- lib/tracker_api/endpoints/stories.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #get(project_id, params = {}) ⇒ Object
- #get_release(project_id, release_id, params = {}) ⇒ Object
-
#initialize(client) ⇒ Stories
constructor
A new instance of Stories.
Constructor Details
#initialize(client) ⇒ Stories
Returns a new instance of Stories.
6 7 8 |
# File 'lib/tracker_api/endpoints/stories.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/stories.rb', line 4 def client @client end |
Instance Method Details
#get(project_id, params = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tracker_api/endpoints/stories.rb', line 10 def get(project_id, params={}) url = params[:ids] ? "/projects/#{project_id}/stories/bulk" : "/projects/#{project_id}/stories" data = client.paginate(url, params: params) raise Errors::UnexpectedData, 'Array of stories expected' unless data.is_a? Array data.map do |story| Resources::Story.new({ client: client, project_id: project_id }.merge(story)) end end |
#get_release(project_id, release_id, params = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/tracker_api/endpoints/stories.rb', line 21 def get_release(project_id, release_id, params={}) data = client.paginate("/projects/#{project_id}/releases/#{release_id}/stories", params: params) raise Errors::UnexpectedData, 'Array of stories expected' unless data.is_a? Array data.map do |story| Resources::Story.new({ client: client, project_id: project_id }.merge(story)) end end |