smartsheet 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,23 +1,23 @@
1
- module Smartsheet
2
- # Discussions Attachments Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#attachments API Attachments Docs
4
- class DiscussionsAttachments
5
- attr_reader :client
6
- private :client
7
-
8
- def initialize(client)
9
- @client = client
10
- end
11
-
12
- def list(sheet_id:, discussion_id:, params: {}, header_overrides: {})
13
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'discussions', :discussion_id, 'attachments'])
14
- request_spec = Smartsheet::API::RequestSpec.new(
15
- params: params,
16
- header_overrides: header_overrides,
17
- sheet_id: sheet_id,
18
- discussion_id: discussion_id
19
- )
20
- client.make_request(endpoint_spec, request_spec)
21
- end
22
- end
1
+ module Smartsheet
2
+ # Discussions Attachments Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#attachments API Attachments Docs
4
+ class DiscussionsAttachments
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def list(sheet_id:, discussion_id:, params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'discussions', :discussion_id, 'attachments'])
14
+ request_spec = Smartsheet::API::RequestSpec.new(
15
+ params: params,
16
+ header_overrides: header_overrides,
17
+ sheet_id: sheet_id,
18
+ discussion_id: discussion_id
19
+ )
20
+ client.make_request(endpoint_spec, request_spec)
21
+ end
22
+ end
23
23
  end
