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,30 +1,30 @@
1
- module Smartsheet
2
- # Templates Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#templates API Templates Docs
4
- class Templates
5
- attr_reader :client
6
- private :client
7
-
8
- def initialize(client)
9
- @client = client
10
- end
11
-
12
- def list_public(params: {}, header_overrides: {})
13
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['templates', 'public'])
14
- request_spec = Smartsheet::API::RequestSpec.new(
15
- header_overrides: header_overrides,
16
- params: params
17
- )
18
- client.make_request(endpoint_spec, request_spec)
19
- end
20
-
21
- def list(params: {}, header_overrides: {})
22
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['templates'])
23
- request_spec = Smartsheet::API::RequestSpec.new(
24
- header_overrides: header_overrides,
25
- params: params
26
- )
27
- client.make_request(endpoint_spec, request_spec)
28
- end
29
- end
1
+ module Smartsheet
2
+ # Templates Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#templates API Templates Docs
4
+ class Templates
5
+ attr_reader :client
6
+ private :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def list_public(params: {}, header_overrides: {})
13
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['templates', 'public'])
14
+ request_spec = Smartsheet::API::RequestSpec.new(
15
+ header_overrides: header_overrides,
16
+ params: params
17
+ )
18
+ client.make_request(endpoint_spec, request_spec)
19
+ end
20
+
21
+ def list(params: {}, header_overrides: {})
22
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['templates'])
23
+ request_spec = Smartsheet::API::RequestSpec.new(
24
+ header_overrides: header_overrides,
25
+ params: params
26
+ )
27
+ client.make_request(endpoint_spec, request_spec)
28
+ end
29
+ end
30
30
  end
