Class: Smartsheet::CommentsAttachments

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

Overview

Comments Attachments Endpoints

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CommentsAttachments

Returns a new instance of CommentsAttachments.



10
11
12
# File 'lib/smartsheet/endpoints/sheets/comments_attachments.rb', line 10

def initialize(client)
  @client = client
end

Instance Method Details

#attach_file(sheet_id:, comment_id:, file:, filename:, file_length:, content_type: '', params: {}, header_overrides: {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/smartsheet/endpoints/sheets/comments_attachments.rb', line 30

def attach_file(
    sheet_id:,
    comment_id:,
    file:,
    filename:,
    file_length:,
    content_type: '',
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_id, 'comments', :comment_id, 'attachments'],
      body_type: :file
  )
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
      sheet_id: sheet_id,
      comment_id: comment_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#attach_file_from_path(sheet_id:, comment_id:, path:, filename: nil, content_type: '', params: {}, header_overrides: {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/smartsheet/endpoints/sheets/comments_attachments.rb', line 55

def attach_file_from_path(
    sheet_id:,
    comment_id:,
    path:,
    filename: nil,
    content_type: '',
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_id, 'comments', :comment_id, 'attachments'],
      body_type: :file
  )
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
      sheet_id: sheet_id,
      comment_id: comment_id
  )
  client.make_request(endpoint_spec, request_spec)
end

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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/smartsheet/endpoints/sheets/comments_attachments.rb', line 14

def attach_url(sheet_id:, comment_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_id, 'comments', :comment_id, 'attachments'],
      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