@@ -1,96 +1,107 @@
1
- require 'smartsheet/endpoints/sheets/rows_attachments'
2
-
3
- module Smartsheet
4
- # Rows Endpoints
5
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#rows API Rows Docs
6
- #
7
- # @!attribute [r] attachments
8
- # @return [RowsAttachments]
9
- class Rows
10
- attr_reader :client, :attachments
11
- private :client
12
-
13
- def initialize(client)
14
- @client = client
15
-
16
- @attachments = RowsAttachments.new(client)
17
- end
18
-
19
- def add(sheet_id:, body:, params: {}, header_overrides: {})
20
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows'], body_type: :json)
21
- request_spec = Smartsheet::API::RequestSpec.new(
22
- header_overrides: header_overrides,
23
- params: params,
24
- body: body,
25
- sheet_id: sheet_id
26
- )
27
- client.make_request(endpoint_spec, request_spec)
28
- end
29
-
30
- def copy_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
31
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'copy'], body_type: :json)
32
- request_spec = Smartsheet::API::RequestSpec.new(
33
- header_overrides: header_overrides,
34
- body: body,
35
- params: params,
36
- sheet_id: sheet_id
37
- )
38
- client.make_request(endpoint_spec, request_spec)
39
- end
40
-
41
- def delete(sheet_id:, row_ids:, params: {}, header_overrides: {})
42
- params[:ids] = row_ids.join(',')
43
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'rows'])
44
- request_spec = Smartsheet::API::RequestSpec.new(
45
- header_overrides: header_overrides,
46
- params: params,
47
- sheet_id: sheet_id
48
- )
49
- client.make_request(endpoint_spec, request_spec)
50
- end
51
-
52
- def get(sheet_id:, row_id:, params: {}, header_overrides: {})
53
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'rows', :row_id])
54
- request_spec = Smartsheet::API::RequestSpec.new(
55
- header_overrides: header_overrides,
56
- params: params,
57
- sheet_id: sheet_id,
58
- row_id: row_id
59
- )
60
- client.make_request(endpoint_spec, request_spec)
61
- end
62
-
63
- def move_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
64
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'move'], body_type: :json)
65
- request_spec = Smartsheet::API::RequestSpec.new(
66
- header_overrides: header_overrides,
67
- body: body,
68
- params: params,
69
- sheet_id: sheet_id
70
- )
71
- client.make_request(endpoint_spec, request_spec)
72
- end
73
-
74
- def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
75
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'emails'], body_type: :json)
76
- request_spec = Smartsheet::API::RequestSpec.new(
77
- header_overrides: header_overrides,
78
- params: params,
79
- body: body,
80
- sheet_id: sheet_id
81
- )
82
- client.make_request(endpoint_spec, request_spec)
83
- end
84
-
85
- def update(sheet_id:, body:, params: {}, header_overrides: {})
86
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'rows'], body_type: :json)
87
- request_spec = Smartsheet::API::RequestSpec.new(
88
- header_overrides: header_overrides,
89
- body: body,
90
- params: params,
91
- sheet_id: sheet_id
92
- )
93
- client.make_request(endpoint_spec, request_spec)
94
- end
95
- end
1
+ require 'smartsheet/endpoints/sheets/rows_attachments'
2
+
3
+ module Smartsheet
4
+ # Rows Endpoints
5
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#rows API Rows Docs
6
+ #
7
+ # @!attribute [r] attachments
8
+ # @return [RowsAttachments]
9
+ class Rows
10
+ attr_reader :client, :attachments
11
+ private :client
12
+
13
+ def initialize(client)
14
+ @client = client
15
+
16
+ @attachments = RowsAttachments.new(client)
17
+ end
18
+
19
+ def add(sheet_id:, body:, params: {}, header_overrides: {})
20
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows'], body_type: :json)
21
+ request_spec = Smartsheet::API::RequestSpec.new(
22
+ header_overrides: header_overrides,
23
+ params: params,
24
+ body: body,
25
+ sheet_id: sheet_id
26
+ )
27
+ client.make_request(endpoint_spec, request_spec)
28
+ end
29
+
30
+ def copy_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
31
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'copy'], body_type: :json)
32
+ request_spec = Smartsheet::API::RequestSpec.new(
33
+ header_overrides: header_overrides,
34
+ body: body,
35
+ params: params,
36
+ sheet_id: sheet_id
37
+ )
38
+ client.make_request(endpoint_spec, request_spec)
39
+ end
40
+
41
+ def delete(sheet_id:, row_ids:, params: {}, header_overrides: {})
42
+ params[:ids] = row_ids.join(',')
43
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'rows'])
44
+ request_spec = Smartsheet::API::RequestSpec.new(
45
+ header_overrides: header_overrides,
46
+ params: params,
47
+ sheet_id: sheet_id
48
+ )
49
+ client.make_request(endpoint_spec, request_spec)
50
+ end
51
+
52
+ def get(sheet_id:, row_id:, params: {}, header_overrides: {})
53
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'rows', :row_id])
54
+ request_spec = Smartsheet::API::RequestSpec.new(
55
+ header_overrides: header_overrides,
56
+ params: params,
57
+ sheet_id: sheet_id,
58
+ row_id: row_id
59
+ )
60
+ client.make_request(endpoint_spec, request_spec)
61
+ end
62
+
63
+ def move_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
64
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'move'], body_type: :json)
65
+ request_spec = Smartsheet::API::RequestSpec.new(
66
+ header_overrides: header_overrides,
67
+ body: body,
68
+ params: params,
69
+ sheet_id: sheet_id
70
+ )
71
+ client.make_request(endpoint_spec, request_spec)
72
+ end
73
+
74
+ def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
75
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'emails'], body_type: :json)
76
+ request_spec = Smartsheet::API::RequestSpec.new(
77
+ header_overrides: header_overrides,
78
+ params: params,
79
+ body: body,
80
+ sheet_id: sheet_id
81
+ )
82
+ client.make_request(endpoint_spec, request_spec)
83
+ end
84
+
85
+ def update(sheet_id:, body:, params: {}, header_overrides: {})
86
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'rows'], body_type: :json)
87
+ request_spec = Smartsheet::API::RequestSpec.new(
88
+ header_overrides: header_overrides,
89
+ body: body,
90
+ params: params,
91
+ sheet_id: sheet_id
92
+ )
93
+ client.make_request(endpoint_spec, request_spec)
94
+ end
95
+
96
+ def sort(sheet_id:, body:, params: {}, header_overrides: {})
97
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'sort'], body_type: :json)
98
+ request_spec = Smartsheet::API::RequestSpec.new(
99
+ header_overrides: header_overrides,
100
+ body: body,
101
+ params: params,
102
+ sheet_id: sheet_id
103
+ )
104
+ client.make_request(endpoint_spec, request_spec)
105
+ end
106
+ end
96
107
  end
