twilio-ruby 5.12.4 → 5.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +28 -13
  5. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +14 -6
  6. data/lib/twilio-ruby/rest/client.rb +7 -0
  7. data/lib/twilio-ruby/rest/preview.rb +28 -8
  8. data/lib/twilio-ruby/rest/preview/authy.rb +43 -0
  9. data/lib/twilio-ruby/rest/preview/authy/service.rb +364 -0
  10. data/lib/twilio-ruby/rest/preview/authy/service/entity.rb +326 -0
  11. data/lib/twilio-ruby/rest/preview/permissions.rb +35 -0
  12. data/lib/twilio-ruby/rest/preview/permissions/voice_permission.rb +131 -0
  13. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/bulk_country_update.rb +132 -0
  14. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/country.rb +391 -0
  15. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/country/highrisk_special_prefix.rb +192 -0
  16. data/lib/twilio-ruby/rest/preview/permissions/voice_permission/settings.rb +197 -0
  17. data/lib/twilio-ruby/rest/preview/understand/assistant.rb +12 -6
  18. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb +13 -11
  19. data/lib/twilio-ruby/rest/pricing/v2/voice.rb +17 -0
  20. data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +214 -0
  21. data/lib/twilio-ruby/rest/verify.rb +46 -0
  22. data/lib/twilio-ruby/rest/verify/v1.rb +43 -0
  23. data/lib/twilio-ruby/rest/verify/v1/service.rb +391 -0
  24. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +185 -0
  25. data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +182 -0
  26. data/lib/twilio-ruby/version.rb +1 -1
  27. data/spec/integration/preview/authy/service/entity_spec.rb +173 -0
  28. data/spec/integration/preview/authy/service_spec.rb +201 -0
  29. data/spec/integration/preview/permissions/voice_permission/bulk_country_update_spec.rb +45 -0
  30. data/spec/integration/preview/permissions/voice_permission/country/highrisk_special_prefix_spec.rb +61 -0
  31. data/spec/integration/preview/permissions/voice_permission/country_spec.rb +112 -0
  32. data/spec/integration/preview/permissions/voice_permission/settings_spec.rb +77 -0
  33. data/spec/integration/preview/permissions/voice_permission_spec.rb +12 -0
  34. data/spec/integration/pricing/v2/voice/number_spec.rb +62 -0
  35. data/spec/integration/verify/v1/service/verification_check_spec.rb +52 -0
  36. data/spec/integration/verify/v1/service/verification_spec.rb +52 -0
  37. data/spec/integration/verify/v1/service_spec.rb +185 -0
  38. metadata +39 -2
