smartsheet 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +11 -11
  3. data/.rubocop.yml +4 -4
  4. data/.travis.yml +13 -6
  5. data/.yardopts +3 -3
  6. data/CHANGELOG.md +103 -0
  7. data/Gemfile +6 -6
  8. data/LICENSE +202 -202
  9. data/README.md +214 -141
  10. data/Rakefile +29 -23
  11. data/bin/console +14 -14
  12. data/bin/setup +8 -8
  13. data/lib/smartsheet.rb +2 -2
  14. data/lib/smartsheet/api/body_builder.rb +25 -25
  15. data/lib/smartsheet/api/endpoint_spec.rb +54 -36
  16. data/lib/smartsheet/api/faraday_adapter/faraday_net_client.rb +45 -42
  17. data/lib/smartsheet/api/faraday_adapter/faraday_response.rb +70 -70
  18. data/lib/smartsheet/api/faraday_adapter/middleware/faraday_error_translator.rb +20 -20
  19. data/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb +25 -25
  20. data/lib/smartsheet/api/file_spec.rb +31 -31
  21. data/lib/smartsheet/api/header_builder.rb +90 -84
  22. data/lib/smartsheet/api/request.rb +42 -29
  23. data/lib/smartsheet/api/request_client.rb +43 -27
  24. data/lib/smartsheet/api/request_logger.rb +182 -182
  25. data/lib/smartsheet/api/request_spec.rb +57 -44
  26. data/lib/smartsheet/api/response_net_client_decorator.rb +54 -54
  27. data/lib/smartsheet/api/retry_logic.rb +40 -40
  28. data/lib/smartsheet/api/retry_net_client_decorator.rb +37 -37
  29. data/lib/smartsheet/api/url_builder.rb +25 -25
  30. data/lib/smartsheet/client.rb +191 -185
  31. data/lib/smartsheet/constants.rb +15 -15
  32. data/lib/smartsheet/endpoints/contacts/contacts.rb +30 -30
  33. data/lib/smartsheet/endpoints/favorites/favorites.rb +159 -159
  34. data/lib/smartsheet/endpoints/folders/folders.rb +125 -125
  35. data/lib/smartsheet/endpoints/groups/groups.rb +83 -83
  36. data/lib/smartsheet/endpoints/home/home.rb +20 -20
  37. data/lib/smartsheet/endpoints/reports/reports.rb +100 -100
  38. data/lib/smartsheet/endpoints/reports/reports_share.rb +69 -69
  39. data/lib/smartsheet/endpoints/search/search.rb +30 -30
  40. data/lib/smartsheet/endpoints/server_info/server_info.rb +21 -21
  41. data/lib/smartsheet/endpoints/share/share.rb +58 -58
  42. data/lib/smartsheet/endpoints/sheets/automation_rules.rb +56 -0
  43. data/lib/smartsheet/endpoints/sheets/cells.rb +82 -82
  44. data/lib/smartsheet/endpoints/sheets/columns.rb +66 -66
  45. data/lib/smartsheet/endpoints/sheets/comments.rb +64 -64
  46. data/lib/smartsheet/endpoints/sheets/comments_attachments.rb +78 -78
  47. data/lib/smartsheet/endpoints/sheets/cross_sheet_references.rb +45 -0
  48. data/lib/smartsheet/endpoints/sheets/discussions.rb +84 -84
  49. data/lib/smartsheet/endpoints/sheets/discussions_attachments.rb +22 -22
  50. data/lib/smartsheet/endpoints/sheets/rows.rb +106 -95
  51. data/lib/smartsheet/endpoints/sheets/rows_attachments.rb +92 -92
  52. data/lib/smartsheet/endpoints/sheets/sheets.rb +326 -317
  53. data/lib/smartsheet/endpoints/sheets/sheets_attachments.rb +174 -174
  54. data/lib/smartsheet/endpoints/sheets/sheets_share.rb +69 -69
  55. data/lib/smartsheet/endpoints/sights/sights.rb +101 -101
  56. data/lib/smartsheet/endpoints/sights/sights_share.rb +69 -69
  57. data/lib/smartsheet/endpoints/templates/templates.rb +29 -29
  58. data/lib/smartsheet/endpoints/token/token.rb +65 -60
  59. data/lib/smartsheet/endpoints/update_requests/sent_update_requests.rb +44 -44
  60. data/lib/smartsheet/endpoints/update_requests/update_requests.rb +74 -74
  61. data/lib/smartsheet/endpoints/users/alternate_emails.rb +79 -79
  62. data/lib/smartsheet/endpoints/users/users.rb +77 -77
  63. data/lib/smartsheet/endpoints/webhooks/webhooks.rb +71 -71
  64. data/lib/smartsheet/endpoints/workspaces/workspaces.rb +87 -87
  65. data/lib/smartsheet/endpoints/workspaces/workspaces_share.rb +70 -70
  66. data/lib/smartsheet/error.rb +69 -69
  67. data/lib/smartsheet/general_request.rb +74 -74
  68. data/lib/smartsheet/version.rb +5 -5
  69. data/smartsheet.gemspec +54 -52
  70. metadata +34 -3
