Class: Smartsheet::SheetsAttachments

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

Overview

Sheet Attachments Endpoints

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SheetsAttachments

Returns a new instance of SheetsAttachments.



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

def initialize(client)
  @client = client
end

Instance Method Details

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



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 68

def attach_file(sheet_id:, file:, filename:, file_length:, content_type: '', params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_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
  )
  client.make_request(endpoint_spec, request_spec)
end

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



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 83

def attach_file_from_path(sheet_id:, path:, filename: nil, content_type: '', params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_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
  )
  client.make_request(endpoint_spec, request_spec)
end

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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 98

def attach_new_version(
    sheet_id:,
    attachment_id:,
    file:,
    filename:,
    file_length:,
    content_type: '',
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_id, 'attachments', :attachment_id, 'versions'],
      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,
      attachment_id: attachment_id
  )
  client.make_request(endpoint_spec, request_spec)
end

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



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 123

def attach_new_version_from_path(
    sheet_id:,
    attachment_id:,
    path:,
    filename: nil,
    content_type: '',
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', :sheet_id, 'attachments', :attachment_id, 'versions'],
      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,
      attachment_id: attachment_id
  )
  client.make_request(endpoint_spec, request_spec)
end

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



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 39

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

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



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

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

#delete_all_versions(sheet_id:, attachment_id:, params: {}, header_overrides: {}) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 147

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

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



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 24

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

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



14
15
16
17
18
19
20
21
22
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 14

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

#list_versions(sheet_id:, attachment_id:, params: {}, header_overrides: {}) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/smartsheet/endpoints/sheets/sheets_attachments.rb', line 161

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