Sha256: cbb9b6e83ef57dda3c09f0278b4ee53da9d424cf86a91078249b1129d74af199

Contents?: true

Size: 1.04 KB

Versions: 21

Compression:

Stored size: 1.04 KB

Contents

module TrackerApi
  module Endpoints
    class Epic
      attr_accessor :client

      def initialize(client)
        @client = client
      end

      def get(project_id, id, params={})
        data = client.get("/projects/#{project_id}/epics/#{id}", params: params).body

        Resources::Epic.new({ client: client, project_id: project_id }.merge(data))
      end

      def get_epic(epic_id, params={})
        data = client.get("/epics/#{epic_id}", params: params).body

        Resources::Epic.new({ client: client }.merge(data))
      end

      def create(project_id, params={})
        data = client.post("/projects/#{project_id}/epics", params: params).body

        Resources::Epic.new({ client: client }.merge(data))
      end

      def update(epic, params={})
        raise ArgumentError, 'Valid epic required to update.' unless epic.instance_of?(Resources::Epic)

        data = client.put("/projects/#{epic.project_id}/epics/#{epic.id}", params: params).body

        epic.attributes = data
        epic.clean!
        epic
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
tracker_api-1.16.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.15.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.14.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.13.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.12.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.11.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.10.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.9.1 lib/tracker_api/endpoints/epic.rb
tracker_api-1.9.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.8.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.7.1 lib/tracker_api/endpoints/epic.rb
tracker_api-1.7.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.6.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.5.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.4.1 lib/tracker_api/endpoints/epic.rb
tracker_api-1.4.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.3.0 lib/tracker_api/endpoints/epic.rb
tracker_api-1.2.1 lib/tracker_api/endpoints/epic.rb
tracker_api-1.1.1 lib/tracker_api/endpoints/epic.rb
tracker_api-1.1.0 lib/tracker_api/endpoints/epic.rb