@@ -1,31 +1,31 @@
1
- module Smartsheet
2
- # Search Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#search API Search Docs
4
- class Search
5
- attr_reader :client
6
- private :client
7
-
8
- def initialize(client)
9
- @client = client
10
- end
11
-
12
- def search_all(query:, params: {}, header_overrides: {})
13
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['search'])
14
- request_spec = Smartsheet::API::RequestSpec.new(
15
- header_overrides: header_overrides,
16
- params: params.merge({query: query})
17
- )
18
- client.make_request(endpoint_spec, request_spec)
19
- end
20
-
21
- def search_sheet(sheet_id:, query:, params: {}, header_overrides: {})
22
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['search', 'sheets', :sheet_id])
23
- request_spec = Smartsheet::API::RequestSpec.new(
24
- header_overrides: header_overrides,
25
- params: params.merge({query: query}),
26
- sheet_id: sheet_id
27
- )
28
- client.make_request(endpoint_spec, request_spec)
29
- end
30
- end
1
+ module Smartsheet
2
+ # Search Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#search API Search Docs
4
+ class Search
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def search_all(query:, params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['search'])
14
+ request_spec = Smartsheet::API::RequestSpec.new(
15
+ header_overrides: header_overrides,
16
+ params: params.merge({query: query})
17
+ )
18
+ client.make_request(endpoint_spec, request_spec)
19
+ end
20
+
21
+ def search_sheet(sheet_id:, query:, params: {}, header_overrides: {})
22
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['search', 'sheets', :sheet_id])
23
+ request_spec = Smartsheet::API::RequestSpec.new(
24
+ header_overrides: header_overrides,
25
+ params: params.merge({query: query}),
26
+ sheet_id: sheet_id
27
+ )
28
+ client.make_request(endpoint_spec, request_spec)
29
+ end
30
+ end
31
31
  end
@@ -1,22 +1,22 @@
1
- module Smartsheet
2
- # Server Information Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#server-information API Server
4
- # Information Docs
5
- class ServerInfo
6
- attr_reader :client
7
- private :client
8
-
9
- def initialize(client)
10
- @client = client
11
- end
12
-
13
- def get(params: {}, header_overrides: {})
14
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['serverinfo'], no_auth: true)
15
- request_spec = Smartsheet::API::RequestSpec.new(
16
- params: params,
17
- header_overrides: header_overrides,
18
- )
19
- client.make_request(endpoint_spec, request_spec)
20
- end
21
- end
1
+ module Smartsheet
2
+ # Server Information Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#server-information API Server
4
+ # Information Docs
5
+ class ServerInfo
6
+ attr_reader :client
7
+ private :client
8
+
9
+ def initialize(client)
10
+ @client = client
11
+ end
12
+
13
+ def get(params: {}, header_overrides: {})
14
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['serverinfo'], no_auth: true)
15
+ request_spec = Smartsheet::API::RequestSpec.new(
16
+ params: params,
17
+ header_overrides: header_overrides,
18
+ )
19
+ client.make_request(endpoint_spec, request_spec)
20
+ end
21
+ end
22
22
  end