@@ -1,66 +1,70 @@
1
- require 'digest'
2
-
3
- module Smartsheet
4
- # Token Endpoints
5
- #
6
- # {#get} and {#refresh} do not require an existing token to call
7
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#token API Token Docs
8
- class Token
9
- attr_reader :client
10
- private :client
11
-
12
- def initialize(client)
13
- @client = client
14
- end
15
-
16
- def build_authorization_url(client_id:, scopes:)
17
- scopes_string = scopes.join('%20')
18
- "https://app.smartsheet.com/b/authorize?response_type=code&client_id=#{client_id}&scope=#{scopes_string}"
19
- end
20
-
21
- def get(client_id:, hash:, code:, params: {}, header_overrides: {})
22
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
23
- :post,
24
- ['token'],
25
- no_auth: true
26
- )
27
- request_spec = Smartsheet::API::RequestSpec.new(
28
- header_overrides: header_overrides,
29
- params: params.merge({
30
- client_id: client_id,
31
- code: code,
32
- hash: hash,
33
- grant_type: 'authorization_code'
34
- })
35
- )
36
- client.make_request(endpoint_spec, request_spec)
37
- end
38
-
39
- def refresh(client_id:, hash:, refresh_token:, params: {}, header_overrides: {})
40
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
41
- :post,
42
- ['token'],
43
- no_auth: true
44
- )
45
- request_spec = Smartsheet::API::RequestSpec.new(
46
- header_overrides: header_overrides,
47
- params: params.merge({
48
- client_id: client_id,
49
- refresh_token: refresh_token,
50
- hash: hash,
51
- grant_type: 'refresh_token'
52
- })
53
- )
54
- client.make_request(endpoint_spec, request_spec)
55
- end
56
-
57
- def revoke(params: {}, header_overrides: {})
58
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['token'])
59
- request_spec = Smartsheet::API::RequestSpec.new(
60
- header_overrides: header_overrides,
61
- params: params
62
- )
63
- client.make_request(endpoint_spec, request_spec)
64
- end
65
- end
66
- end
1
+ require 'digest'
2
+
3
+ module Smartsheet
4
+ # Token Endpoints
5
+ #
6
+ # {#get} and {#refresh} do not require an existing token to call
7
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#token API Token Docs
8
+ class Token
9
+ attr_reader :client
10
+ private :client
11
+
12
+ def initialize(client)
13
+ @client = client
14
+ end
15
+
16
+ def build_authorization_url(client_id:, scopes:, state: nil)
17
+ scopes_string = scopes.join('%20')
18
+ url = "https://app.smartsheet.com/b/authorize?response_type=code&client_id=#{client_id}&scope=#{scopes_string}"
19
+ if state.present?
20
+ return "#{url}&state=#{state}"
21
+ end
22
+ return url
23
+ end
24
+
25
+ def get(client_id:, hash:, code:, params: {}, header_overrides: {})
26
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
27
+ :post,
28
+ ['token'],
29
+ no_auth: true
30
+ )
31
+ request_spec = Smartsheet::API::RequestSpec.new(
32
+ header_overrides: header_overrides,
33
+ params: params.merge({
34
+ client_id: client_id,
35
+ code: code,
36
+ hash: hash,
37
+ grant_type: 'authorization_code'
38
+ })
39
+ )
40
+ client.make_request(endpoint_spec, request_spec)
41
+ end
42
+
43
+ def refresh(client_id:, hash:, refresh_token:, params: {}, header_overrides: {})
44
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
45
+ :post,
46
+ ['token'],
47
+ no_auth: true
48
+ )
49
+ request_spec = Smartsheet::API::RequestSpec.new(
50
+ header_overrides: header_overrides,
51
+ params: params.merge({
52
+ client_id: client_id,
53
+ refresh_token: refresh_token,
54
+ hash: hash,
55
+ grant_type: 'refresh_token'
56
+ })
57
+ )
58
+ client.make_request(endpoint_spec, request_spec)
59
+ end
60
+
61
+ def revoke(params: {}, header_overrides: {})
62
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['token'])
63
+ request_spec = Smartsheet::API::RequestSpec.new(
64
+ header_overrides: header_overrides,
65
+ params: params
66
+ )
67
+ client.make_request(endpoint_spec, request_spec)
68
+ end
69
+ end
70
+ end
@@ -1,45 +1,45 @@
1
- module Smartsheet
2
- # Sent Update Requests Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#update-requests API Update Requests
4
- # Docs
5
- class SentUpdateRequests
6
- attr_reader :client
7
- private :client
8
-
9
- def initialize(client)
10
- @client = client
11
- end
12
-
13
- def delete(sheet_id:, sent_update_request_id:, params: {}, header_overrides: {})
14
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'sentupdaterequests', :sent_update_request_id])
15
- request_spec = Smartsheet::API::RequestSpec.new(
16
- params: params,
17
- header_overrides: header_overrides,
18
- sheet_id: sheet_id,
19
- sent_update_request_id: sent_update_request_id
20
- )
21
- client.make_request(endpoint_spec, request_spec)
22
- end
23
-
24
- def get(sheet_id:, sent_update_request_id:, params: {}, header_overrides: {})
25
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'sentupdaterequests', :sent_update_request_id])
26
- request_spec = Smartsheet::API::RequestSpec.new(
27
- params: params,
28
- header_overrides: header_overrides,
29
- sheet_id: sheet_id,
30
- sent_update_request_id: sent_update_request_id
31
- )
32
- client.make_request(endpoint_spec, request_spec)
33
- end
34
-
35
- def list(sheet_id:, params: {}, header_overrides: {})
36
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'sentupdaterequests'])
37
- request_spec = Smartsheet::API::RequestSpec.new(
38
- header_overrides: header_overrides,
39
- params: params,
40
- sheet_id: sheet_id
41
- )
42
- client.make_request(endpoint_spec, request_spec)
43
- end
44
- end
1
+ module Smartsheet
2
+ # Sent Update Requests Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#update-requests API Update Requests
4
+ # Docs
5
+ class SentUpdateRequests
6
+ attr_reader :client
7
+ private :client
8
+
9
+ def initialize(client)
10
+ @client = client
11
+ end
12
+
13
+ def delete(sheet_id:, sent_update_request_id:, params: {}, header_overrides: {})
14
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'sentupdaterequests', :sent_update_request_id])
15
+ request_spec = Smartsheet::API::RequestSpec.new(
16
+ params: params,
17
+ header_overrides: header_overrides,
18
+ sheet_id: sheet_id,
19
+ sent_update_request_id: sent_update_request_id
20
+ )
21
+ client.make_request(endpoint_spec, request_spec)
22
+ end
23
+
24
+ def get(sheet_id:, sent_update_request_id:, params: {}, header_overrides: {})
25
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'sentupdaterequests', :sent_update_request_id])
26
+ request_spec = Smartsheet::API::RequestSpec.new(
27
+ params: params,
28
+ header_overrides: header_overrides,
29
+ sheet_id: sheet_id,
30
+ sent_update_request_id: sent_update_request_id
31
+ )
32
+ client.make_request(endpoint_spec, request_spec)
33
+ end
34
+
35
+ def list(sheet_id:, params: {}, header_overrides: {})
36
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'sentupdaterequests'])
37
+ request_spec = Smartsheet::API::RequestSpec.new(
38
+ header_overrides: header_overrides,
39
+ params: params,
40
+ sheet_id: sheet_id
41
+ )
42
+ client.make_request(endpoint_spec, request_spec)
43
+ end
44
+ end
45
45
  end
