smartsheet 2.77.0 → 2.101.1

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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -12
  3. data/.rubocop.yml +4 -4
  4. data/.travis.yml +29 -15
  5. data/.yardopts +3 -3
  6. data/ADVANCED.md +78 -78
  7. data/CHANGELOG.md +133 -112
  8. data/Gemfile +6 -6
  9. data/LICENSE +202 -202
  10. data/README.md +248 -246
  11. data/Rakefile +29 -29
  12. data/bin/console +14 -14
  13. data/bin/setup +8 -8
  14. data/lib/smartsheet.rb +2 -2
  15. data/lib/smartsheet/api/body_builder.rb +25 -25
  16. data/lib/smartsheet/api/endpoint_spec.rb +54 -54
  17. data/lib/smartsheet/api/faraday_adapter/faraday_net_client.rb +45 -45
  18. data/lib/smartsheet/api/faraday_adapter/faraday_response.rb +70 -70
  19. data/lib/smartsheet/api/faraday_adapter/middleware/faraday_error_translator.rb +20 -20
  20. data/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb +25 -25
  21. data/lib/smartsheet/api/file_spec.rb +55 -55
  22. data/lib/smartsheet/api/header_builder.rb +96 -96
  23. data/lib/smartsheet/api/request.rb +42 -42
  24. data/lib/smartsheet/api/request_client.rb +43 -43
  25. data/lib/smartsheet/api/request_logger.rb +182 -182
  26. data/lib/smartsheet/api/request_spec.rb +57 -57
  27. data/lib/smartsheet/api/response_net_client_decorator.rb +54 -54
  28. data/lib/smartsheet/api/retry_logic.rb +40 -40
  29. data/lib/smartsheet/api/retry_net_client_decorator.rb +37 -37
  30. data/lib/smartsheet/api/url_builder.rb +25 -25
  31. data/lib/smartsheet/client.rb +193 -193
  32. data/lib/smartsheet/constants.rb +18 -18
  33. data/lib/smartsheet/endpoints/contacts/contacts.rb +30 -30
  34. data/lib/smartsheet/endpoints/events/events.rb +20 -20
  35. data/lib/smartsheet/endpoints/favorites/favorites.rb +159 -159
  36. data/lib/smartsheet/endpoints/folders/folders.rb +125 -125
  37. data/lib/smartsheet/endpoints/groups/groups.rb +83 -83
  38. data/lib/smartsheet/endpoints/home/home.rb +20 -20
  39. data/lib/smartsheet/endpoints/reports/reports.rb +100 -100
  40. data/lib/smartsheet/endpoints/reports/reports_share.rb +69 -69
  41. data/lib/smartsheet/endpoints/search/search.rb +30 -30
  42. data/lib/smartsheet/endpoints/server_info/server_info.rb +21 -21
  43. data/lib/smartsheet/endpoints/share/share.rb +58 -58
  44. data/lib/smartsheet/endpoints/sheets/automation_rules.rb +55 -55
  45. data/lib/smartsheet/endpoints/sheets/cells.rb +82 -82
  46. data/lib/smartsheet/endpoints/sheets/columns.rb +66 -66
  47. data/lib/smartsheet/endpoints/sheets/comments.rb +64 -64
  48. data/lib/smartsheet/endpoints/sheets/comments_attachments.rb +78 -78
  49. data/lib/smartsheet/endpoints/sheets/cross_sheet_references.rb +45 -45
  50. data/lib/smartsheet/endpoints/sheets/discussions.rb +84 -84
  51. data/lib/smartsheet/endpoints/sheets/discussions_attachments.rb +22 -22
  52. data/lib/smartsheet/endpoints/sheets/rows.rb +106 -106
  53. data/lib/smartsheet/endpoints/sheets/rows_attachments.rb +92 -92
  54. data/lib/smartsheet/endpoints/sheets/sheets.rb +514 -510
  55. data/lib/smartsheet/endpoints/sheets/sheets_attachments.rb +174 -174
  56. data/lib/smartsheet/endpoints/sheets/sheets_share.rb +69 -69
  57. data/lib/smartsheet/endpoints/sheets/sheets_summaries.rb +123 -0
  58. data/lib/smartsheet/endpoints/sights/sights.rb +101 -101
  59. data/lib/smartsheet/endpoints/sights/sights_share.rb +69 -69
  60. data/lib/smartsheet/endpoints/templates/templates.rb +29 -29
  61. data/lib/smartsheet/endpoints/token/token.rb +70 -66
  62. data/lib/smartsheet/endpoints/update_requests/sent_update_requests.rb +44 -44
  63. data/lib/smartsheet/endpoints/update_requests/update_requests.rb +74 -74
  64. data/lib/smartsheet/endpoints/users/alternate_emails.rb +79 -79
  65. data/lib/smartsheet/endpoints/users/users.rb +123 -77
  66. data/lib/smartsheet/endpoints/webhooks/webhooks.rb +71 -71
  67. data/lib/smartsheet/endpoints/workspaces/workspaces.rb +87 -87
  68. data/lib/smartsheet/endpoints/workspaces/workspaces_share.rb +70 -70
  69. data/lib/smartsheet/error.rb +69 -69
  70. data/lib/smartsheet/general_request.rb +74 -74
  71. data/lib/smartsheet/version.rb +5 -5
  72. data/smartsheet.gemspec +54 -54
  73. metadata +24 -12