@@ -1,93 +1,93 @@
1
- require 'smartsheet/api/file_spec'
2
-
3
- module Smartsheet
4
- # Rows Attachments Endpoints
5
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#attachments API Attachments Docs
6
- class RowsAttachments
7
- attr_reader :client
8
- private :client
9
-
10
- def initialize(client)
11
- @client = client
12
- end
13
-
14
- def list(sheet_id:, row_id:, params: {}, header_overrides: {})
15
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
16
- :get,
17
- ['sheets', :sheet_id, 'rows', :row_id, 'attachments']
18
- )
19
- request_spec = Smartsheet::API::RequestSpec.new(
20
- params: params,
21
- header_overrides: header_overrides,
22
- sheet_id: sheet_id,
23
- row_id: row_id
24
- )
25
- client.make_request(endpoint_spec, request_spec)
26
- end
27
-
28
- def attach_url(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
29
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
30
- :post,
31
- ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
32
- body_type: :json
33
- )
34
- request_spec = Smartsheet::API::RequestSpec.new(
35
- header_overrides: header_overrides,
36
- params: params,
37
- body: body,
38
- sheet_id: sheet_id,
39
- row_id: row_id
40
- )
41
- client.make_request(endpoint_spec, request_spec)
42
- end
43
-
44
- def attach_file(
45
- sheet_id:,
46
- row_id:,
47
- file:,
48
- filename:,
49
- file_length:,
50
- content_type: '',
51
- params: {},
52
- header_overrides: {}
53
- )
54
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
55
- :post,
56
- ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
57
- body_type: :file
58
- )
59
- request_spec = Smartsheet::API::RequestSpec.new(
60
- params: params,
61
- header_overrides: header_overrides,
62
- file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
63
- sheet_id: sheet_id,
64
- row_id: row_id
65
- )
66
- client.make_request(endpoint_spec, request_spec)
67
- end
68
-
69
- def attach_file_from_path(
70
- sheet_id:,
71
- row_id:,
72
- path:,
73
- filename: nil,
74
- content_type: '',
75
- params: {},
76
- header_overrides: {}
77
- )
78
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
79
- :post,
80
- ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
81
- body_type: :file
82
- )
83
- request_spec = Smartsheet::API::RequestSpec.new(
84
- params: params,
85
- header_overrides: header_overrides,
86
- file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
87
- sheet_id: sheet_id,
88
- row_id: row_id
89
- )
90
- client.make_request(endpoint_spec, request_spec)
91
- end
92
- end
1
+ require 'smartsheet/api/file_spec'
2
+
3
+ module Smartsheet
4
+ # Rows Attachments Endpoints
5
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#attachments API Attachments Docs
6
+ class RowsAttachments
7
+ attr_reader :client
8
+ private :client
9
+
10
+ def initialize(client)
11
+ @client = client
12
+ end
13
+
14
+ def list(sheet_id:, row_id:, params: {}, header_overrides: {})
15
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
16
+ :get,
17
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments']
18
+ )
19
+ request_spec = Smartsheet::API::RequestSpec.new(
20
+ params: params,
21
+ header_overrides: header_overrides,
22
+ sheet_id: sheet_id,
23
+ row_id: row_id
24
+ )
25
+ client.make_request(endpoint_spec, request_spec)
26
+ end
27
+
28
+ def attach_url(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
29
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
30
+ :post,
31
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
32
+ body_type: :json
33
+ )
34
+ request_spec = Smartsheet::API::RequestSpec.new(
35
+ header_overrides: header_overrides,
36
+ params: params,
37
+ body: body,
38
+ sheet_id: sheet_id,
39
+ row_id: row_id
40
+ )
41
+ client.make_request(endpoint_spec, request_spec)
42
+ end
43
+
44
+ def attach_file(
45
+ sheet_id:,
46
+ row_id:,
47
+ file:,
48
+ filename:,
49
+ file_length:,
50
+ content_type: '',
51
+ params: {},
52
+ header_overrides: {}
53
+ )
54
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
55
+ :post,
56
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
57
+ body_type: :file
58
+ )
59
+ request_spec = Smartsheet::API::RequestSpec.new(
60
+ params: params,
61
+ header_overrides: header_overrides,
62
+ file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
63
+ sheet_id: sheet_id,
64
+ row_id: row_id
65
+ )
66
+ client.make_request(endpoint_spec, request_spec)
67
+ end
68
+
69
+ def attach_file_from_path(
70
+ sheet_id:,
71
+ row_id:,
72
+ path:,
73
+ filename: nil,
74
+ content_type: '',
75
+ params: {},
76
+ header_overrides: {}
77
+ )
78
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
79
+ :post,
80
+ ['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
81
+ body_type: :file
82
+ )
83
+ request_spec = Smartsheet::API::RequestSpec.new(
84
+ params: params,
85
+ header_overrides: header_overrides,
86
+ file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
87
+ sheet_id: sheet_id,
88
+ row_id: row_id
89
+ )
90
+ client.make_request(endpoint_spec, request_spec)
91
+ end
92
+ end
93
93
  end
