Sha256: 8b4f99f43fad92e9ec93c25b501a031d64d30bcdf48f2b794d1956b88d777596

Contents?: true

Size: 983 Bytes

Versions: 8

Compression:

Stored size: 983 Bytes

Contents

module TrackerApi
  module Endpoints
    class Stories
      attr_accessor :client

      def initialize(client)
        @client = client
      end

      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

      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tracker_api-1.16.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.15.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.14.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.13.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.12.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.11.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.10.0 lib/tracker_api/endpoints/stories.rb
tracker_api-1.9.1 lib/tracker_api/endpoints/stories.rb