@@ -1,56 +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
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
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: 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
+ 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
@@ -1,65 +1,65 @@
1
- require 'smartsheet/endpoints/sheets/comments_attachments'
2
-
3
- module Smartsheet
4
- # Comments Endpoints
5
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#comments API Comments Docs
6
- #
7
- # @!attribute [r] attachments
8
- # @return [CommentsAttachments]
9
- class Comments
10
- attr_reader :client, :attachments
11
- private :client
12
-
13
- def initialize(client)
14
- @client = client
15
-
16
- @attachments = CommentsAttachments.new(client)
17
- end
18
-
19
- def add(sheet_id:, discussion_id:, body:, params: {}, header_overrides: {})
20
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'discussions', :discussion_id, 'comments'], 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
- discussion_id: discussion_id
27
- )
28
- client.make_request(endpoint_spec, request_spec)
29
- end
30
-
31
- def update(sheet_id:, comment_id:, body:, params: {}, header_overrides: {})
32
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'comments', :comment_id], body_type: :json)
33
- request_spec = Smartsheet::API::RequestSpec.new(
34
- header_overrides: header_overrides,
35
- params: params,
36
- body: body,
37
- sheet_id: sheet_id,
38
- comment_id: comment_id
39
- )
40
- client.make_request(endpoint_spec, request_spec)
41
- end
42
-
43
- def delete(sheet_id:, comment_id:, params: {}, header_overrides: {})
44
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'comments', :comment_id])
45
- request_spec = Smartsheet::API::RequestSpec.new(
46
- params: params,
47
- header_overrides: header_overrides,
48
- sheet_id: sheet_id,
49
- comment_id: comment_id
50
- )
51
- client.make_request(endpoint_spec, request_spec)
52
- end
53
-
54
- def get(sheet_id:, comment_id:, params: {}, header_overrides: {})
55
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'comments', :comment_id])
56
- request_spec = Smartsheet::API::RequestSpec.new(
57
- params: params,
58
- header_overrides: header_overrides,
59
- sheet_id: sheet_id,
60
- comment_id: comment_id
61
- )
62
- client.make_request(endpoint_spec, request_spec)
63
- end
64
- end
1
+ require 'smartsheet/endpoints/sheets/comments_attachments'
2
+
3
+ module Smartsheet
4
+ # Comments Endpoints
5
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#comments API Comments Docs
6
+ #
7
+ # @!attribute [r] attachments
8
+ # @return [CommentsAttachments]
9
+ class Comments
10
+ attr_reader :client, :attachments
11
+ private :client
12
+
13
+ def initialize(client)
14
+ @client = client
15
+
16
+ @attachments = CommentsAttachments.new(client)
17
+ end
18
+
19
+ def add(sheet_id:, discussion_id:, body:, params: {}, header_overrides: {})
20
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'discussions', :discussion_id, 'comments'], 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
+ discussion_id: discussion_id
27
+ )
28
+ client.make_request(endpoint_spec, request_spec)
29
+ end
30
+
31
+ def update(sheet_id:, comment_id:, body:, params: {}, header_overrides: {})
32
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'comments', :comment_id], body_type: :json)
33
+ request_spec = Smartsheet::API::RequestSpec.new(
34
+ header_overrides: header_overrides,
35
+ params: params,
36
+ body: body,
37
+ sheet_id: sheet_id,
38
+ comment_id: comment_id
39
+ )
40
+ client.make_request(endpoint_spec, request_spec)
41
+ end
42
+
43
+ def delete(sheet_id:, comment_id:, params: {}, header_overrides: {})
44
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'comments', :comment_id])
45
+ request_spec = Smartsheet::API::RequestSpec.new(
46
+ params: params,
47
+ header_overrides: header_overrides,
48
+ sheet_id: sheet_id,
49
+ comment_id: comment_id
50
+ )
51
+ client.make_request(endpoint_spec, request_spec)
52
+ end
53
+
54
+ def get(sheet_id:, comment_id:, params: {}, header_overrides: {})
55
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'comments', :comment_id])
56
+ request_spec = Smartsheet::API::RequestSpec.new(
57
+ params: params,
58
+ header_overrides: header_overrides,
59
+ sheet_id: sheet_id,
60
+ comment_id: comment_id
61
+ )
62
+ client.make_request(endpoint_spec, request_spec)
63
+ end
64
+ end
65
65
  end