@@ -0,0 +1,192 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Preview < Domain
12
+ class Permissions < Version
13
+ class VoicePermissionList < ListResource
14
+ class CountryContext < InstanceContext
15
+ ##
16
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
17
+ class HighriskSpecialPrefixList < ListResource
18
+ ##
19
+ # Initialize the HighriskSpecialPrefixList
20
+ # @param [Version] version Version that contains the resource
21
+ # @param [String] parent_iso_code The [ISO country
22
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
23
+ # @return [HighriskSpecialPrefixList] HighriskSpecialPrefixList
24
+ def initialize(version, parent_iso_code: nil)
25
+ super(version)
26
+
27
+ # Path Solution
28
+ @solution = {parent_iso_code: parent_iso_code}
29
+ @uri = "/VoicePermissions/Countries/#{@solution[:parent_iso_code]}/HighRiskSpecialPrefixes"
30
+ end
31
+
32
+ ##
33
+ # Lists HighriskSpecialPrefixInstance records from the API as a list.
34
+ # Unlike stream(), this operation is eager and will load `limit` records into
35
+ # memory before returning.
36
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
37
+ # guarantees to never return more than limit. Default is no limit
38
+ # @param [Integer] page_size Number of records to fetch per request, when
39
+ # not set will use the default value of 50 records. If no page_size is defined
40
+ # but a limit is defined, stream() will attempt to read the limit with the most
41
+ # efficient page size, i.e. min(limit, 1000)
42
+ # @return [Array] Array of up to limit results
43
+ def list(limit: nil, page_size: nil)
44
+ self.stream(limit: limit, page_size: page_size).entries
45
+ end
46
+
47
+ ##
48
+ # Streams HighriskSpecialPrefixInstance records from the API as an Enumerable.
49
+ # This operation lazily loads records as efficiently as possible until the limit
50
+ # is reached.
51
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
52
+ # guarantees to never return more than limit. Default is no limit.
53
+ # @param [Integer] page_size Number of records to fetch per request, when
54
+ # not set will use the default value of 50 records. If no page_size is defined
55
+ # but a limit is defined, stream() will attempt to read the limit with the most
56
+ # efficient page size, i.e. min(limit, 1000)
57
+ # @return [Enumerable] Enumerable that will yield up to limit results
58
+ def stream(limit: nil, page_size: nil)
59
+ limits = @version.read_limits(limit, page_size)
60
+
61
+ page = self.page(page_size: limits[:page_size], )
62
+
63
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
64
+ end
65
+
66
+ ##
67
+ # When passed a block, yields HighriskSpecialPrefixInstance records from the API.
68
+ # This operation lazily loads records as efficiently as possible until the limit
69
+ # is reached.
70
+ def each
71
+ limits = @version.read_limits
72
+
73
+ page = self.page(page_size: limits[:page_size], )
74
+
75
+ @version.stream(page,
76
+ limit: limits[:limit],
77
+ page_limit: limits[:page_limit]).each {|x| yield x}
78
+ end
79
+
80
+ ##
81
+ # Retrieve a single page of HighriskSpecialPrefixInstance records from the API.
82
+ # Request is executed immediately.
83
+ # @param [String] page_token PageToken provided by the API
84
+ # @param [Integer] page_number Page Number, this value is simply for client state
85
+ # @param [Integer] page_size Number of records to return, defaults to 50
86
+ # @return [Page] Page of HighriskSpecialPrefixInstance
87
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
88
+ params = Twilio::Values.of({
89
+ 'PageToken' => page_token,
90
+ 'Page' => page_number,
91
+ 'PageSize' => page_size,
92
+ })
93
+ response = @version.page(
94
+ 'GET',
95
+ @uri,
96
+ params
97
+ )
98
+ HighriskSpecialPrefixPage.new(@version, response, @solution)
99
+ end
100
+
101
+ ##
102
+ # Retrieve a single page of HighriskSpecialPrefixInstance records from the API.
103
+ # Request is executed immediately.
104
+ # @param [String] target_url API-generated URL for the requested results page
105
+ # @return [Page] Page of HighriskSpecialPrefixInstance
106
+ def get_page(target_url)
107
+ response = @version.domain.request(
108
+ 'GET',
109
+ target_url
110
+ )
111
+ HighriskSpecialPrefixPage.new(@version, response, @solution)
112
+ end
113
+
114
+ ##
115
+ # Provide a user friendly representation
116
+ def to_s
117
+ '#<Twilio.Preview.Permissions.HighriskSpecialPrefixList>'
118
+ end
119
+ end
120
+
121
+ ##
122
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
123
+ class HighriskSpecialPrefixPage < Page
124
+ ##
125
+ # Initialize the HighriskSpecialPrefixPage
126
+ # @param [Version] version Version that contains the resource
127
+ # @param [Response] response Response from the API
128
+ # @param [Hash] solution Path solution for the resource
129
+ # @return [HighriskSpecialPrefixPage] HighriskSpecialPrefixPage
130
+ def initialize(version, response, solution)
131
+ super(version, response)
132
+
133
+ # Path Solution
134
+ @solution = solution
135
+ end
136
+
137
+ ##
138
+ # Build an instance of HighriskSpecialPrefixInstance
139
+ # @param [Hash] payload Payload response from the API
140
+ # @return [HighriskSpecialPrefixInstance] HighriskSpecialPrefixInstance
141
+ def get_instance(payload)
142
+ HighriskSpecialPrefixInstance.new(@version, payload, parent_iso_code: @solution[:parent_iso_code], )
143
+ end
144
+
145
+ ##
146
+ # Provide a user friendly representation
147
+ def to_s
148
+ '<Twilio.Preview.Permissions.HighriskSpecialPrefixPage>'
149
+ end
150
+ end
151
+
152
+ ##
153
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
154
+ class HighriskSpecialPrefixInstance < InstanceResource
155
+ ##
156
+ # Initialize the HighriskSpecialPrefixInstance
157
+ # @param [Version] version Version that contains the resource
158
+ # @param [Hash] payload payload that contains response from Twilio
159
+ # @param [String] parent_iso_code The [ISO country
160
+ # code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
161
+ # @return [HighriskSpecialPrefixInstance] HighriskSpecialPrefixInstance
162
+ def initialize(version, payload, parent_iso_code: nil)
163
+ super(version)
164
+
165
+ # Marshaled Properties
166
+ @properties = {'prefix' => payload['prefix'], }
167
+ end
168
+
169
+ ##
170
+ # @return [String] prefix string of phone number
171
+ def prefix
172
+ @properties['prefix']
173
+ end
174
+
175
+ ##
176
+ # Provide a user friendly representation
177
+ def to_s
178
+ "<Twilio.Preview.Permissions.HighriskSpecialPrefixInstance>"
179
+ end
180
+
181
+ ##
182
+ # Provide a detailed, user friendly representation
183
+ def inspect
184
+ "<Twilio.Preview.Permissions.HighriskSpecialPrefixInstance>"
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,197 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Preview < Domain
12
+ class Permissions < Version
13
+ class VoicePermissionList < ListResource
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class SettingsList < ListResource
17
+ ##
18
+ # Initialize the SettingsList
19
+ # @param [Version] version Version that contains the resource
20
+ # @return [SettingsList] SettingsList
21
+ def initialize(version)
22
+ super(version)
23
+
24
+ # Path Solution
25
+ @solution = {}
26
+ end
27
+
28
+ ##
29
+ # Provide a user friendly representation
30
+ def to_s
31
+ '#<Twilio.Preview.Permissions.SettingsList>'
32
+ end
33
+ end
34
+
35
+ ##
36
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
37
+ class SettingsPage < Page
38
+ ##
39
+ # Initialize the SettingsPage
40
+ # @param [Version] version Version that contains the resource
41
+ # @param [Response] response Response from the API
42
+ # @param [Hash] solution Path solution for the resource
43
+ # @return [SettingsPage] SettingsPage
44
+ def initialize(version, response, solution)
45
+ super(version, response)
46
+
47
+ # Path Solution
48
+ @solution = solution
49
+ end
50
+
51
+ ##
52
+ # Build an instance of SettingsInstance
53
+ # @param [Hash] payload Payload response from the API
54
+ # @return [SettingsInstance] SettingsInstance
55
+ def get_instance(payload)
56
+ SettingsInstance.new(@version, payload, )
57
+ end
58
+
59
+ ##
60
+ # Provide a user friendly representation
61
+ def to_s
62
+ '<Twilio.Preview.Permissions.SettingsPage>'
63
+ end
64
+ end
65
+
66
+ ##
67
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
68
+ class SettingsContext < InstanceContext
69
+ ##
70
+ # Initialize the SettingsContext
71
+ # @param [Version] version Version that contains the resource
72
+ # @return [SettingsContext] SettingsContext
73
+ def initialize(version)
74
+ super(version)
75
+
76
+ # Path Solution
77
+ @solution = {}
78
+ @uri = "/VoicePermissions/Settings"
79
+ end
80
+
81
+ ##
82
+ # Fetch a SettingsInstance
83
+ # @return [SettingsInstance] Fetched SettingsInstance
84
+ def fetch
85
+ params = Twilio::Values.of({})
86
+
87
+ payload = @version.fetch(
88
+ 'GET',
89
+ @uri,
90
+ params,
91
+ )
92
+
93
+ SettingsInstance.new(@version, payload, )
94
+ end
95
+
96
+ ##
97
+ # Update the SettingsInstance
98
+ # @param [Boolean] inheritance Set true to enable inheritance of outbound voice
99
+ # permissions and blocklist, false to disable
100
+ # @return [SettingsInstance] Updated SettingsInstance
101
+ def update(inheritance: :unset)
102
+ data = Twilio::Values.of({'Inheritance' => inheritance, })
103
+
104
+ payload = @version.update(
105
+ 'POST',
106
+ @uri,
107
+ data: data,
108
+ )
109
+
110
+ SettingsInstance.new(@version, payload, )
111
+ end
112
+
113
+ ##
114
+ # Provide a user friendly representation
115
+ def to_s
116
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
117
+ "#<Twilio.Preview.Permissions.SettingsContext #{context}>"
118
+ end
119
+ end
120
+
121
+ ##
122
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
123
+ class SettingsInstance < InstanceResource
124
+ ##
125
+ # Initialize the SettingsInstance
126
+ # @param [Version] version Version that contains the resource
127
+ # @param [Hash] payload payload that contains response from Twilio
128
+ # @return [SettingsInstance] SettingsInstance
129
+ def initialize(version, payload)
130
+ super(version)
131
+
132
+ # Marshaled Properties
133
+ @properties = {'inheritance' => payload['inheritance'], 'url' => payload['url'], }
134
+
135
+ # Context
136
+ @instance_context = nil
137
+ @params = {}
138
+ end
139
+
140
+ ##
141
+ # Generate an instance context for the instance, the context is capable of
142
+ # performing various actions. All instance actions are proxied to the context
143
+ # @return [SettingsContext] SettingsContext for this SettingsInstance
144
+ def context
145
+ unless @instance_context
146
+ @instance_context = SettingsContext.new(@version, )
147
+ end
148
+ @instance_context
149
+ end
150
+
151
+ ##
152
+ # @return [Boolean] The status of inheritance of outbound voice permissions and blocklist
153
+ def inheritance
154
+ @properties['inheritance']
155
+ end
156
+
157
+ ##
158
+ # @return [String] The url
159
+ def url
160
+ @properties['url']
161
+ end
162
+
163
+ ##
164
+ # Fetch a SettingsInstance
165
+ # @return [SettingsInstance] Fetched SettingsInstance
166
+ def fetch
167
+ context.fetch
168
+ end
169
+
170
+ ##
171
+ # Update the SettingsInstance
172
+ # @param [Boolean] inheritance Set true to enable inheritance of outbound voice
173
+ # permissions and blocklist, false to disable
174
+ # @return [SettingsInstance] Updated SettingsInstance
175
+ def update(inheritance: :unset)
176
+ context.update(inheritance: inheritance, )
177
+ end
178
+
179
+ ##
180
+ # Provide a user friendly representation
181
+ def to_s
182
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
183
+ "<Twilio.Preview.Permissions.SettingsInstance #{values}>"
184
+ end
185
+
186
+ ##
187
+ # Provide a detailed, user friendly representation
188
+ def inspect
189
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
190
+ "<Twilio.Preview.Permissions.SettingsInstance #{values}>"
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
197
+ end
@@ -120,8 +120,10 @@ module Twilio
120
120
  # resource as an alternative to the sid. Unique up to 64 characters long.