@@ -1,75 +1,75 @@
1
- require 'smartsheet/endpoints/update_requests/sent_update_requests'
2
-
3
- module Smartsheet
4
- # Update Requests Endpoints
5
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#update-requests API Update Requests
6
- # Docs
7
- #
8
- # @!attribute [r] sent
9
- # @return [SentUpdateRequests]
10
- class UpdateRequests
11
- attr_reader :client, :sent
12
- private :client
13
-
14
- def initialize(client)
15
- @client = client
16
-
17
- @sent = SentUpdateRequests.new(client)
18
- end
19
-
20
- def create(sheet_id:, body:, params: {}, header_overrides: {})
21
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'updaterequests'], body_type: :json)
22
- request_spec = Smartsheet::API::RequestSpec.new(
23
- params: params,
24
- header_overrides: header_overrides,
25
- body: body,
26
- sheet_id: sheet_id
27
- )
28
- client.make_request(endpoint_spec, request_spec)
29
- end
30
-
31
- def delete(sheet_id:, update_request_id:, params: {}, header_overrides: {})
32
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'updaterequests', :update_request_id])
33
- request_spec = Smartsheet::API::RequestSpec.new(
34
- params: params,
35
- header_overrides: header_overrides,
36
- sheet_id: sheet_id,
37
- update_request_id: update_request_id
38
- )
39
- client.make_request(endpoint_spec, request_spec)
40
- end
41
-
42
- def get(sheet_id:, update_request_id:, params: {}, header_overrides: {})
43
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'updaterequests', :update_request_id])
44
- request_spec = Smartsheet::API::RequestSpec.new(
45
- params: params,
46
- header_overrides: header_overrides,
47
- sheet_id: sheet_id,
48
- update_request_id: update_request_id
49
- )
50
- client.make_request(endpoint_spec, request_spec)
51
- end
52
-
53
- def list(sheet_id:, params: {}, header_overrides: {})
54
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'updaterequests'])
55
- request_spec = Smartsheet::API::RequestSpec.new(
56
- header_overrides: header_overrides,
57
- params: params,
58
- sheet_id: sheet_id
59
- )
60
- client.make_request(endpoint_spec, request_spec)
61
- end
62
-
63
- def update(sheet_id:, update_request_id:, body:, params: {}, header_overrides: {})
64
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'updaterequests', :update_request_id], body_type: :json)
65
- request_spec = Smartsheet::API::RequestSpec.new(
66
- params: params,
67
- header_overrides: header_overrides,
68
- body: body,
69
- sheet_id: sheet_id,
70
- update_request_id: update_request_id
71
- )
72
- client.make_request(endpoint_spec, request_spec)
73
- end
74
- end
1
+ require 'smartsheet/endpoints/update_requests/sent_update_requests'
2
+
3
+ module Smartsheet
4
+ # Update Requests Endpoints
5
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#update-requests API Update Requests
6
+ # Docs
7
+ #
8
+ # @!attribute [r] sent
9
+ # @return [SentUpdateRequests]
10
+ class UpdateRequests
11
+ attr_reader :client, :sent
12
+ private :client
13
+
14
+ def initialize(client)
15
+ @client = client
16
+
17
+ @sent = SentUpdateRequests.new(client)
18
+ end
19
+
20
+ def create(sheet_id:, body:, params: {}, header_overrides: {})
21
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'updaterequests'], body_type: :json)
22
+ request_spec = Smartsheet::API::RequestSpec.new(
23
+ params: params,
24
+ header_overrides: header_overrides,
25
+ body: body,
26
+ sheet_id: sheet_id
27
+ )
28
+ client.make_request(endpoint_spec, request_spec)
29
+ end
30
+
31
+ def delete(sheet_id:, update_request_id:, params: {}, header_overrides: {})
32
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'updaterequests', :update_request_id])
33
+ request_spec = Smartsheet::API::RequestSpec.new(
34
+ params: params,
35
+ header_overrides: header_overrides,
36
+ sheet_id: sheet_id,
37
+ update_request_id: update_request_id
38
+ )
39
+ client.make_request(endpoint_spec, request_spec)
40
+ end
41
+
42
+ def get(sheet_id:, update_request_id:, params: {}, header_overrides: {})
43
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'updaterequests', :update_request_id])
44
+ request_spec = Smartsheet::API::RequestSpec.new(
45
+ params: params,
46
+ header_overrides: header_overrides,
47
+ sheet_id: sheet_id,
48
+ update_request_id: update_request_id
49
+ )
50
+ client.make_request(endpoint_spec, request_spec)
51
+ end
52
+
53
+ def list(sheet_id:, params: {}, header_overrides: {})
54
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'updaterequests'])
55
+ request_spec = Smartsheet::API::RequestSpec.new(
56
+ header_overrides: header_overrides,
57
+ params: params,
58
+ sheet_id: sheet_id
59
+ )
60
+ client.make_request(endpoint_spec, request_spec)
61
+ end
62
+
63
+ def update(sheet_id:, update_request_id:, body:, params: {}, header_overrides: {})
64
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'updaterequests', :update_request_id], body_type: :json)
65
+ request_spec = Smartsheet::API::RequestSpec.new(
66
+ params: params,
67
+ header_overrides: header_overrides,
68
+ body: body,
69
+ sheet_id: sheet_id,
70
+ update_request_id: update_request_id
71
+ )
72
+ client.make_request(endpoint_spec, request_spec)
73
+ end
74
+ end
75
75
  end
