Sha256: 8d0b435106d5f0eea104731656deac4c1372cef656a7217a194f20e47792b90a

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

module TrackerApi
  module Endpoints
    class Comment
      attr_accessor :client

      def initialize(client)
        @client = client
      end

      def create(project_id, story_id, params={})
        data = client.post("/projects/#{project_id}/stories/#{story_id}/comments", params: params).body
        Resources::Comment.new({ client: client, project_id: project_id }.merge(data))
      end

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

        data = client.put("/projects/#{comment.project_id}/stories/#{comment.story_id}/comments/#{comment.id}",
                          params: params).body

        comment.attributes = data
        comment.clean!
        comment
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tracker_api-1.7.1 lib/tracker_api/endpoints/comment.rb
tracker_api-1.7.0 lib/tracker_api/endpoints/comment.rb
tracker_api-1.6.0 lib/tracker_api/endpoints/comment.rb
tracker_api-1.5.0 lib/tracker_api/endpoints/comment.rb