121
121
  # @param [String] callback_url The callback_url
122
122
  # @param [String] callback_events The callback_events
123
- # @param [Hash] fallback_actions The fallback_actions
124
- # @param [Hash] initiation_actions The initiation_actions
123
+ # @param [Hash] fallback_actions The JSON actions to be executed when the user's
124
+ # input is not recognized as matching any Intent.
125
+ # @param [Hash] initiation_actions The JSON actions to be executed on inbound
126
+ # phone calls when the Assistant has to say something first.
125
127
  # @return [AssistantInstance] Newly created AssistantInstance
126
128
  def create(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset)
127
129
  data = Twilio::Values.of({
@@ -233,8 +235,10 @@ module Twilio
233
235
  # resource as an alternative to the sid. Unique up to 64 characters long.
234
236
  # @param [String] callback_url The callback_url
235
237
  # @param [String] callback_events The callback_events
236
- # @param [Hash] fallback_actions The fallback_actions
237
- # @param [Hash] initiation_actions The initiation_actions
238
+ # @param [Hash] fallback_actions The JSON actions to be executed when the user's
239
+ # input is not recognized as matching any Intent.
240
+ # @param [Hash] initiation_actions The JSON actions to be executed on inbound
241
+ # phone calls when the Assistant has to say something first.
238
242
  # @return [AssistantInstance] Updated AssistantInstance
239
243
  def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset)
240
244
  data = Twilio::Values.of({
@@ -512,8 +516,10 @@ module Twilio
512
516
  # resource as an alternative to the sid. Unique up to 64 characters long.
513
517
  # @param [String] callback_url The callback_url
514
518
  # @param [String] callback_events The callback_events
515
- # @param [Hash] fallback_actions The fallback_actions
516
- # @param [Hash] initiation_actions The initiation_actions
519
+ # @param [Hash] fallback_actions The JSON actions to be executed when the user's
520
+ # input is not recognized as matching any Intent.
521
+ # @param [Hash] initiation_actions The JSON actions to be executed on inbound
522
+ # phone calls when the Assistant has to say something first.
517
523
  # @return [AssistantInstance] Updated AssistantInstance
518
524
  def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset)
519
525
  context.update(
@@ -18,8 +18,8 @@ module Twilio
18
18
  ##
19
19
  # Initialize the IntentActionsList
20
20
  # @param [Version] version Version that contains the resource
21
- # @param [String] assistant_sid The assistant_sid
22
- # @param [String] intent_sid The intent_sid
21
+ # @param [String] assistant_sid The unique ID of the parent Assistant.
22
+ # @param [String] intent_sid The unique ID of the Intent.
23
23
  # @return [IntentActionsList] IntentActionsList
24
24
  def initialize(version, assistant_sid: nil, intent_sid: nil)
25
25
  super(version)
@@ -77,8 +77,8 @@ module Twilio
77
77
  ##
78
78
  # Initialize the IntentActionsContext
79
79
  # @param [Version] version Version that contains the resource
80
- # @param [String] assistant_sid The assistant_sid
81
- # @param [String] intent_sid The intent_sid
80
+ # @param [String] assistant_sid The unique ID of the parent Assistant.
81
+ # @param [String] intent_sid The unique ID of the Intent.
82
82
  # @return [IntentActionsContext] IntentActionsContext
83
83
  def initialize(version, assistant_sid, intent_sid)
84
84
  super(version)
@@ -110,7 +110,8 @@ module Twilio
110
110
 
111
111
  ##
112
112
  # Update the IntentActionsInstance
113
- # @param [Hash] actions The actions
113
+ # @param [Hash] actions The JSON actions that instruct the Assistant how to
114
+ # perform this task.
114
115
  # @return [IntentActionsInstance] Updated IntentActionsInstance
115
116
  def update(actions: :unset)
116
117
  data = Twilio::Values.of({'Actions' => Twilio.serialize_object(actions), })
@@ -144,8 +145,8 @@ module Twilio
144
145
  # Initialize the IntentActionsInstance
145
146
  # @param [Version] version Version that contains the resource
146
147
  # @param [Hash] payload payload that contains response from Twilio
147
- # @param [String] assistant_sid The assistant_sid
148
- # @param [String] intent_sid The intent_sid
148
+ # @param [String] assistant_sid The unique ID of the parent Assistant.
149
+ # @param [String] intent_sid The unique ID of the Intent.
149
150
  # @return [IntentActionsInstance] IntentActionsInstance
150
151
  def initialize(version, payload, assistant_sid: nil, intent_sid: nil)
151
152
  super(version)
@@ -180,19 +181,19 @@ module Twilio
180
181
  end
181
182
 
182
183
  ##
183
- # @return [String] The account_sid
184
+ # @return [String] The unique ID of the Account that created this Field.
184
185
  def account_sid
185
186
  @properties['account_sid']
186
187
  end
187
188
 
188
189
  ##
189
- # @return [String] The assistant_sid
190
+ # @return [String] The unique ID of the parent Assistant.
190
191
  def assistant_sid
191
192
  @properties['assistant_sid']
192
193
  end
193
194
 
194
195
  ##
195
- # @return [String] The intent_sid
196
+ # @return [String] The unique ID of the Intent.
196
197
  def intent_sid
197
198
  @properties['intent_sid']
198
199
  end
@@ -218,7 +219,8 @@ module Twilio
218
219
 
219
220
  ##
220
221
  # Update the IntentActionsInstance
221
- # @param [Hash] actions The actions
222
+ # @param [Hash] actions The JSON actions that instruct the Assistant how to
223
+ # perform this task.
222
224
  # @return [IntentActionsInstance] Updated IntentActionsInstance
223
225
  def update(actions: :unset)
224
226
  context.update(actions: actions, )