Class: Smartsheet::Sheets

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

Overview

Sheets Endpoints

See Also:

Constant Summary

Constants included from Constants

Constants::API_URL, Constants::CSV_TYPE, Constants::DEFAULT_BACKOFF_METHOD, Constants::DEFAULT_MAX_RETRY_TIME, Constants::EXCEL_TYPE, Constants::GOV_API_URL, Constants::JSON_TYPE, Constants::OPENXML_SPREADSHEET_TYPE, Constants::PDF_TYPE, Constants::USER_AGENT, Constants::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Sheets

Returns a new instance of Sheets.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 48

def initialize(client)
  @client = client

  @attachments = SheetsAttachments.new(client)
  @automation_rules = AutomationRules.new(client)
  @cells = Cells.new(client)
  @columns = Columns.new(client)
  @comments = Comments.new(client)
  @cross_sheet_references = CrossSheetReferences.new(client)
  @discussions = Discussions.new(client)
  @summaries = SheetsSummaries.new(client)
  @rows = Rows.new(client)
  @share = SheetsShare.new(client)
end

Instance Attribute Details

#attachmentsSheetsAttachments (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#automation_rulesAutomationRules (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#cellsCells (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#columnsColumns (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#commentsComments (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#cross_sheet_referencesCrossSheetReferences (readonly)



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#discussionsDiscussions (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#rowsRows (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#shareSheetsShare (readonly)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

#summariesSummaries (readonly)

Returns:

  • (Summaries)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 41

