Class: Basecamp::Services::CommentsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/basecamp/generated/services/comments_service.rb

Overview

Service for Comments operations

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Basecamp::Services::BaseService

Instance Method Details

#create(recording_id:, content:) ⇒ Hash

Create a new comment on a recording

Parameters:

  • recording_id (Integer)

    recording id ID

  • content (String)

    content

Returns:

  • (Hash)

    response data



42
43
44
45
46
# File 'lib/basecamp/generated/services/comments_service.rb', line 42

def create(recording_id:, content:)
  with_operation(service: "comments", operation: "create", is_mutation: true, resource_id: recording_id) do
    http_post("/recordings/#{recording_id}/comments.json", body: compact_params(content: content)).json
  end
end

#get(comment_id:) ⇒ Hash

Get a single comment by id

Parameters:

  • comment_id (Integer)

    comment id ID

Returns:

  • (Hash)

    response data



13
14
15
16
17
# File 'lib/basecamp/generated/services/comments_service.rb', line 13

def get(comment_id:)
  with_operation(service: "comments", operation: "get", is_mutation: false, resource_id: comment_id) do
    http_get("/comments/#{comment_id}").json
  end
end

#list(recording_id:) ⇒ Enumerator<Hash>

List comments on a recording

Parameters:

  • recording_id (Integer)

    recording id ID

Returns:

  • (Enumerator<Hash>)

    paginated results



32
33
34
35
36
# File 'lib/basecamp/generated/services/comments_service.rb', line 32

def list(recording_id:)
  wrap_paginated(service: "comments", operation: "list", is_mutation: false, resource_id: recording_id) do
    paginate("/recordings/#{recording_id}/comments.json")
  end
end

#update(comment_id:, content:) ⇒ Hash

Update an existing comment

Parameters:

  • comment_id (Integer)

    comment id ID

  • content (String)

    content

Returns:

  • (Hash)

    response data



23
24
25
26
27
# File 'lib/basecamp/generated/services/comments_service.rb', line 23

def update(comment_id:, content:)
  with_operation(service: "comments", operation: "update", is_mutation: true, resource_id: comment_id) do
    http_put("/comments/#{comment_id}", body: compact_params(content: content)).json
  end
end