Class: Smartsheet::Comments

Inherits:
Object
  • Object
show all
Defined in:
lib/smartsheet/endpoints/sheets/comments.rb

Overview

Comments Endpoints

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Comments

Returns a new instance of Comments.



13
14
15
16
17
# File 'lib/smartsheet/endpoints/sheets/comments.rb', line 13

def initialize(client)
  @client = client

  @attachments = CommentsAttachments.new(client)
end

Instance Attribute Details

#attachmentsCommentsAttachments (readonly)

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/smartsheet/endpoints/sheets/comments.rb', line 9

class Comments
  attr_reader :client, :attachments
  private :client

  def initialize(client)
    @client = client

    @attachments = CommentsAttachments.new(client)
  end

  def add(sheet_id:, discussion_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'discussions', :discussion_id, 'comments'], body_type: :json)
    request_spec = Smartsheet::API::RequestSpec.new(
        header_overrides: header_overrides,
        params: params,
        body: body,
        sheet_id: sheet_id,
        discussion_id: discussion_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def update(sheet_id:, comment_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'comments', :comment_id], body_type: :json)
    request_spec = Smartsheet::API::RequestSpec.new(
        header_overrides: header_overrides,
        params: params,
        body: body,
        sheet_id: sheet_id,
        comment_id: comment_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def delete(sheet_id:, comment_id:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'comments', :comment_id])
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        sheet_id: sheet_id,
        comment_id: comment_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def get(sheet_id:, comment_id:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'comments', :comment_id])
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        sheet_id: sheet_id,
        comment_id: comment_id
    )
    client.make_request(endpoint_spec, request_spec)
  end
end

Instance Method Details

#add(sheet_id:, discussion_id:, body:, params: {}, header_overrides: {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/smartsheet/endpoints/sheets/comments.rb', line 19

def add(sheet_id:, discussion_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'discussions', :discussion_id, 'comments'], body_type: :json)
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      body: body,
      sheet_id: sheet_id,
      discussion_id: discussion_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#delete(sheet_id:, comment_id:, params: {}, header_overrides: {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/smartsheet/endpoints/sheets/comments.rb', line 43

def delete(sheet_id:, comment_id:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'comments', :comment_id])
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      sheet_id: sheet_id,
      comment_id: comment_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#get(sheet_id:, comment_id:, params: {}, header_overrides: {}) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/smartsheet/endpoints/sheets/comments.rb', line 54

def get(sheet_id:, comment_id:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'comments', :comment_id])
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      sheet_id: sheet_id,
      comment_id: comment_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#update(sheet_id:, comment_id:, body:, params: {}, header_overrides: {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/smartsheet/endpoints/sheets/comments.rb', line 31

def update(sheet_id:, comment_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'comments', :comment_id], body_type: :json)
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      body: body,
      sheet_id: sheet_id,
      comment_id: comment_id
  )
  client.make_request(endpoint_spec, request_spec)
end