@@ -1,317 +1,326 @@
1
- require 'smartsheet/api/endpoint_spec'
2
- require 'smartsheet/api/request_spec'
3
- require 'smartsheet/constants'
4
-
5
- require 'smartsheet/endpoints/sheets/cells'
6
- require 'smartsheet/endpoints/sheets/columns'
7
- require 'smartsheet/endpoints/sheets/comments'
8
- require 'smartsheet/endpoints/sheets/discussions'
9
- require 'smartsheet/endpoints/sheets/rows'
10
- require 'smartsheet/endpoints/sheets/sheets_attachments'
11
- require 'smartsheet/endpoints/sheets/sheets_share'
12
-
13
- module Smartsheet
14
- # Sheets Endpoints
15
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#sheets API Sheets Docs
16
- #
17
- # @!attribute [r] attachments
18
- # @return [SheetsAttachments]
19
- # @!attribute [r] cells
20
- # @return [Cells]
21
- # @!attribute [r] columns
22
- # @return [Columns]
23
- # @!attribute [r] comments
24
- # @return [Comments]
25
- # @!attribute [r] discussions
26
- # @return [Discussions]
27
- # @!attribute [r] rows
28
- # @return [Rows]
29
- # @!attribute [r] share
30
- # @return [SheetsShare]
31
- class Sheets
32
- include Smartsheet::Constants
33
-
34
- attr_reader :client, :attachments, :cells, :columns, :comments, :discussions, :rows, :share
35
- private :client
36
-
37
- def initialize(client)
38
- @client = client
39
-
40
- @attachments = SheetsAttachments.new(client)
41
- @cells = Cells.new(client)
42
- @columns = Columns.new(client)
43
- @comments = Comments.new(client)
44
- @discussions = Discussions.new(client)
45
- @rows = Rows.new(client)
46
- @share = SheetsShare.new(client)
47
- end
48
-
49
- def list(params: {}, header_overrides: {})
50
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets'])
51
- request_spec = Smartsheet::API::RequestSpec.new(
52
- params: params,
53
- header_overrides: header_overrides
54
- )
55
- client.make_request(endpoint_spec, request_spec)
56
- end
57
-
58
- def get(sheet_id:, params: {}, header_overrides: {})
59
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id])
60
- request_spec = Smartsheet::API::RequestSpec.new(
61
- params: params,
62
- header_overrides: header_overrides,
63
- sheet_id: sheet_id
64
- )
65
- client.make_request(endpoint_spec, request_spec)
66
- end
67
-
68
- def get_version(sheet_id:, params: {}, header_overrides: {})
69
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'version'])
70
- request_spec = Smartsheet::API::RequestSpec.new(
71
- params: params,
72
- header_overrides: header_overrides,
73
- sheet_id: sheet_id
74
- )
75
- client.make_request(endpoint_spec, request_spec)
76
- end
77
-
78
- def get_as_excel(sheet_id:, params: {}, header_overrides: {})
79
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
80
- :get,
81
- ['sheets', :sheet_id],
82
- headers: {Accept: EXCEL_TYPE}
83
- )
84
- request_spec = Smartsheet::API::RequestSpec.new(
85
- params: params,
86
- header_overrides: header_overrides,
87
- sheet_id: sheet_id
88
- )
89
- client.make_request(endpoint_spec, request_spec)
90
- end
91
-
92
- def get_as_pdf(sheet_id:, params: {}, header_overrides: {})
93
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
94
- :get,
95
- ['sheets', :sheet_id],
96
- headers: {Accept: PDF_TYPE}
97
- )
98
- request_spec = Smartsheet::API::RequestSpec.new(
99
- params: params,
100
- header_overrides: header_overrides,
101
- sheet_id: sheet_id
102
- )
103
- client.make_request(endpoint_spec, request_spec)
104
- end
105
-
106
- def get_as_csv(sheet_id:, params: {}, header_overrides: {})
107
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
108
- :get,
109
- ['sheets', :sheet_id],
110
- headers: {Accept: CSV_TYPE}
111
- )
112
- request_spec = Smartsheet::API::RequestSpec.new(
113
- params: params,
114
- header_overrides: header_overrides,
115
- sheet_id: sheet_id
116
- )
117
- client.make_request(endpoint_spec, request_spec)
118
- end
119
-
120
- def create(body:, params: {}, header_overrides: {})
121
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
122
- :post,
123
- ['sheets'],
124
- body_type: :json
125
- )
126
- request_spec = Smartsheet::API::RequestSpec.new(
127
- params: params,
128
- header_overrides: header_overrides,
129
- body: body
130
- )
131
- client.make_request(endpoint_spec, request_spec)
132
- end
133
-
134
- def create_in_folder(folder_id:, body:, params: {}, header_overrides: {})
135
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
136
- :post,
137
- ['folders', :folder_id, 'sheets'],
138
- body_type: :json
139
- )
140
- request_spec = Smartsheet::API::RequestSpec.new(
141
- params: params,
142
- header_overrides: header_overrides,
143
- body: body,
144
- folder_id: folder_id
145
- )
146
- client.make_request(endpoint_spec, request_spec)
147
- end
148
-
149
- def create_in_workspace(workspace_id:, body:, params: {}, header_overrides: {})
150
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
151
- :post,
152
- ['workspaces', :workspace_id, 'sheets'],
153
- body_type: :json
154
- )
155
- request_spec = Smartsheet::API::RequestSpec.new(
156
- params: params,
157
- header_overrides: header_overrides,
158
- body: body,
159
- workspace_id: workspace_id
160
- )
161
- client.make_request(endpoint_spec, request_spec)
162
- end
163
-
164
- def create_from_template(body:, params: {}, header_overrides: {})
165
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
166
- :post,
167
- ['sheets'],
168
- body_type: :json
169
- )
170
- request_spec = Smartsheet::API::RequestSpec.new(
171
- params: params,
172
- header_overrides: header_overrides,
173
- body: body
174
- )
175
- client.make_request(endpoint_spec, request_spec)
176
- end
177
-
178
- def create_in_folder_from_template(folder_id:, body:, params: {}, header_overrides: {})
179
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
180
- :post,
181
- ['folders', :folder_id, 'sheets'],
182
- body_type: :json
183
- )
184
- request_spec = Smartsheet::API::RequestSpec.new(
185
- params: params,
186
- header_overrides: header_overrides,
187
- body: body,
188
- folder_id: folder_id
189
- )
190
- client.make_request(endpoint_spec, request_spec)
191
- end
192
-
193
- def create_in_workspace_from_template(workspace_id:, body:, params: {}, header_overrides: {})
194
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
195
- :post,
196
- ['workspaces', :workspace_id, 'sheets'],
197
- body_type: :json
198
- )
199
- request_spec = Smartsheet::API::RequestSpec.new(
200
- params: params,
201
- header_overrides: header_overrides,
202
- body: body,
203
- workspace_id: workspace_id
204
- )
205
- client.make_request(endpoint_spec, request_spec)
206
- end
207
-
208
- def copy(sheet_id:, body:, params: {}, header_overrides: {})
209
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
210
- :post,
211
- ['sheets', :sheet_id, 'copy'],
212
- body_type: :json
213
- )
214
- request_spec = Smartsheet::API::RequestSpec.new(
215
- params: params,
216
- header_overrides: header_overrides,
217
- body: body,
218
- sheet_id: sheet_id
219
- )
220
- client.make_request(endpoint_spec, request_spec)
221
- end
222
-
223
- def move(sheet_id:, body:, params: {}, header_overrides: {})
224
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
225
- :post,
226
- ['sheets', :sheet_id, 'move'],
227
- body_type: :json
228
- )
229
- request_spec = Smartsheet::API::RequestSpec.new(
230
- params: params,
231
- header_overrides: header_overrides,
232
- body: body,
233
- sheet_id: sheet_id
234
- )
235
- client.make_request(endpoint_spec, request_spec)
236
- end
237
-
238
- def update(sheet_id:, body:, params: {}, header_overrides: {})
239
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
240
- :put,
241
- ['sheets', :sheet_id],
242
- body_type: :json
243
- )
244
- request_spec = Smartsheet::API::RequestSpec.new(
245
- params: params,
246
- header_overrides: header_overrides,
247
- body: body,
248
- sheet_id: sheet_id
249
- )
250
- client.make_request(endpoint_spec, request_spec)
251
- end
252
-
253
- def delete(sheet_id:, params: {}, header_overrides: {})
254
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
255
- :delete,
256
- ['sheets', :sheet_id]
257
- )
258
- request_spec = Smartsheet::API::RequestSpec.new(
259
- params: params,
260
- header_overrides: header_overrides,
261
- sheet_id: sheet_id
262
- )
263
- client.make_request(endpoint_spec, request_spec)
264
- end
265
-
266
- def list_for_org(params: {}, header_overrides: {})
267
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['users', 'sheets'])
268
- request_spec = Smartsheet::API::RequestSpec.new(
269
- header_overrides: header_overrides,
270
- params: params
271
- )
272
- client.make_request(endpoint_spec, request_spec)
273
- end
274
-
275
- def get_publish_status(sheet_id:, params: {}, header_overrides: {})
276
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['sheets', :sheet_id, 'publish'])
277
- request_spec = Smartsheet::API::RequestSpec.new(
278
- params: params,
279
- header_overrides: header_overrides,
280
- sheet_id: sheet_id
281
- )
282
- client.make_request(endpoint_spec, request_spec)
283
- end
284
-
285
- def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
286
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], body_type: :json)
287
- request_spec = Smartsheet::API::RequestSpec.new(
288
- params: params,
289
- header_overrides: header_overrides,
290
- body: body,
291
- sheet_id: sheet_id
292
- )
293
- client.make_request(endpoint_spec, request_spec)
294
- end
295
-
296
- def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
297
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['sheets', :sheet_id, 'emails'], body_type: :json)
298
- request_spec = Smartsheet::API::RequestSpec.new(
299
- params: params,
300
- header_overrides: header_overrides,
301
- body: body,
302
- sheet_id: sheet_id
303
- )
304
- client.make_request(endpoint_spec, request_spec)
305
- end
306
-
307
- def list_image_urls(body:, params: {}, header_overrides: {})
308
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['imageurls'], body_type: :json)
309
- request_spec = Smartsheet::API::RequestSpec.new(
310
- params: params,
311
- header_overrides: header_overrides,
312
- body: body
313
- )
314
- client.make_request(endpoint_spec, request_spec)
315
- end
316
- end
317
- end
1
+ require 'smartsheet/api/endpoint_spec'
2
+ require 'smartsheet/api/request_spec'
3
+ require 'smartsheet/constants'
4
+
5
+ require 'smartsheet/endpoints/sheets/automation_rules'
6
+ require 'smartsheet/endpoints/sheets/cells'
7
+ require 'smartsheet/endpoints/sheets/columns'
8
+ require 'smartsheet/endpoints/sheets/comments'
9
+ require 'smartsheet/endpoints/sheets/cross_sheet_references'
10
+ require 'smartsheet/endpoints/sheets/discussions'
11
+ require 'smartsheet/endpoints/sheets/rows'
12
+ require 'smartsheet/endpoints/sheets/sheets_attachments'
13
+ require 'smartsheet/endpoints/sheets/sheets_share'
14
+
15
+ module Smartsheet
16
+ # Sheets Endpoints
17
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#sheets API Sheets Docs
18
+ #
19
+ # @!attribute [r] attachments
20
+ # @return [SheetsAttachments]
21
+ # @!attribute [r] automation_rules
22
+ # @return [AutomationRules]
23
+ # @!attribute [r] cells
24
+ # @return [Cells]
25
+ # @!attribute [r] columns
26
+ # @return [Columns]
27
+ # @!attribute [r] comments
28
+ # @return [Comments]
29
+ # @!attribute [r] cross_sheet_references
30
+ # @return [CrossSheetReferences]
31
+ # @!attribute [r] discussions
32
+ # @return [Discussions]
33
+ # @!attribute [r] rows
34
+ # @return [Rows]
35
+ # @!attribute [r] share
36
+ # @return [SheetsShare]
37
+ class Sheets
38
+ include Smartsheet::Constants
39
+
40
+ attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
41
+ :cross_sheet_references, :discussions, :rows, :share
42
+ private :client
43
+
44
+ def initialize(client)
45
+ @client = client
46
+
47
+ @attachments = SheetsAttachments.new(client)
48
+ @automation_rules = AutomationRules.new(client)
49
+ @cells = Cells.new(client)
50
+ @columns = Columns.new(client)
51
+ @comments = Comments.new(client)
52
+ @cross_sheet_references = CrossSheetReferences.new(client)
53
+ @discussions = Discussions.new(client)
54
+ @rows = Rows.new(client)
55
+ @share = SheetsShare.new(client)
56
+ end
57
+
58
+ def list(params: {}, header_overrides: {})
59
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets'])
60
+ request_spec = Smartsheet::API::RequestSpec.new(
61
+ params: params,
62
+ header_overrides: header_overrides
63
+ )
64
+ client.make_request(endpoint_spec, request_spec)
65
+ end
66
+
67
+ def get(sheet_id:, params: {}, header_overrides: {})
68
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id])
69
+ request_spec = Smartsheet::API::RequestSpec.new(
70
+ params: params,
71
+ header_overrides: header_overrides,
72
+ sheet_id: sheet_id
73
+ )
74
+ client.make_request(endpoint_spec, request_spec)
75
+ end
76
+
77
+ def get_version(sheet_id:, params: {}, header_overrides: {})
78
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'version'])
79
+ request_spec = Smartsheet::API::RequestSpec.new(
80
+ params: params,
81
+ header_overrides: header_overrides,
82
+ sheet_id: sheet_id
83
+ )
84
+ client.make_request(endpoint_spec, request_spec)
85
+ end
86
+
87
+ def get_as_excel(sheet_id:, params: {}, header_overrides: {})
88
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
89
+ :get,
90
+ ['sheets', :sheet_id],
91
+ headers: {Accept: EXCEL_TYPE}
92
+ )
93
+ request_spec = Smartsheet::API::RequestSpec.new(
94
+ params: params,
95
+ header_overrides: header_overrides,
96
+ sheet_id: sheet_id
97
+ )
98
+ client.make_request(endpoint_spec, request_spec)
99
+ end
100
+
101
+ def get_as_pdf(sheet_id:, params: {}, header_overrides: {})
102
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
103
+ :get,
104
+ ['sheets', :sheet_id],
105
+ headers: {Accept: PDF_TYPE}
106
+ )
107
+ request_spec = Smartsheet::API::RequestSpec.new(
108
+ params: params,
109
+ header_overrides: header_overrides,
110
+ sheet_id: sheet_id
111
+ )
112
+ client.make_request(endpoint_spec, request_spec)
113
+ end
114
+
115
+ def get_as_csv(sheet_id:, params: {}, header_overrides: {})
116
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
117
+ :get,
118
+ ['sheets', :sheet_id],
119
+ headers: {Accept: CSV_TYPE}
120
+ )
121
+ request_spec = Smartsheet::API::RequestSpec.new(
122
+ params: params,
123
+ header_overrides: header_overrides,
124
+ sheet_id: sheet_id
125
+ )
126
+ client.make_request(endpoint_spec, request_spec)
127
+ end
128
+
129
+ def create(body:, params: {}, header_overrides: {})
130
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
131
+ :post,
132
+ ['sheets'],
133
+ body_type: :json
134
+ )
135
+ request_spec = Smartsheet::API::RequestSpec.new(
136
+ params: params,
137
+ header_overrides: header_overrides,
138
+ body: body
139
+ )
140
+ client.make_request(endpoint_spec, request_spec)
141
+ end
142
+
143
+ def create_in_folder(folder_id:, body:, params: {}, header_overrides: {})
144
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
145
+ :post,
146
+ ['folders', :folder_id, 'sheets'],
147
+ body_type: :json
148
+ )
149
+ request_spec = Smartsheet::API::RequestSpec.new(
150
+ params: params,
151
+ header_overrides: header_overrides,
152
+ body: body,
153
+ folder_id: folder_id
154
+ )
155
+ client.make_request(endpoint_spec, request_spec)
156
+ end
157
+
158
+ def create_in_workspace(workspace_id:, body:, params: {}, header_overrides: {})
159
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
160
+ :post,
161
+ ['workspaces', :workspace_id, 'sheets'],
162
+ body_type: :json
163
+ )
164
+ request_spec = Smartsheet::API::RequestSpec.new(
165
+ params: params,
166
+ header_overrides: header_overrides,
167
+ body: body,
168
+ workspace_id: workspace_id
169
+ )
170
+ client.make_request(endpoint_spec, request_spec)
171
+ end
172
+
173
+ def create_from_template(body:, params: {}, header_overrides: {})
174
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
175
+ :post,
176
+ ['sheets'],
177
+ body_type: :json
178
+ )
179
+ request_spec = Smartsheet::API::RequestSpec.new(
180
+ params: params,
181
+ header_overrides: header_overrides,
182
+ body: body
183
+ )
184
+ client.make_request(endpoint_spec, request_spec)
185
+ end
186
+
187
+ def create_in_folder_from_template(folder_id:, body:, params: {}, header_overrides: {})
188
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
189
+ :post,
190
+ ['folders', :folder_id, 'sheets'],
191
+ body_type: :json
192
+ )
193
+ request_spec = Smartsheet::API::RequestSpec.new(
194
+ params: params,
195
+ header_overrides: header_overrides,
196
+ body: body,
197
+ folder_id: folder_id
198
+ )
199
+ client.make_request(endpoint_spec, request_spec)
200
+ end
201
+
202
+ def create_in_workspace_from_template(workspace_id:, body:, params: {}, header_overrides: {})
203
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
204
+ :post,
205
+ ['workspaces', :workspace_id, 'sheets'],
206
+ body_type: :json
207
+ )
208
+ request_spec = Smartsheet::API::RequestSpec.new(
209
+ params: params,
210
+ header_overrides: header_overrides,
211
+ body: body,
212
+ workspace_id: workspace_id
213
+ )
214
+ client.make_request(endpoint_spec, request_spec)
215
+ end
216
+
217
+ def copy(sheet_id:, body:, params: {}, header_overrides: {})
218
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
219
+ :post,
220
+ ['sheets', :sheet_id, 'copy'],
221
+ body_type: :json
222
+ )
223
+ request_spec = Smartsheet::API::RequestSpec.new(
224
+ params: params,
225
+ header_overrides: header_overrides,
226
+ body: body,
227
+ sheet_id: sheet_id
228
+ )
229
+ client.make_request(endpoint_spec, request_spec)
230
+ end
231
+
232
+ def move(sheet_id:, body:, params: {}, header_overrides: {})
233
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
234
+ :post,
235
+ ['sheets', :sheet_id, 'move'],
236
+ body_type: :json
237
+ )
238
+ request_spec = Smartsheet::API::RequestSpec.new(
239
+ params: params,
240
+ header_overrides: header_overrides,
241
+ body: body,
242
+ sheet_id: sheet_id
243
+ )
244
+ client.make_request(endpoint_spec, request_spec)
245
+ end
246
+
247
+ def update(sheet_id:, body:, params: {}, header_overrides: {})
248
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
249
+ :put,
250
+ ['sheets', :sheet_id],
251
+ body_type: :json
252
+ )
253
+ request_spec = Smartsheet::API::RequestSpec.new(
254
+ params: params,
255
+ header_overrides: header_overrides,
256
+ body: body,
257
+ sheet_id: sheet_id
258
+ )
259
+ client.make_request(endpoint_spec, request_spec)
260
+ end
261
+
262
+ def delete(sheet_id:, params: {}, header_overrides: {})
263
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
264
+ :delete,
265
+ ['sheets', :sheet_id]
266
+ )
267
+ request_spec = Smartsheet::API::RequestSpec.new(
268
+ params: params,
269
+ header_overrides: header_overrides,
270
+ sheet_id: sheet_id
271
+ )
272
+ client.make_request(endpoint_spec, request_spec)
273
+ end
274
+
275
+ def list_for_org(params: {}, header_overrides: {})
276
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['users', 'sheets'])
277
+ request_spec = Smartsheet::API::RequestSpec.new(
278
+ header_overrides: header_overrides,
279
+ params: params
280
+ )
281
+ client.make_request(endpoint_spec, request_spec)
282
+ end
283
+
284
+ def get_publish_status(sheet_id:, params: {}, header_overrides: {})
285
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['sheets', :sheet_id, 'publish'])
286
+ request_spec = Smartsheet::API::RequestSpec.new(
287
+ params: params,
288
+ header_overrides: header_overrides,
289
+ sheet_id: sheet_id
290
+ )
291
+ client.make_request(endpoint_spec, request_spec)
292
+ end
293
+
294
+ def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
295
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], body_type: :json)
296
+ request_spec = Smartsheet::API::RequestSpec.new(
297
+ params: params,
298
+ header_overrides: header_overrides,
299
+ body: body,
300
+ sheet_id: sheet_id
301
+ )
302
+ client.make_request(endpoint_spec, request_spec)
303
+ end
304
+
305
+ def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
306
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['sheets', :sheet_id, 'emails'], body_type: :json)
307
+ request_spec = Smartsheet::API::RequestSpec.new(
308
+ params: params,
309
+ header_overrides: header_overrides,
310
+ body: body,
311
+ sheet_id: sheet_id
312
+ )
313
+ client.make_request(endpoint_spec, request_spec)
314
+ end
315
+
316
+ def list_image_urls(body:, params: {}, header_overrides: {})
317
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['imageurls'], body_type: :json)
318
+ request_spec = Smartsheet::API::RequestSpec.new(
319
+ params: params,
320
+ header_overrides: header_overrides,
321
+ body: body
322
+ )
323
+ client.make_request(endpoint_spec, request_spec)
324
+ end
325
+ end
326
+ end