class Sheets
  include Smartsheet::Constants

  attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
      :cross_sheet_references, :discussions, :summaries, :rows, :share
  private :client

  def initialize(client)
    @client = client

    @attachments = SheetsAttachments.new(client)
    @automation_rules = AutomationRules.new(client)
    @cells = Cells.new(client)
    @columns = Columns.new(client)
    @comments = Comments.new(client)
    @cross_sheet_references = CrossSheetReferences.new(client)
    @discussions = Discussions.new(client)
    @summaries = SheetsSummaries.new(client)
    @rows = Rows.new(client)
    @share = SheetsShare.new(client)
  end

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

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

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

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

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

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

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

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

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

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

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

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

  def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_folder(
      folder_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_folder(
      folder_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['folders', :folder_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        folder_id: folder_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_into_workspace(
      workspace_id:,
      file:,
      file_type:,
      file_length:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def import_from_file_path_into_workspace(
      workspace_id:,
      path:,
      file_type:,
      params: {},
      header_overrides: {}
  )
    endpoint_spec = Smartsheet::API::EndpointSpec.new(
        :post,
        ['workspaces', :workspace_id, 'sheets', 'import'],
        body_type: :file
    )
    content_type = file_type_to_content_type(file_type)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
        workspace_id: workspace_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  ### These endpoints are not yet implemented; these endpoints can be re-included once they are
  ### active

  # def import_and_replace_sheet_from_file(
  #     sheet_id:,
  #     file:,
  #     file_type:,
  #     file_length:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

  # def import_and_replace_sheet_from_file_path(
  #     sheet_id:,
  #     path:,
  #     file_type:,
  #     params: {},
  #     header_overrides: {}
  # )
  #   endpoint_spec = Smartsheet::API::EndpointSpec.new(
  #       :post,
  #       ['sheets', :sheet_id, 'import'],
  #       body_type: :file
  #   )
  #   content_type = file_type_to_content_type(file_type)
  #   request_spec = Smartsheet::API::RequestSpec.new(
  #       params: params,
  #       header_overrides: header_overrides,
  #       file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  #   )
  #   client.make_request(endpoint_spec, request_spec)
  # end

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

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

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

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

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

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

  def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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

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

  private

  def file_type_to_content_type(file_type)
    mapping = {
      csv: Constants::CSV_TYPE,
      xlsx: Constants::OPENXML_SPREADSHEET_TYPE
    }

    mapping.fetch(file_type) do |_|
      available_types = mapping.keys.join(', ')

      raise Smartsheet::Error.new(
        "Unsupported file type: #{file_type}\nValid types: #{available_types}"
      )
    end
  end
end

Instance Method Details

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

def import_and_replace_sheet_from_file_path( sheet_id:, path:, file_type:, params: {}, header_overrides: {} ) endpoint_spec = Smartsheet::API::EndpointSpec.new( :post, ['sheets', :sheet_id, 'import'], body_type: :file ) content_type = file_type_to_content_type(file_type) request_spec = Smartsheet::API::RequestSpec.new( params: params, header_overrides: header_overrides, file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type) ) client.make_request(endpoint_spec, request_spec) end



388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 388

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

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



134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 134

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

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



178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 178

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

#create_in_folder(folder_id:, body:, params: {}, header_overrides: {}) ⇒ Object



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

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

#create_in_folder_from_template(folder_id:, body:, params: {}, header_overrides: {}) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 192

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

#create_in_workspace(workspace_id:, body:, params: {}, header_overrides: {}) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 163

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

#create_in_workspace_from_template(workspace_id:, body:, params: {}, header_overrides: {}) ⇒ Object



207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 207

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

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



433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 433

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

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



72
73
74
75
76
77
78
79
80
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 72

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

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



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 120

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

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



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 92

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

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



106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 106

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

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



455
456
457
458
459
460
461
462
463
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 455

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

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



82
83
84
85
86
87
88
89
90
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 82

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

#import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {}) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 222

def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', 'import'],
      body_type: :file
  )
  content_type = file_type_to_content_type(file_type)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
  )
  client.make_request(endpoint_spec, request_spec)
end

#import_from_file_into_folder(folder_id:, file:, file_type:, file_length:, params: {}, header_overrides: {}) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 252

def import_from_file_into_folder(
    folder_id:,
    file:,
    file_type:,
    file_length:,
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['folders', :folder_id, 'sheets', 'import'],
      body_type: :file
  )
  content_type = file_type_to_content_type(file_type)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
      folder_id: folder_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#import_from_file_into_workspace(workspace_id:, file:, file_type:, file_length:, params: {}, header_overrides: {}) ⇒ Object



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 297

def import_from_file_into_workspace(
    workspace_id:,
    file:,
    file_type:,
    file_length:,
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['workspaces', :workspace_id, 'sheets', 'import'],
      body_type: :file
  )
  content_type = file_type_to_content_type(file_type)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
      workspace_id: workspace_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#import_from_file_path(path:, file_type:, params: {}, header_overrides: {}) ⇒ Object



237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 237

def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['sheets', 'import'],
      body_type: :file
  )
  content_type = file_type_to_content_type(file_type)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
  )
  client.make_request(endpoint_spec, request_spec)
end

#import_from_file_path_into_folder(folder_id:, path:, file_type:, params: {}, header_overrides: {}) ⇒ Object



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 275

def import_from_file_path_into_folder(
    folder_id:,
    path:,
    file_type:,
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['folders', :folder_id, 'sheets', 'import'],
      body_type: :file
  )
  content_type = file_type_to_content_type(file_type)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
      folder_id: folder_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#import_from_file_path_into_workspace(workspace_id:, path:, file_type:, params: {}, header_overrides: {}) ⇒ Object



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 320

def import_from_file_path_into_workspace(
    workspace_id:,
    path:,
    file_type:,
    params: {},
    header_overrides: {}
)
  endpoint_spec = Smartsheet::API::EndpointSpec.new(
      :post,
      ['workspaces', :workspace_id, 'sheets', 'import'],
      body_type: :file
  )
  content_type = file_type_to_content_type(file_type)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
      workspace_id: workspace_id
  )
  client.make_request(endpoint_spec, request_spec)
end

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



63
64
65
66
67
68
69
70
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 63

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

#list_for_org(params: {}, header_overrides: {}) ⇒ Object



446
447
448
449
450
451
452
453
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 446

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

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



487
488
489
490
491
492
493
494
495
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 487

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

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



403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 403

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

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



476
477
478
479
480
481
482
483
484
485
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 476

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

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



465
466
467
468
469
470
471
472
473
474
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 465

def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], 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

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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 418

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