Sha256: 621da43fd784bf1ba74d95ad7acd1c7bec0cb37c8546c33cffc335102c70d52c

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tracker_api-0.2.12 lib/tracker_api/endpoints/epic.rb
tracker_api-0.2.11 lib/tracker_api/endpoints/epic.rb