@@ -1,59 +1,59 @@
1
- module Smartsheet
2
- # Sharing Endpoints Mixin
3
- module Share
4
- def delete_share(share_id:, url:, params:, header_overrides:, **url_args)
5
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, url + ['shares', :share_id])
6
- request_spec = Smartsheet::API::RequestSpec.new(
7
- params: params,
8
- header_overrides: header_overrides,
9
- share_id: share_id,
10
- **url_args
11
- )
12
- client.make_request(endpoint_spec, request_spec)
13
- end
14
-
15
- def get_share(share_id:, url:, params:, header_overrides:, **url_args)
16
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, url + ['shares', :share_id])
17
- request_spec = Smartsheet::API::RequestSpec.new(
18
- params: params,
19
- header_overrides: header_overrides,
20
- share_id: share_id,
21
- **url_args
22
- )
23
- client.make_request(endpoint_spec, request_spec)
24
- end
25
-
26
- def list_share(url:, params:, header_overrides:, **url_args)
27
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, url + ['shares'])
28
- request_spec = Smartsheet::API::RequestSpec.new(
29
- header_overrides: header_overrides,
30
- params: params,
31
- **url_args
32
- )
33
- client.make_request(endpoint_spec, request_spec)
34
- end
35
-
36
- def create_share(url:, body:, params:, header_overrides:, **url_args)
37
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, url + ['shares'], body_type: :json)
38
- request_spec = Smartsheet::API::RequestSpec.new(
39
- header_overrides: header_overrides,
40
- params: params,
41
- body: body,
42
- **url_args
43
- )
44
- client.make_request(endpoint_spec, request_spec)
45
- end
46
-
47
- def update_share(share_id:, url:, body:, params:, header_overrides:, **url_args)
48
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, url + ['shares', :share_id], body_type: :json)
49
- request_spec = Smartsheet::API::RequestSpec.new(
50
- params: params,
51
- header_overrides: header_overrides,
52
- body: body,
53
- share_id: share_id,
54
- **url_args
55
- )
56
- client.make_request(endpoint_spec, request_spec)
57
- end
58
- end
1
+ module Smartsheet
2
+ # Sharing Endpoints Mixin
3
+ module Share
4
+ def delete_share(share_id:, url:, params:, header_overrides:, **url_args)
5
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, url + ['shares', :share_id])
6
+ request_spec = Smartsheet::API::RequestSpec.new(
7
+ params: params,
8
+ header_overrides: header_overrides,
9
+ share_id: share_id,
10
+ **url_args
11
+ )
12
+ client.make_request(endpoint_spec, request_spec)
13
+ end
14
+
15
+ def get_share(share_id:, url:, params:, header_overrides:, **url_args)
16
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, url + ['shares', :share_id])
17
+ request_spec = Smartsheet::API::RequestSpec.new(
18
+ params: params,
19
+ header_overrides: header_overrides,
20
+ share_id: share_id,
21
+ **url_args
22
+ )
23
+ client.make_request(endpoint_spec, request_spec)
24
+ end
25
+
26
+ def list_share(url:, params:, header_overrides:, **url_args)
27
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, url + ['shares'])
28
+ request_spec = Smartsheet::API::RequestSpec.new(
29
+ header_overrides: header_overrides,
30
+ params: params,
31
+ **url_args
32
+ )
33
+ client.make_request(endpoint_spec, request_spec)
34
+ end
35
+
36
+ def create_share(url:, body:, params:, header_overrides:, **url_args)
37
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, url + ['shares'], body_type: :json)
38
+ request_spec = Smartsheet::API::RequestSpec.new(
39
+ header_overrides: header_overrides,
40
+ params: params,
41
+ body: body,
42
+ **url_args
43
+ )
44
+ client.make_request(endpoint_spec, request_spec)
45
+ end
46
+
47
+ def update_share(share_id:, url:, body:, params:, header_overrides:, **url_args)
48
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, url + ['shares', :share_id], body_type: :json)
49
+ request_spec = Smartsheet::API::RequestSpec.new(
50
+ params: params,
51
+ header_overrides: header_overrides,
52
+ body: body,
53
+ share_id: share_id,
54
+ **url_args
55
+ )
56
+ client.make_request(endpoint_spec, request_spec)
57
+ end
58
+ end
59
59
  end
