Class: Smartsheet::Sheets
- Inherits:
-
Object
- Object
- Smartsheet::Sheets
- Includes:
- Constants
- Defined in:
- lib/smartsheet/endpoints/sheets/sheets.rb
Overview
Sheets Endpoints
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::JSON_TYPE, Constants::OPENXML_SPREADSHEET_TYPE, Constants::PDF_TYPE, Constants::USER_AGENT, Constants::VERSION
Instance Attribute Summary collapse
- #attachments ⇒ SheetsAttachments readonly
- #automation_rules ⇒ AutomationRules readonly
- #cells ⇒ Cells readonly
- #columns ⇒ Columns readonly
- #comments ⇒ Comments readonly
- #cross_sheet_references ⇒ CrossSheetReferences readonly
- #discussions ⇒ Discussions readonly
- #rows ⇒ Rows readonly
- #share ⇒ SheetsShare readonly
Instance Method Summary collapse
-
#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.
- #create(body:, params: {}, header_overrides: {}) ⇒ Object
- #create_from_template(body:, params: {}, header_overrides: {}) ⇒ Object
- #create_in_folder(folder_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #create_in_folder_from_template(folder_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #create_in_workspace(workspace_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #create_in_workspace_from_template(workspace_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #delete(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #get(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #get_as_csv(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #get_as_excel(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #get_as_pdf(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #get_publish_status(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #get_version(sheet_id:, params: {}, header_overrides: {}) ⇒ Object
- #import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {}) ⇒ Object
- #import_from_file_into_folder(folder_id:, file:, file_type:, file_length:, params: {}, header_overrides: {}) ⇒ Object
- #import_from_file_into_workspace(workspace_id:, file:, file_type:, file_length:, params: {}, header_overrides: {}) ⇒ Object
- #import_from_file_path(path:, file_type:, params: {}, header_overrides: {}) ⇒ Object
- #import_from_file_path_into_folder(folder_id:, path:, file_type:, params: {}, header_overrides: {}) ⇒ Object
- #import_from_file_path_into_workspace(workspace_id:, path:, file_type:, params: {}, header_overrides: {}) ⇒ Object
-
#initialize(client) ⇒ Sheets
constructor
A new instance of Sheets.
- #list(params: {}, header_overrides: {}) ⇒ Object
- #list_for_org(params: {}, header_overrides: {}) ⇒ Object
- #list_image_urls(body:, params: {}, header_overrides: {}) ⇒ Object
- #move(sheet_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #send_via_email(sheet_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #set_publish_status(sheet_id:, body:, params: {}, header_overrides: {}) ⇒ Object
- #update(sheet_id:, body:, params: {}, header_overrides: {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Sheets
Returns a new instance of Sheets.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 45 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) @rows = Rows.new(client) @share = SheetsShare.new(client) end |
Instance Attribute Details
#attachments ⇒ SheetsAttachments (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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_rules ⇒ AutomationRules (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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 |
#cells ⇒ Cells (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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 |
#columns ⇒ Columns (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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 |
#comments ⇒ Comments (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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_references ⇒ CrossSheetReferences (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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 |
#discussions ⇒ Discussions (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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 |
#rows ⇒ Rows (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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 |
#share ⇒ SheetsShare (readonly)
38 39 40 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 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 38 class Sheets include Smartsheet::Constants attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments, :cross_sheet_references, :discussions, :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) @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
384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 384 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
130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 130 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
174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 174 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
144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 144 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
188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 188 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
159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 159 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
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 203 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
429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 429 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
68 69 70 71 72 73 74 75 76 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 68 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
116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 116 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
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 88 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
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 102 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
451 452 453 454 455 456 457 458 459 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 451 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
78 79 80 81 82 83 84 85 86 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 78 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
218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 218 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
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 248 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
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 293 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
233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 233 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
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 271 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
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 316 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
59 60 61 62 63 64 65 66 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 59 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
442 443 444 445 446 447 448 449 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 442 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
483 484 485 486 487 488 489 490 491 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 483 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
399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 399 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
472 473 474 475 476 477 478 479 480 481 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 472 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
461 462 463 464 465 466 467 468 469 470 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 461 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
414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/smartsheet/endpoints/sheets/sheets.rb', line 414 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 |