@@ -1,80 +1,80 @@
1
- module Smartsheet
2
- # Alternate Emails Endpoints
3
- # @see https://smartsheet-platform.github.io/api-docs/?ruby#alternate-email-addresses API
4
- # Alternate Email Addresses Docs
5
- class AlternateEmails
6
- attr_reader :client
7
- private :client
8
-
9
- def initialize(client)
10
- @client = client
11
- end
12
-
13
- def add(user_id:, body:, params: {}, header_overrides: {})
14
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
15
- :post,
16
- ['users', :user_id, 'alternateemails'],
17
- body_type: :json
18
- )
19
- request_spec = Smartsheet::API::RequestSpec.new(
20
- params: params,
21
- header_overrides: header_overrides,
22
- body: body,
23
- user_id: user_id
24
- )
25
- client.make_request(endpoint_spec, request_spec)
26
- end
27
-
28
- def make_primary(user_id:, alternate_email_id:, params: {}, header_overrides: {})
29
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
30
- :post,
31
- ['users', :user_id, 'alternateemails', :alternate_email_id, 'makeprimary']
32
- )
33
- request_spec = Smartsheet::API::RequestSpec.new(
34
- params: params,
35
- header_overrides: header_overrides,
36
- alternate_email_id: alternate_email_id,
37
- user_id: user_id
38
- )
39
- client.make_request(endpoint_spec, request_spec)
40
- end
41
-
42
- def delete(user_id:, alternate_email_id:, params: {}, header_overrides: {})
43
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
44
- :delete,
45
- ['users', :user_id, 'alternateemails', :alternate_email_id]
46
- )
47
- request_spec = Smartsheet::API::RequestSpec.new(
48
- params: params,
49
- header_overrides: header_overrides,
50
- alternate_email_id: alternate_email_id,
51
- user_id: user_id
52
- )
53
- client.make_request(endpoint_spec, request_spec)
54
- end
55
-
56
- def get(user_id:, alternate_email_id:, params: {}, header_overrides: {})
57
- endpoint_spec = Smartsheet::API::EndpointSpec.new(
58
- :get,
59
- ['users', :user_id, 'alternateemails', :alternate_email_id]
60
- )
61
- request_spec = Smartsheet::API::RequestSpec.new(
62
- params: params,
63
- header_overrides: header_overrides,
64
- alternate_email_id: alternate_email_id,
65
- user_id: user_id
66
- )
67
- client.make_request(endpoint_spec, request_spec)
68
- end
69
-
70
- def list(user_id:, params: {}, header_overrides: {})
71
- endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users', :user_id, 'alternateemails'])
72
- request_spec = Smartsheet::API::RequestSpec.new(
73
- params: params,
74
- header_overrides: header_overrides,
75
- user_id: user_id
76
- )
77
- client.make_request(endpoint_spec, request_spec)
78
- end
79
- end
1
+ module Smartsheet
2
+ # Alternate Emails Endpoints
3
+ # @see https://smartsheet-platform.github.io/api-docs/?ruby#alternate-email-addresses API
4
+ # Alternate Email Addresses Docs
5
+ class AlternateEmails
6
+ attr_reader :client
7
+ private :client
8
+
9
+ def initialize(client)
10
+ @client = client
11
+ end
12
+
13
+ def add(user_id:, body:, params: {}, header_overrides: {})
14
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
15
+ :post,
16
+ ['users', :user_id, 'alternateemails'],
17
+ body_type: :json
18
+ )
19
+ request_spec = Smartsheet::API::RequestSpec.new(
20
+ params: params,
21
+ header_overrides: header_overrides,
22
+ body: body,
23
+ user_id: user_id
24
+ )
25
+ client.make_request(endpoint_spec, request_spec)
26
+ end
27
+
28
+ def make_primary(user_id:, alternate_email_id:, params: {}, header_overrides: {})
29
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
30
+ :post,
31
+ ['users', :user_id, 'alternateemails', :alternate_email_id, 'makeprimary']
32
+ )
33
+ request_spec = Smartsheet::API::RequestSpec.new(
34
+ params: params,
35
+ header_overrides: header_overrides,
36
+ alternate_email_id: alternate_email_id,
37
+ user_id: user_id
38
+ )
39
+ client.make_request(endpoint_spec, request_spec)
40
+ end
41
+
42
+ def delete(user_id:, alternate_email_id:, params: {}, header_overrides: {})
43
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
44
+ :delete,
45
+ ['users', :user_id, 'alternateemails', :alternate_email_id]
46
+ )
47
+ request_spec = Smartsheet::API::RequestSpec.new(
48
+ params: params,
49
+ header_overrides: header_overrides,
50
+ alternate_email_id: alternate_email_id,
51
+ user_id: user_id
52
+ )
53
+ client.make_request(endpoint_spec, request_spec)
54
+ end
55
+
56
+ def get(user_id:, alternate_email_id:, params: {}, header_overrides: {})
57
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(
58
+ :get,
59
+ ['users', :user_id, 'alternateemails', :alternate_email_id]
60
+ )
61
+ request_spec = Smartsheet::API::RequestSpec.new(
62
+ params: params,
63
+ header_overrides: header_overrides,
64
+ alternate_email_id: alternate_email_id,
65
+ user_id: user_id
66
+ )
67
+ client.make_request(endpoint_spec, request_spec)
68
+ end
69
+
70
+ def list(user_id:, params: {}, header_overrides: {})
71
+ endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users', :user_id, 'alternateemails'])
72
+ request_spec = Smartsheet::API::RequestSpec.new(
73
+ params: params,
74
+ header_overrides: header_overrides,
75
+ user_id: user_id
76
+ )
77
+ client.make_request(endpoint_spec, request_spec)
78
+ end
79
+ end
80
80
  end