@@ -0,0 +1,56 @@
1
+ module Smartsheet
2
+ # Automation Rules Endpoints
3
+ # @see http://smartsheet-platform.github.io/api-docs/?ruby#automation-rules API Automation Rules Docs
4
+ class AutomationRules
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def list(sheet_id:, params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'automationrules'])
14
+ request_spec = Smartsheet::API::RequestSpec.new(
15
+ params: params,
16
+ header_overrides: header_overrides,
17
+ sheet_id: sheet_id
18
+ )
19
+ client.make_request(endpoint_spec, request_spec)
20
+ end
21
+
22
+ def get(sheet_id:, automation_rule_id:, params: {}, header_overrides: {})
23
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'automationrules', :automation_rule_id])
24
+ request_spec = Smartsheet::API::RequestSpec.new(
25
+ params: params,
26
+ header_overrides: header_overrides,
27
+ sheet_id: sheet_id,
28
+ automation_rule_id: automation_rule_id
29
+ )
30
+ client.make_request(endpoint_spec, request_spec)
31
+ end
32
+
33
+ def update(sheet_id:, automation_rule_id:, body:, params: {}, header_overrides: {})
34
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'automationrules', :automation_rule_id], body_type: :json)
35
+ request_spec = Smartsheet::API::RequestSpec.new(
36
+ header_overrides: header_overrides,
37
+ params: params,
38
+ body: body,
39
+ sheet_id: sheet_id,
40
+ automation_rule_id: automation_rule_id
41
+ )
42
+ client.make_request(endpoint_spec, request_spec)
43
+ end
44
+
45
+ def delete(sheet_id:, automation_rule_id:, params: {}, header_overrides: {})
46
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'automationrules', :automation_rule_id])
47
+ request_spec = Smartsheet::API::RequestSpec.new(
48
+ params: params,
49
+ header_overrides: header_overrides,
50
+ sheet_id: sheet_id,
51
+ automation_rule_id: automation_rule_id
52
+ )
53
+ client.make_request(endpoint_spec, request_spec)
54
+ end
55
+ end
56
+ end
@@ -1,82 +1,82 @@
1
- require 'smartsheet/api/file_spec'
2
-
3
- module Smartsheet
4
- # Cells Endpoints
5
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#cells API Cells Docs
6
- class Cells
7
- attr_reader :client
8
- private :client
9
-
10
- def initialize(client)
11
- @client = client
12
- end
13
-
14
- def get_history(sheet_id:, row_id:, column_id:, params: {}, header_overrides: {})
15
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
16
- :get,
17
- ['sheets', :sheet_id, 'rows', :row_id, 'columns', :column_id, 'history']
18
- )
19
- request_spec = Smartsheet::API::RequestSpec.new(
20
- header_overrides: header_overrides,
21
- params: params,
22
- sheet_id: sheet_id,
23
- row_id: row_id,
24
- column_id: column_id
25
- )
26
- client.make_request(endpoint_spec, request_spec)
27
- end
28
-
29
- def add_image(
30
- sheet_id:,
31
- row_id:,
32
- column_id:,
33
- file:,
34
- filename:,
35
- file_length:,
36
- content_type: '',
37
- params: {},
38
- header_overrides: {}
39
- )
40
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
41
- :post,
42
- ['sheets', :sheet_id, 'rows', :row_id, 'columns', :column_id, 'cellimages'],
43
- body_type: :file
44
- )
45
- request_spec = Smartsheet::API::RequestSpec.new(
46
- header_overrides: header_overrides,
47
- params: params,
48
- file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
49
- sheet_id: sheet_id,
50
- row_id: row_id,
51
- column_id: column_id
52
- )
53
- client.make_request(endpoint_spec, request_spec)
54
- end
55
-
56
- def add_image_from_path(
57
- sheet_id:,
58
- row_id:,
59
- column_id:,
60
- path:,
61
- filename: '',
62
- content_type: '',
63
- params: {},
64
- header_overrides: {}
65
- )
66
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
67
- :post,
68
- ['sheets', :sheet_id, 'rows', :row_id, 'columns', :column_id, 'cellimages'],
69
- body_type: :file
70
- )
71
- request_spec = Smartsheet::API::RequestSpec.new(
72
- header_overrides: header_overrides,
73
- params: params,
74
- file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
75
- sheet_id: sheet_id,
76
- row_id: row_id,
77
- column_id: column_id
78
- )
79
- client.make_request(endpoint_spec, request_spec)
80
- end
81
- end
82
- end
1
+ require 'smartsheet/api/file_spec'
2
+
3
+ module Smartsheet
4
+ # Cells Endpoints
5
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#cells API Cells Docs
6
+ class Cells
7
+ attr_reader :client
8
+ private :client
9
+
10
+ def initialize(client)
11
+ @client = client
12
+ end
13
+
14
+ def get_history(sheet_id:, row_id:, column_id:, params: {}, header_overrides: {})
15
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
16
+ :get,
17
+ ['sheets', :sheet_id, 'rows', :row_id, 'columns', :column_id, 'history']
18
+ )
19
+ request_spec = Smartsheet::API::RequestSpec.new(
20
+ header_overrides: header_overrides,
21
+ params: params,
22
+ sheet_id: sheet_id,
23
+ row_id: row_id,
24
+ column_id: column_id
25
+ )
26
+ client.make_request(endpoint_spec, request_spec)
27
+ end
28
+
29
+ def add_image(
30
+ sheet_id:,
31
+ row_id:,
32
+ column_id:,
33
+ file:,
34
+ filename:,
35
+ file_length:,
36
+ content_type: '',
37
+ params: {},
38
+ header_overrides: {}
39
+ )
40
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
41
+ :post,
42
+ ['sheets', :sheet_id, 'rows', :row_id, 'columns', :column_id, 'cellimages'],
43
+ body_type: :file
44
+ )
45
+ request_spec = Smartsheet::API::RequestSpec.new(
46
+ header_overrides: header_overrides,
47
+ params: params,
48
+ file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
49
+ sheet_id: sheet_id,
50
+ row_id: row_id,
51
+ column_id: column_id
52
+ )
53
+ client.make_request(endpoint_spec, request_spec)
54
+ end
55
+
56
+ def add_image_from_path(
57
+ sheet_id:,
58
+ row_id:,
59
+ column_id:,
60
+ path:,
61
+ filename: nil,
62
+ content_type: '',
63
+ params: {},
64
+ header_overrides: {}
65
+ )
66
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
67
+ :post,
68
+ ['sheets', :sheet_id, 'rows', :row_id, 'columns', :column_id, 'cellimages'],
69
+ body_type: :file
70
+ )
71
+ request_spec = Smartsheet::API::RequestSpec.new(
72
+ header_overrides: header_overrides,
73
+ params: params,
74
+ file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
75
+ sheet_id: sheet_id,
76
+ row_id: row_id,
77
+ column_id: column_id
78
+ )
79
+ client.make_request(endpoint_spec, request_spec)
80
+ end
81
+ end
82
+ end
@@ -1,67 +1,67 @@
1
- module Smartsheet
2
- # Columns Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#columns API Columns Docs
4
- class Columns
5
- attr_reader :client
6
- private :client
7
-
8
- def initialize(client)
9
- @client = client
10
- end
11
-
12
- def add(sheet_id:, body:, params: {}, header_overrides: {})
13
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'columns'], body_type: :json)
14
- request_spec = Smartsheet::API::RequestSpec.new(
15
- header_overrides: header_overrides,
16
- params: params,
17
- body: body,
18
- sheet_id: sheet_id
19
- )
20
- client.make_request(endpoint_spec, request_spec)
21
- end
22
-
23
- def delete(sheet_id:, column_id:, params: {}, header_overrides: {})
24
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'columns', :column_id])
25
- request_spec = Smartsheet::API::RequestSpec.new(
26
- params: params,
27
- header_overrides: header_overrides,
28
- column_id: column_id,
29
- sheet_id: sheet_id
30
- )
31
- client.make_request(endpoint_spec, request_spec)
32
- end
33
-
34
- def get(sheet_id:, column_id:, params: {}, header_overrides: {})
35
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'columns', :column_id])
36
- request_spec = Smartsheet::API::RequestSpec.new(
37
- header_overrides: header_overrides,
38
- params: params,
39
- column_id: column_id,
40
- sheet_id: sheet_id
41
- )
42
- client.make_request(endpoint_spec, request_spec)
43
- end
44
-
45
- def list(sheet_id:, params: {}, header_overrides: {})
46
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'columns'])
47
- request_spec = Smartsheet::API::RequestSpec.new(
48
- header_overrides: header_overrides,
49
- params: params,
50
- sheet_id: sheet_id
51
- )
52
- client.make_request(endpoint_spec, request_spec)
53
- end
54
-
55
- def update(sheet_id:, column_id:, body:, params: {}, header_overrides: {})
56
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'columns', :column_id], body_type: :json)
57
- request_spec = Smartsheet::API::RequestSpec.new(
58
- header_overrides: header_overrides,
59
- params: params,
60
- body: body,
61
- sheet_id: sheet_id,
62
- column_id: column_id
63
- )
64
- client.make_request(endpoint_spec, request_spec)
65
- end
66
- end
1
+ module Smartsheet
2
+ # Columns Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#columns API Columns Docs
4
+ class Columns
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def add(sheet_id:, body:, params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'columns'], body_type: :json)
14
+ request_spec = Smartsheet::API::RequestSpec.new(
15
+ header_overrides: header_overrides,
16
+ params: params,
17
+ body: body,
18
+ sheet_id: sheet_id
19
+ )
20
+ client.make_request(endpoint_spec, request_spec)
21
+ end
22
+
23
+ def delete(sheet_id:, column_id:, params: {}, header_overrides: {})
24
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'columns', :column_id])
25
+ request_spec = Smartsheet::API::RequestSpec.new(
26
+ params: params,
27
+ header_overrides: header_overrides,
28
+ column_id: column_id,
29
+ sheet_id: sheet_id
30
+ )
31
+ client.make_request(endpoint_spec, request_spec)
32
+ end
33
+
34
+ def get(sheet_id:, column_id:, params: {}, header_overrides: {})
35
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'columns', :column_id])
36
+ request_spec = Smartsheet::API::RequestSpec.new(
37
+ header_overrides: header_overrides,
38
+ params: params,
39
+ column_id: column_id,
40
+ sheet_id: sheet_id
41
+ )
42
+ client.make_request(endpoint_spec, request_spec)
43
+ end
44
+
45
+ def list(sheet_id:, params: {}, header_overrides: {})
46
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'columns'])
47
+ request_spec = Smartsheet::API::RequestSpec.new(
48
+ header_overrides: header_overrides,
49
+ params: params,
50
+ sheet_id: sheet_id
51
+ )
52
+ client.make_request(endpoint_spec, request_spec)
53
+ end
54
+
55
+ def update(sheet_id:, column_id:, body:, params: {}, header_overrides: {})
56
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'columns', :column_id], body_type: :json)
57
+ request_spec = Smartsheet::API::RequestSpec.new(
58
+ header_overrides: header_overrides,
59
+ params: params,
60
+ body: body,
61
+ sheet_id: sheet_id,
62
+ column_id: column_id
63
+ )
64
+ client.make_request(endpoint_spec, request_spec)
65
+ end
66
+ end
67
67
  end