smartsheet 1.0.0.beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rubocop.yml +5 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE +202 -0
  7. data/README.md +139 -0
  8. data/Rakefile +13 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/smartsheet.rb +3 -0
  12. data/lib/smartsheet/api/body_builder.rb +26 -0
  13. data/lib/smartsheet/api/endpoint_spec.rb +35 -0
  14. data/lib/smartsheet/api/faraday_adapter/faraday_net_client.rb +42 -0
  15. data/lib/smartsheet/api/faraday_adapter/faraday_response.rb +60 -0
  16. data/lib/smartsheet/api/faraday_adapter/middleware/faraday_error_translator.rb +20 -0
  17. data/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb +25 -0
  18. data/lib/smartsheet/api/file_spec.rb +28 -0
  19. data/lib/smartsheet/api/header_builder.rb +85 -0
  20. data/lib/smartsheet/api/request.rb +29 -0
  21. data/lib/smartsheet/api/request_client.rb +26 -0
  22. data/lib/smartsheet/api/request_logger.rb +148 -0
  23. data/lib/smartsheet/api/request_spec.rb +43 -0
  24. data/lib/smartsheet/api/response_net_client_decorator.rb +47 -0
  25. data/lib/smartsheet/api/retry_logic.rb +37 -0
  26. data/lib/smartsheet/api/retry_net_client_decorator.rb +36 -0
  27. data/lib/smartsheet/api/url_builder.rb +25 -0
  28. data/lib/smartsheet/client.rb +115 -0
  29. data/lib/smartsheet/constants.rb +16 -0
  30. data/lib/smartsheet/endpoints/contacts/contacts.rb +29 -0
  31. data/lib/smartsheet/endpoints/favorites/favorites.rb +158 -0
  32. data/lib/smartsheet/endpoints/folders/folders.rb +124 -0
  33. data/lib/smartsheet/endpoints/groups/groups.rb +82 -0
  34. data/lib/smartsheet/endpoints/home/home.rb +19 -0
  35. data/lib/smartsheet/endpoints/reports/reports.rb +96 -0
  36. data/lib/smartsheet/endpoints/reports/reports_share.rb +68 -0
  37. data/lib/smartsheet/endpoints/search/search.rb +29 -0
  38. data/lib/smartsheet/endpoints/server_info/server_info.rb +19 -0
  39. data/lib/smartsheet/endpoints/share/share.rb +58 -0
  40. data/lib/smartsheet/endpoints/sheets/cells.rb +80 -0
  41. data/lib/smartsheet/endpoints/sheets/columns.rb +65 -0
  42. data/lib/smartsheet/endpoints/sheets/comments.rb +60 -0
  43. data/lib/smartsheet/endpoints/sheets/comments_attachments.rb +77 -0
  44. data/lib/smartsheet/endpoints/sheets/discussions.rb +80 -0
  45. data/lib/smartsheet/endpoints/sheets/discussions_attachments.rb +21 -0
  46. data/lib/smartsheet/endpoints/sheets/rows.rb +91 -0
  47. data/lib/smartsheet/endpoints/sheets/rows_attachments.rb +91 -0
  48. data/lib/smartsheet/endpoints/sheets/sheets.rb +301 -0
  49. data/lib/smartsheet/endpoints/sheets/sheets_attachments.rb +173 -0
  50. data/lib/smartsheet/endpoints/sheets/sheets_share.rb +68 -0
  51. data/lib/smartsheet/endpoints/sights/sights.rb +97 -0
  52. data/lib/smartsheet/endpoints/sights/sights_share.rb +68 -0
  53. data/lib/smartsheet/endpoints/templates/templates.rb +28 -0
  54. data/lib/smartsheet/endpoints/token/token.rb +57 -0
  55. data/lib/smartsheet/endpoints/update_requests/sent_update_requests.rb +42 -0
  56. data/lib/smartsheet/endpoints/update_requests/update_requests.rb +69 -0
  57. data/lib/smartsheet/endpoints/users/alternate_emails.rb +77 -0
  58. data/lib/smartsheet/endpoints/users/users.rb +73 -0
  59. data/lib/smartsheet/endpoints/webhooks/webhooks.rb +70 -0
  60. data/lib/smartsheet/endpoints/workspaces/workspaces.rb +83 -0
  61. data/lib/smartsheet/endpoints/workspaces/workspaces_share.rb +68 -0
  62. data/lib/smartsheet/error.rb +30 -0
  63. data/lib/smartsheet/general_request.rb +53 -0
  64. data/lib/smartsheet/version.rb +5 -0
  65. data/read-write-sheet/config.json +4 -0
  66. data/read-write-sheet/read_write_sheet.rb +89 -0
  67. data/smartsheet.gemspec +47 -0
  68. metadata +279 -0
