Class: Smartsheet::RowsAttachments

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

Overview

Rows Attachments Endpoints

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ RowsAttachments

Returns a new instance of RowsAttachments.



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

def initialize(client)
  @client = client
end

Instance Method Details

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/smartsheet/endpoints/sheets/rows_attachments.rb', line 44

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

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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/smartsheet/endpoints/sheets/rows_attachments.rb', line 69

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

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



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/smartsheet/endpoints/sheets/rows_attachments.rb', line 28

def attach_url(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
      body_type: :json
  )
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      body: body,
      sheet_id: sheet_id,
      row_id: row_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#list(sheet_id:, row_id:, params: {}, header_overrides: {}) ⇒ Object



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

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