@@ -0,0 +1,91 @@
1
+ require 'smartsheet/api/file_spec'
2
+
3
+ module Smartsheet
4
+ class RowsAttachments
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def list(sheet_id:, row_id:, params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
14
+ :get,
15
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments']
16
+ )
17
+ request_spec = Smartsheet::API::RequestSpec.new(
18
+ params: params,
19
+ header_overrides: header_overrides,
20
+ sheet_id: sheet_id,
21
+ row_id: row_id
22
+ )
23
+ client.make_request(endpoint_spec, request_spec)
24
+ end
25
+
26
+ def attach_url(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
27
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
28
+ :post,
29
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
30
+ body_type: :json
31
+ )
32
+ request_spec = Smartsheet::API::RequestSpec.new(
33
+ header_overrides: header_overrides,
34
+ params: params,
35
+ body: body,
36
+ sheet_id: sheet_id,
37
+ row_id: row_id
38
+ )
39
+ client.make_request(endpoint_spec, request_spec)
40
+ end
41
+
42
+ def attach_file(
43
+ sheet_id:,
44
+ row_id:,
45
+ file:,
46
+ filename:,
47
+ file_length:,
48
+ content_type: '',
49
+ params: {},
50
+ header_overrides: {}
51
+ )
52
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
53
+ :post,
54
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
55
+ body_type: :file
56
+ )
57
+ request_spec = Smartsheet::API::RequestSpec.new(
58
+ params: params,
59
+ header_overrides: header_overrides,
60
+ file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
61
+ sheet_id: sheet_id,
62
+ row_id: row_id
63
+ )
64
+ client.make_request(endpoint_spec, request_spec)
65
+ end
66
+
67
+ def attach_file_from_path(
68
+ sheet_id:,
69
+ row_id:,
70
+ path:,
71
+ filename: nil,
72
+ content_type: '',
73
+ params: {},
74
+ header_overrides: {}
75
+ )
76
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
77
+ :post,
78
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
79
+ body_type: :file
80
+ )
81
+ request_spec = Smartsheet::API::RequestSpec.new(
82
+ params: params,
83
+ header_overrides: header_overrides,
84
+ file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
85
+ sheet_id: sheet_id,
86
+ row_id: row_id
87
+ )
88
+ client.make_request(endpoint_spec, request_spec)
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,301 @@
1
+ require 'smartsheet/api/endpoint_spec'
2
+ require 'smartsheet/api/request_spec'
3
+ require 'smartsheet/constants'
4
+
5
+ require 'smartsheet/endpoints/sheets/cells'
6
+ require 'smartsheet/endpoints/sheets/columns'
7
+ require 'smartsheet/endpoints/sheets/comments'
8
+ require 'smartsheet/endpoints/sheets/discussions'
9
+ require 'smartsheet/endpoints/sheets/rows'
10
+ require 'smartsheet/endpoints/sheets/sheets_attachments'
11
+ require 'smartsheet/endpoints/sheets/sheets_share'
12
+
13
+ module Smartsheet
14
+ # Sheet resource endpoints
15
+ class Sheets
16
+ include Smartsheet::Constants
17
+
18
+ attr_reader :client, :attachments, :cells, :columns, :comments, :discussions, :rows, :share
19
+ private :client
20
+
21
+ def initialize(client)
22
+ @client = client
23
+
24
+ @attachments = SheetsAttachments.new(client)
25
+ @cells = Cells.new(client)
26
+ @columns = Columns.new(client)
27
+ @comments = Comments.new(client)
28
+ @discussions = Discussions.new(client)
29
+ @rows = Rows.new(client)
30
+ @share = SheetsShare.new(client)
31
+ end
32
+
33
+ def list(params: {}, header_overrides: {})
34
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets'])
35
+ request_spec = Smartsheet::API::RequestSpec.new(
36
+ params: params,
37
+ header_overrides: header_overrides
38
+ )
39
+ client.make_request(endpoint_spec, request_spec)
40
+ end
41
+
42
+ def get(sheet_id:, params: {}, header_overrides: {})
43
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id])
44
+ request_spec = Smartsheet::API::RequestSpec.new(
45
+ params: params,
46
+ header_overrides: header_overrides,
47
+ sheet_id: sheet_id
48
+ )
49
+ client.make_request(endpoint_spec, request_spec)
50
+ end
51
+
52
+ def get_version(sheet_id:, params: {}, header_overrides: {})
53
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'version'])
54
+ request_spec = Smartsheet::API::RequestSpec.new(
55
+ params: params,
56
+ header_overrides: header_overrides,
57
+ sheet_id: sheet_id
58
+ )
59
+ client.make_request(endpoint_spec, request_spec)
60
+ end
61
+
62
+ def get_as_excel(sheet_id:, params: {}, header_overrides: {})
63
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
64
+ :get,
65
+ ['sheets', :sheet_id],
66
+ headers: {Accept: EXCEL_TYPE}
67
+ )
68
+ request_spec = Smartsheet::API::RequestSpec.new(
69
+ params: params,
70
+ header_overrides: header_overrides,
71
+ sheet_id: sheet_id
72
+ )
73
+ client.make_request(endpoint_spec, request_spec)
74
+ end
75
+
76
+ def get_as_pdf(sheet_id:, params: {}, header_overrides: {})
77
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
78
+ :get,
79
+ ['sheets', :sheet_id],
80
+ headers: {Accept: PDF_TYPE}
81
+ )
82
+ request_spec = Smartsheet::API::RequestSpec.new(
83
+ params: params,
84
+ header_overrides: header_overrides,
85
+ sheet_id: sheet_id
86
+ )
87
+ client.make_request(endpoint_spec, request_spec)
88
+ end
89
+
90
+ def get_as_csv(sheet_id:, params: {}, header_overrides: {})
91
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
92
+ :get,
93
+ ['sheets', :sheet_id],
94
+ headers: {Accept: CSV_TYPE}
95
+ )
96
+ request_spec = Smartsheet::API::RequestSpec.new(
97
+ params: params,
98
+ header_overrides: header_overrides,
99
+ sheet_id: sheet_id
100
+ )
101
+ client.make_request(endpoint_spec, request_spec)
102
+ end
103
+
104
+ def create(body:, params: {}, header_overrides: {})
105
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
106
+ :post,
107
+ ['sheets'],
108
+ body_type: :json
109
+ )
110
+ request_spec = Smartsheet::API::RequestSpec.new(
111
+ params: params,
112
+ header_overrides: header_overrides,
113
+ body: body
114
+ )
115
+ client.make_request(endpoint_spec, request_spec)
116
+ end
117
+
118
+ def create_in_folder(folder_id:, body:, params: {}, header_overrides: {})
119
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
120
+ :post,
121
+ ['folders', :folder_id, 'sheets'],
122
+ body_type: :json
123
+ )
124
+ request_spec = Smartsheet::API::RequestSpec.new(
125
+ params: params,
126
+ header_overrides: header_overrides,
127
+ body: body,
128
+ folder_id: folder_id
129
+ )
130
+ client.make_request(endpoint_spec, request_spec)
131
+ end
132
+
133
+ def create_in_workspace(workspace_id:, body:, params: {}, header_overrides: {})
134
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
135
+ :post,
136
+ ['workspaces', :workspace_id, 'sheets'],
137
+ body_type: :json
138
+ )
139
+ request_spec = Smartsheet::API::RequestSpec.new(
140
+ params: params,
141
+ header_overrides: header_overrides,
142
+ body: body,
143
+ workspace_id: workspace_id
144
+ )
145
+ client.make_request(endpoint_spec, request_spec)
146
+ end
147
+
148
+ def create_from_template(body:, params: {}, header_overrides: {})
149
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
150
+ :post,
151
+ ['sheets'],
152
+ body_type: :json
153
+ )
154
+ request_spec = Smartsheet::API::RequestSpec.new(
155
+ params: params,
156
+ header_overrides: header_overrides,
157
+ body: body
158
+ )
159
+ client.make_request(endpoint_spec, request_spec)
160
+ end
161
+
162
+ def create_in_folder_from_template(folder_id:, body:, params: {}, header_overrides: {})
163
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
164
+ :post,
165
+ ['folders', :folder_id, 'sheets'],
166
+ body_type: :json
167
+ )
168
+ request_spec = Smartsheet::API::RequestSpec.new(
169
+ params: params,
170
+ header_overrides: header_overrides,
171
+ body: body,
172
+ folder_id: folder_id
173
+ )
174
+ client.make_request(endpoint_spec, request_spec)
175
+ end
176
+
177
+ def create_in_workspace_from_template(workspace_id:, body:, params: {}, header_overrides: {})
178
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
179
+ :post,
180
+ ['workspaces', :workspace_id, 'sheets'],
181
+ body_type: :json
182
+ )
183
+ request_spec = Smartsheet::API::RequestSpec.new(
184
+ params: params,
185
+ header_overrides: header_overrides,
186
+ body: body,
187
+ workspace_id: workspace_id
188
+ )
189
+ client.make_request(endpoint_spec, request_spec)
190
+ end
191
+
192
+ def copy(sheet_id:, body:, params: {}, header_overrides: {})
193
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
194
+ :post,
195
+ ['sheets', :sheet_id, 'copy'],
196
+ body_type: :json
197
+ )
198
+ request_spec = Smartsheet::API::RequestSpec.new(
199
+ params: params,
200
+ header_overrides: header_overrides,
201
+ body: body,
202
+ sheet_id: sheet_id
203
+ )
204
+ client.make_request(endpoint_spec, request_spec)
205
+ end
206
+
207
+ def move(sheet_id:, body:, params: {}, header_overrides: {})
208
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
209
+ :post,
210
+ ['sheets', :sheet_id, 'move'],
211
+ body_type: :json
212
+ )
213
+ request_spec = Smartsheet::API::RequestSpec.new(
214
+ params: params,
215
+ header_overrides: header_overrides,
216
+ body: body,
217
+ sheet_id: sheet_id
218
+ )
219
+ client.make_request(endpoint_spec, request_spec)
220
+ end
221
+
222
+ def update(sheet_id:, body:, params: {}, header_overrides: {})
223
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
224
+ :put,
225
+ ['sheets', :sheet_id],
226
+ body_type: :json
227
+ )
228
+ request_spec = Smartsheet::API::RequestSpec.new(
229
+ params: params,
230
+ header_overrides: header_overrides,
231
+ body: body,
232
+ sheet_id: sheet_id
233
+ )
234
+ client.make_request(endpoint_spec, request_spec)
235
+ end
236
+
237
+ def delete(sheet_id:, params: {}, header_overrides: {})
238
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
239
+ :delete,
240
+ ['sheets', :sheet_id]
241
+ )
242
+ request_spec = Smartsheet::API::RequestSpec.new(
243
+ params: params,
244
+ header_overrides: header_overrides,
245
+ sheet_id: sheet_id
246
+ )
247
+ client.make_request(endpoint_spec, request_spec)
248
+ end
249
+
250
+ def list_for_org(params: {}, header_overrides: {})
251
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['users', 'sheets'])
252
+ request_spec = Smartsheet::API::RequestSpec.new(
253
+ header_overrides: header_overrides,
254
+ params: params
255
+ )
256
+ client.make_request(endpoint_spec, request_spec)
257
+ end
258
+
259
+ def get_publish_status(sheet_id:, params: {}, header_overrides: {})
260
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['sheets', :sheet_id, 'publish'])
261
+ request_spec = Smartsheet::API::RequestSpec.new(
262
+ params: params,
263
+ header_overrides: header_overrides,
264
+ sheet_id: sheet_id
265
+ )
266
+ client.make_request(endpoint_spec, request_spec)
267
+ end
268
+
269
+ def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
270
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], body_type: :json)
271
+ request_spec = Smartsheet::API::RequestSpec.new(
272
+ params: params,
273
+ header_overrides: header_overrides,
274
+ body: body,
275
+ sheet_id: sheet_id
276
+ )
277
+ client.make_request(endpoint_spec, request_spec)
278
+ end
279
+
280
+ def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
281
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['sheets', :sheet_id, 'emails'], body_type: :json)
282
+ request_spec = Smartsheet::API::RequestSpec.new(
283
+ params: params,
284
+ header_overrides: header_overrides,
285
+ body: body,
286
+ sheet_id: sheet_id
287
+ )
288
+ client.make_request(endpoint_spec, request_spec)
289
+ end
290
+
291
+ def list_image_urls(body:, params: {}, header_overrides: {})
292
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['imageurls'], body_type: :json)
293
+ request_spec = Smartsheet::API::RequestSpec.new(
294
+ params: params,
295
+ header_overrides: header_overrides,
296
+ body: body
297
+ )
298
+ client.make_request(endpoint_spec, request_spec)
299
+ end
300
+ end
301
+ end
@@ -0,0 +1,173 @@
1
+ require 'smartsheet/api/file_spec'
2
+
3
+ module Smartsheet
4
+ class SheetsAttachments
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def list(sheet_id:, params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'attachments'])
14
+ request_spec = Smartsheet::API::RequestSpec.new(
15
+ params: params,
16
+ header_overrides: header_overrides,
17
+ sheet_id: sheet_id
18
+ )
19
+ client.make_request(endpoint_spec, request_spec)
20
+ end
21
+
22
+ def get(sheet_id:, attachment_id:, params: {}, header_overrides: {})
23
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
24
+ :get,
25
+ ['sheets', :sheet_id, 'attachments',
26
+ :attachment_id]
27
+ )
28
+ request_spec = Smartsheet::API::RequestSpec.new(
29
+ params: params,
30
+ header_overrides: header_overrides,
31
+ sheet_id: sheet_id,
32
+ attachment_id: attachment_id
33
+ )
34
+ client.make_request(endpoint_spec, request_spec)
35
+ end
36
+
37
+ def attach_url(sheet_id:, body:, params: {}, header_overrides: {})
38
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
39
+ :post,
40
+ ['sheets', :sheet_id, 'attachments'],
41
+ body_type: :json
42
+ )
43
+ request_spec = Smartsheet::API::RequestSpec.new(
44
+ params: params,
45
+ header_overrides: header_overrides,
46
+ body: body,
47
+ sheet_id: sheet_id
48
+ )
49
+ client.make_request(endpoint_spec, request_spec)
50
+ end
51
+
52
+ def delete(sheet_id:, attachment_id:, params: {}, header_overrides: {})
53
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
54
+ :delete,
55
+ ['sheets', :sheet_id, 'attachments', :attachment_id]
56
+ )
57
+ request_spec = Smartsheet::API::RequestSpec.new(
58
+ params: params,
59
+ header_overrides: header_overrides,
60
+ sheet_id: sheet_id,
61
+ attachment_id: attachment_id
62
+ )
63
+ client.make_request(endpoint_spec, request_spec)
64
+ end
65
+
66
+ def attach_file(sheet_id:, file:, filename:, file_length:, content_type: '', params: {}, header_overrides: {})
67
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
68
+ :post,
69
+ ['sheets', :sheet_id, 'attachments'],
70
+ body_type: :file
71
+ )
72
+ request_spec = Smartsheet::API::RequestSpec.new(
73
+ params: params,
74
+ header_overrides: header_overrides,
75
+ file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
76
+ sheet_id: sheet_id
77
+ )
78
+ client.make_request(endpoint_spec, request_spec)
79
+ end
80
+
81
+ def attach_file_from_path(sheet_id:, path:, filename: nil, content_type: '', params: {}, header_overrides: {})
82
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
83
+ :post,
84
+ ['sheets', :sheet_id, 'attachments'],
85
+ body_type: :file
86
+ )
87
+ request_spec = Smartsheet::API::RequestSpec.new(
88
+ params: params,
89
+ header_overrides: header_overrides,
90
+ file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
91
+ sheet_id: sheet_id
92
+ )
93
+ client.make_request(endpoint_spec, request_spec)
94
+ end
95
+
96
+ def attach_new_version(
97
+ sheet_id:,
98
+ attachment_id:,
99
+ file:,
100
+ filename:,
101
+ file_length:,
102
+ content_type: '',
103
+ params: {},
104
+ header_overrides: {}
105
+ )
106
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
107
+ :post,
108
+ ['sheets', :sheet_id, 'attachments', :attachment_id, 'versions'],
109
+ body_type: :file
110
+ )
111
+ request_spec = Smartsheet::API::RequestSpec.new(
112
+ params: params,
113
+ header_overrides: header_overrides,
114
+ file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
115
+ sheet_id: sheet_id,
116
+ attachment_id: attachment_id
117
+ )
118
+ client.make_request(endpoint_spec, request_spec)
119
+ end
120
+
121
+ def attach_new_version_from_path(
122
+ sheet_id:,
123
+ attachment_id:,
124
+ path:,
125
+ filename: nil,
126
+ content_type: '',
127
+ params: {},
128
+ header_overrides: {}
129
+ )
130
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
131
+ :post,
132
+ ['sheets', :sheet_id, 'attachments', :attachment_id, 'versions'],
133
+ body_type: :file
134
+ )
135
+ request_spec = Smartsheet::API::RequestSpec.new(
136
+ params: params,
137
+ header_overrides: header_overrides,
138
+ file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
139
+ sheet_id: sheet_id,
140
+ attachment_id: attachment_id
141
+ )
142
+ client.make_request(endpoint_spec, request_spec)
143
+ end
144
+
145
+ def delete_all_versions(sheet_id:, attachment_id:, params: {}, header_overrides: {})
146
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
147
+ :delete,
148
+ ['sheets', :sheet_id, 'attachments', :attachment_id, 'versions']
149
+ )
150
+ request_spec = Smartsheet::API::RequestSpec.new(
151
+ params: params,
152
+ header_overrides: header_overrides,
153
+ sheet_id: sheet_id,
154
+ attachment_id: attachment_id
155
+ )
156
+ client.make_request(endpoint_spec, request_spec)
157
+ end
158
+
159
+ def list_versions(sheet_id:, attachment_id:, params: {}, header_overrides: {})
160
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
161
+ :get,
162
+ ['sheets', :sheet_id, 'attachments', :attachment_id, 'versions']
163
+ )
164
+ request_spec = Smartsheet::API::RequestSpec.new(
165
+ header_overrides: header_overrides,
166
+ params: params,
167
+ sheet_id: sheet_id,
168
+ attachment_id: attachment_id
169
+ )
170
+ client.make_request(endpoint_spec, request_spec)
171
+ end
172
+ end
173
+ end