twilio-ruby 5.31.4 → 5.31.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +0 -11
- data/CHANGES.md +38 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +27 -1
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +5 -1
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/messaging.rb +0 -15
- data/lib/twilio-ruby/rest/messaging/v1.rb +0 -22
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb +322 -0
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +49 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +427 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +224 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +387 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +239 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/test_user.rb +215 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +10 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +7 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +14 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +5 -3
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +5 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call_spec.rb +30 -10
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +29 -0
- data/spec/integration/api/v2010/account/notification_spec.rb +1 -1
- data/spec/integration/api/v2010/account_spec.rb +45 -0
- data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
- data/spec/integration/numbers/v2/regulatory_compliance/regulation_spec.rb +183 -0
- data/spec/integration/studio/v2/flow/execution/execution_context_spec.rb +51 -0
- data/spec/integration/studio/v2/flow/execution/execution_step/execution_step_context_spec.rb +54 -0
- data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +101 -0
- data/spec/integration/studio/v2/flow/execution_spec.rb +169 -0
- data/spec/integration/studio/v2/flow/test_user_spec.rb +86 -0
- data/spec/integration/studio/v2/flow_spec.rb +16 -4
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics_spec.rb +6 -0
- data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics_spec.rb +2 -0
- data/spec/integration/taskrouter/v1/workspace/task_spec.rb +4 -0
- data/twilio-ruby.gemspec +1 -1
- metadata +22 -19
- data/lib/twilio-ruby/rest/messaging/v1/session.rb +0 -513
- data/lib/twilio-ruby/rest/messaging/v1/session/message.rb +0 -439
- data/lib/twilio-ruby/rest/messaging/v1/session/participant.rb +0 -458
- data/lib/twilio-ruby/rest/messaging/v1/session/webhook.rb +0 -444
- data/lib/twilio-ruby/rest/messaging/v1/webhook.rb +0 -299
- data/spec/integration/messaging/v1/session/message_spec.rb +0 -238
- data/spec/integration/messaging/v1/session/participant_spec.rb +0 -256
- data/spec/integration/messaging/v1/session/webhook_spec.rb +0 -300
- data/spec/integration/messaging/v1/session_spec.rb +0 -227
- data/spec/integration/messaging/v1/webhook_spec.rb +0 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45376885410dc45b3a428a4b39045e71e9903b0b42dfc271573342375c601e88
|
4
|
+
data.tar.gz: 771493f5cb84f2027b28b11a15e1ed215fd1e19a3ced562772b1a04a9d4baeb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b75b9c9797e5e50e095e1435235ad0066ed49399b43f28f0771f55cad940ee81b1643792e320e5119a719972fbac4a60173f1eb120b35f1b08af2bae38f8002
|
7
|
+
data.tar.gz: e863b1dfc134ed8265109c35e8564ecca22bbb5e665f2660ea36607ed497a08f298a145f8add6393821464878a9f84dcc580aab5a9977c1183e3c4a5781a7cd1
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -116,17 +116,6 @@ Naming/VariableName:
|
|
116
116
|
- 'spec/jwt/client_capability_spec.rb'
|
117
117
|
- 'spec/jwt/task_router_spec.rb'
|
118
118
|
|
119
|
-
# Offense count: 8
|
120
|
-
# Cop supports --auto-correct.
|
121
|
-
# Configuration parameters: EnforcedStyle.
|
122
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
123
|
-
Style/BracesAroundHashParameters:
|
124
|
-
Exclude:
|
125
|
-
- 'spec/framework/serialize_spec.rb'
|
126
|
-
- 'spec/jwt/access_token_spec.rb'
|
127
|
-
- 'spec/jwt/client_capability_spec.rb'
|
128
|
-
- 'spec/rack/twilio_webhook_authentication_spec.rb'
|
129
|
-
|
130
119
|
# Offense count: 38
|
131
120
|
Style/Documentation:
|
132
121
|
Enabled: false
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,44 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2020-02-19] Version 5.31.5
|
5
|
+
---------------------------
|
6
|
+
**Library - Chore**
|
7
|
+
- [PR #495](https://github.com/twilio/twilio-ruby/pull/495): bump the rubocop version. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
8
|
+
|
9
|
+
**Api**
|
10
|
+
- Make call create parameters `async_amd`, `async_amd_status_callback`, and `async_amd_status_callback_method` public
|
11
|
+
- Add `trunk_sid` as an optional field to Call resource fetch/read responses
|
12
|
+
- Add property `queue_time` to successful response of create, fetch, and update requests for Call
|
13
|
+
- Add optional parameter `byoc` to conference participant create.
|
14
|
+
|
15
|
+
**Authy**
|
16
|
+
- Added support for challenges associated to push factors
|
17
|
+
|
18
|
+
**Flex**
|
19
|
+
- Adding `ui_dependencies` to Flex Configuration
|
20
|
+
|
21
|
+
**Messaging**
|
22
|
+
- Deprecate Session API **(breaking change)**
|
23
|
+
|
24
|
+
**Numbers**
|
25
|
+
- Add Regulations API
|
26
|
+
|
27
|
+
**Studio**
|
28
|
+
- Add Execution and Step endpoints to v2 API
|
29
|
+
- Add webhook_url to Flow response and add new /TestUsers endpoint to v2 API
|
30
|
+
|
31
|
+
**Taskrouter**
|
32
|
+
- Adding `longest_relative_task_age_in_queue` and `longest_relative_task_sid_in_queue` to TaskQueue Real Time Statistics API.
|
33
|
+
- Add `wait_duration_in_queue_until_accepted` aggregations to TaskQueues Cumulative Statistics endpoint
|
34
|
+
- Add TaskQueueEnteredDate property to Tasks.
|
35
|
+
|
36
|
+
**Video**
|
37
|
+
- [Composer] Clarification for the composition hooks creation documentation: one source is mandatory, either the `audio_sources` or the `video_layout`, but one of them has to be provided
|
38
|
+
- [Composer] `audio_sources` type on the composer HTTP POST command, changed from `sid[]` to `string[]` **(breaking change)**
|
39
|
+
- [Composer] Clarification for the composition creation documentation: one source is mandatory, either the `audio_sources` or the `video_layout`, but one of them has to be provided
|
40
|
+
|
41
|
+
|
4
42
|
[2020-02-05] Version 5.31.4
|
5
43
|
---------------------------
|
6
44
|
**Api**
|
data/README.md
CHANGED
@@ -32,13 +32,13 @@ This library supports the following Ruby implementations:
|
|
32
32
|
To install using [Bundler][bundler] grab the latest stable version:
|
33
33
|
|
34
34
|
```ruby
|
35
|
-
gem 'twilio-ruby', '~> 5.31.
|
35
|
+
gem 'twilio-ruby', '~> 5.31.5'
|
36
36
|
```
|
37
37
|
|
38
38
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
39
39
|
|
40
40
|
```bash
|
41
|
-
gem install twilio-ruby -v 5.31.
|
41
|
+
gem install twilio-ruby -v 5.31.5
|
42
42
|
```
|
43
43
|
|
44
44
|
To build and install the development branch yourself from the latest source:
|
@@ -127,6 +127,15 @@ module Twilio
|
|
127
127
|
# @param [String] machine_detection_silence_timeout The number of milliseconds of
|
128
128
|
# initial silence after which an `unknown` AnsweredBy result will be returned.
|
129
129
|
# Possible Values: 2000-10000. Default: 5000.
|
130
|
+
# @param [String] async_amd Select whether to perform answering machine detection
|
131
|
+
# in the background. Default, blocks the execution of the call until Answering
|
132
|
+
# Machine Detection is completed. Can be: `true` or `false`.
|
133
|
+
# @param [String] async_amd_status_callback The URL that we should call using the
|
134
|
+
# `async_amd_status_callback_method` to notify customer application whether the
|
135
|
+
# call was answered by human, machine or fax.
|
136
|
+
# @param [String] async_amd_status_callback_method The HTTP method we should use
|
137
|
+
# when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and
|
138
|
+
# the default is `POST`.
|
130
139
|
# @param [String] byoc The SID of a BYOC (Bring Your Own Carrier) trunk to route
|
131
140
|
# this call with. Note that `byoc` is only meaningful when `to` is a phone number;
|
132
141
|
# it will otherwise be ignored. (Beta)
|
@@ -141,7 +150,7 @@ module Twilio
|
|
141
150
|
# @param [String] application_sid The SID of the Application resource that will
|
142
151
|
# handle the call, if the call will be handled by an application.
|
143
152
|
# @return [CallInstance] Newly created CallInstance
|
144
|
-
def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, byoc: :unset, url: :unset, twiml: :unset, application_sid: :unset)
|
153
|
+
def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, async_amd: :unset, async_amd_status_callback: :unset, async_amd_status_callback_method: :unset, byoc: :unset, url: :unset, twiml: :unset, application_sid: :unset)
|
145
154
|
data = Twilio::Values.of({
|
146
155
|
'To' => to,
|
147
156
|
'From' => from,
|
@@ -170,6 +179,9 @@ module Twilio
|
|
170
179
|
'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold,
|
171
180
|
'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold,
|
172
181
|
'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout,
|
182
|
+
'AsyncAmd' => async_amd,
|
183
|
+
'AsyncAmdStatusCallback' => async_amd_status_callback,
|
184
|
+
'AsyncAmdStatusCallbackMethod' => async_amd_status_callback_method,
|
173
185
|
'Byoc' => byoc,
|
174
186
|
})
|
175
187
|
|
@@ -622,7 +634,9 @@ module Twilio
|
|
622
634
|
'subresource_uris' => payload['subresource_uris'],
|
623
635
|
'to' => payload['to'],
|
624
636
|
'to_formatted' => payload['to_formatted'],
|
637
|
+
'trunk_sid' => payload['trunk_sid'],
|
625
638
|
'uri' => payload['uri'],
|
639
|
+
'queue_time' => payload['queue_time'],
|
626
640
|
}
|
627
641
|
|
628
642
|
# Context
|
@@ -785,12 +799,24 @@ module Twilio
|
|
785
799
|
@properties['to_formatted']
|
786
800
|
end
|
787
801
|
|
802
|
+
##
|
803
|
+
# @return [String] The (optional) unique identifier of the trunk resource that was used for this call.
|
804
|
+
def trunk_sid
|
805
|
+
@properties['trunk_sid']
|
806
|
+
end
|
807
|
+
|
788
808
|
##
|
789
809
|
# @return [String] The URI of this resource, relative to `https://api.twilio.com`
|
790
810
|
def uri
|
791
811
|
@properties['uri']
|
792
812
|
end
|
793
813
|
|
814
|
+
##
|
815
|
+
# @return [String] The wait time in milliseconds before the call is placed.
|
816
|
+
def queue_time
|
817
|
+
@properties['queue_time']
|
818
|
+
end
|
819
|
+
|
794
820
|
##
|
795
821
|
# Deletes the CallInstance
|
796
822
|
# @return [Boolean] true if delete succeeds, false otherwise
|
@@ -128,8 +128,11 @@ module Twilio
|
|
128
128
|
# @param [String] call_sid_to_coach The SID of the participant who is being
|
129
129
|
# `coached`. The participant being coached is the only participant who can hear
|
130
130
|
# the participant who is `coaching`.
|
131
|
+
# @param [String] byoc The SID of a BYOC (Bring Your Own Carrier) trunk to route
|
132
|
+
# this call with. Note that `byoc` is only meaningful when `to` is a phone number;
|
133
|
+
# it will otherwise be ignored. (Beta)
|
131
134
|
# @return [ParticipantInstance] Newly created ParticipantInstance
|
132
|
-
def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, coaching: :unset, call_sid_to_coach: :unset)
|
135
|
+
def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, coaching: :unset, call_sid_to_coach: :unset, byoc: :unset)
|
133
136
|
data = Twilio::Values.of({
|
134
137
|
'From' => from,
|
135
138
|
'To' => to,
|
@@ -163,6 +166,7 @@ module Twilio
|
|
163
166
|
'ConferenceRecordingStatusCallbackEvent' => Twilio.serialize_list(conference_recording_status_callback_event) { |e| e },
|
164
167
|
'Coaching' => coaching,
|
165
168
|
'CallSidToCoach' => call_sid_to_coach,
|
169
|
+
'Byoc' => byoc,
|
166
170
|
})
|
167
171
|
|
168
172
|
payload = @version.create(
|
@@ -163,6 +163,7 @@ module Twilio
|
|
163
163
|
'chat_service_instance_sid' => payload['chat_service_instance_sid'],
|
164
164
|
'ui_language' => payload['ui_language'],
|
165
165
|
'ui_attributes' => payload['ui_attributes'],
|
166
|
+
'ui_dependencies' => payload['ui_dependencies'],
|
166
167
|
'ui_version' => payload['ui_version'],
|
167
168
|
'service_version' => payload['service_version'],
|
168
169
|
'call_recording_enabled' => payload['call_recording_enabled'],
|
@@ -305,6 +306,12 @@ module Twilio
|
|
305
306
|
@properties['ui_attributes']
|
306
307
|
end
|
307
308
|
|
309
|
+
##
|
310
|
+
# @return [Hash] The object that defines the NPM packages and versions to be used in Hosted Flex
|
311
|
+
def ui_dependencies
|
312
|
+
@properties['ui_dependencies']
|
313
|
+
end
|
314
|
+
|
308
315
|
##
|
309
316
|
# @return [String] The Pinned UI version
|
310
317
|
def ui_version
|
@@ -37,21 +37,6 @@ module Twilio
|
|
37
37
|
self.v1.services(sid)
|
38
38
|
end
|
39
39
|
|
40
|
-
##
|
41
|
-
# @param [String] sid The unique string that we created to identify the Session
|
42
|
-
# resource.
|
43
|
-
# @return [Twilio::REST::Messaging::V1::SessionInstance] if sid was passed.
|
44
|
-
# @return [Twilio::REST::Messaging::V1::SessionList]
|
45
|
-
def sessions(sid=:unset)
|
46
|
-
self.v1.sessions(sid)
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# @return [Twilio::REST::Messaging::V1::WebhookInstance]
|
51
|
-
def webhooks
|
52
|
-
self.v1.webhooks()
|
53
|
-
end
|
54
|
-
|
55
40
|
##
|
56
41
|
# Provide a user friendly representation
|
57
42
|
def to_s
|
@@ -16,8 +16,6 @@ module Twilio
|
|
16
16
|
super
|
17
17
|
@version = 'v1'
|
18
18
|
@services = nil
|
19
|
-
@sessions = nil
|
20
|
-
@webhooks = nil
|
21
19
|
end
|
22
20
|
|
23
21
|
##
|
@@ -34,26 +32,6 @@ module Twilio
|
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
|
-
##
|
38
|
-
# @param [String] sid The SID of the Session resource to fetch.
|
39
|
-
# @return [Twilio::REST::Messaging::V1::SessionContext] if sid was passed.
|
40
|
-
# @return [Twilio::REST::Messaging::V1::SessionList]
|
41
|
-
def sessions(sid=:unset)
|
42
|
-
if sid.nil?
|
43
|
-
raise ArgumentError, 'sid cannot be nil'
|
44
|
-
elsif sid == :unset
|
45
|
-
@sessions ||= SessionList.new self
|
46
|
-
else
|
47
|
-
SessionContext.new(self, sid)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# @return [Twilio::REST::Messaging::V1::WebhookContext]
|
53
|
-
def webhooks
|
54
|
-
@webhooks ||= WebhookContext.new self
|
55
|
-
end
|
56
|
-
|
57
35
|
##
|
58
36
|
# Provide a user friendly representation
|
59
37
|
def to_s
|
@@ -0,0 +1,322 @@
|
|
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 Numbers < Domain
|
12
|
+
class V2 < Version
|
13
|
+
class RegulatoryComplianceList < ListResource
|
14
|
+
class RegulationList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the RegulationList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @return [RegulationList] RegulationList
|
19
|
+
def initialize(version)
|
20
|
+
super(version)
|
21
|
+
|
22
|
+
# Path Solution
|
23
|
+
@solution = {}
|
24
|
+
@uri = "/RegulatoryCompliance/Regulations"
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Lists RegulationInstance records from the API as a list.
|
29
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
30
|
+
# memory before returning.
|
31
|
+
# @param [regulation.EndUserType] end_user_type The type of End User the
|
32
|
+
# regulation requires - can be `individual` or `business`.
|
33
|
+
# @param [String] iso_country The ISO country code of the phone number's country.
|
34
|
+
# @param [String] number_type The type of phone number that the regulatory
|
35
|
+
# requiremnt is restricting.
|
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(end_user_type: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
|
44
|
+
self.stream(
|
45
|
+
end_user_type: end_user_type,
|
46
|
+
iso_country: iso_country,
|
47
|
+
number_type: number_type,
|
48
|
+
limit: limit,
|
49
|
+
page_size: page_size
|
50
|
+
).entries
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Streams RegulationInstance records from the API as an Enumerable.
|
55
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
56
|
+
# is reached.
|
57
|
+
# @param [regulation.EndUserType] end_user_type The type of End User the
|
58
|
+
# regulation requires - can be `individual` or `business`.
|
59
|
+
# @param [String] iso_country The ISO country code of the phone number's country.
|
60
|
+
# @param [String] number_type The type of phone number that the regulatory
|
61
|
+
# requiremnt is restricting.
|
62
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
63
|
+
# guarantees to never return more than limit. Default is no limit.
|
64
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
65
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
66
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
67
|
+
# efficient page size, i.e. min(limit, 1000)
|
68
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
69
|
+
def stream(end_user_type: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
|
70
|
+
limits = @version.read_limits(limit, page_size)
|
71
|
+
|
72
|
+
page = self.page(
|
73
|
+
end_user_type: end_user_type,
|
74
|
+
iso_country: iso_country,
|
75
|
+
number_type: number_type,
|
76
|
+
page_size: limits[:page_size],
|
77
|
+
)
|
78
|
+
|
79
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# When passed a block, yields RegulationInstance records from the API.
|
84
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
85
|
+
# is reached.
|
86
|
+
def each
|
87
|
+
limits = @version.read_limits
|
88
|
+
|
89
|
+
page = self.page(page_size: limits[:page_size], )
|
90
|
+
|
91
|
+
@version.stream(page,
|
92
|
+
limit: limits[:limit],
|
93
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Retrieve a single page of RegulationInstance records from the API.
|
98
|
+
# Request is executed immediately.
|
99
|
+
# @param [regulation.EndUserType] end_user_type The type of End User the
|
100
|
+
# regulation requires - can be `individual` or `business`.
|
101
|
+
# @param [String] iso_country The ISO country code of the phone number's country.
|
102
|
+
# @param [String] number_type The type of phone number that the regulatory
|
103
|
+
# requiremnt is restricting.
|
104
|
+
# @param [String] page_token PageToken provided by the API
|
105
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
106
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
107
|
+
# @return [Page] Page of RegulationInstance
|
108
|
+
def page(end_user_type: :unset, iso_country: :unset, number_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
109
|
+
params = Twilio::Values.of({
|
110
|
+
'EndUserType' => end_user_type,
|
111
|
+
'IsoCountry' => iso_country,
|
112
|
+
'NumberType' => number_type,
|
113
|
+
'PageToken' => page_token,
|
114
|
+
'Page' => page_number,
|
115
|
+
'PageSize' => page_size,
|
116
|
+
})
|
117
|
+
response = @version.page(
|
118
|
+
'GET',
|
119
|
+
@uri,
|
120
|
+
params
|
121
|
+
)
|
122
|
+
RegulationPage.new(@version, response, @solution)
|
123
|
+
end
|
124
|
+
|
125
|
+
##
|
126
|
+
# Retrieve a single page of RegulationInstance records from the API.
|
127
|
+
# Request is executed immediately.
|
128
|
+
# @param [String] target_url API-generated URL for the requested results page
|
129
|
+
# @return [Page] Page of RegulationInstance
|
130
|
+
def get_page(target_url)
|
131
|
+
response = @version.domain.request(
|
132
|
+
'GET',
|
133
|
+
target_url
|
134
|
+
)
|
135
|
+
RegulationPage.new(@version, response, @solution)
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# Provide a user friendly representation
|
140
|
+
def to_s
|
141
|
+
'#<Twilio.Numbers.V2.RegulationList>'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class RegulationPage < Page
|
146
|
+
##
|
147
|
+
# Initialize the RegulationPage
|
148
|
+
# @param [Version] version Version that contains the resource
|
149
|
+
# @param [Response] response Response from the API
|
150
|
+
# @param [Hash] solution Path solution for the resource
|
151
|
+
# @return [RegulationPage] RegulationPage
|
152
|
+
def initialize(version, response, solution)
|
153
|
+
super(version, response)
|
154
|
+
|
155
|
+
# Path Solution
|
156
|
+
@solution = solution
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
# Build an instance of RegulationInstance
|
161
|
+
# @param [Hash] payload Payload response from the API
|
162
|
+
# @return [RegulationInstance] RegulationInstance
|
163
|
+
def get_instance(payload)
|
164
|
+
RegulationInstance.new(@version, payload, )
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Provide a user friendly representation
|
169
|
+
def to_s
|
170
|
+
'<Twilio.Numbers.V2.RegulationPage>'
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
class RegulationContext < InstanceContext
|
175
|
+
##
|
176
|
+
# Initialize the RegulationContext
|
177
|
+
# @param [Version] version Version that contains the resource
|
178
|
+
# @param [String] sid The unique string that identifies the Regulation resource.
|
179
|
+
# @return [RegulationContext] RegulationContext
|
180
|
+
def initialize(version, sid)
|
181
|
+
super(version)
|
182
|
+
|
183
|
+
# Path Solution
|
184
|
+
@solution = {sid: sid, }
|
185
|
+
@uri = "/RegulatoryCompliance/Regulations/#{@solution[:sid]}"
|
186
|
+
end
|
187
|
+
|
188
|
+
##
|
189
|
+
# Fetch a RegulationInstance
|
190
|
+
# @return [RegulationInstance] Fetched RegulationInstance
|
191
|
+
def fetch
|
192
|
+
params = Twilio::Values.of({})
|
193
|
+
|
194
|
+
payload = @version.fetch(
|
195
|
+
'GET',
|
196
|
+
@uri,
|
197
|
+
params,
|
198
|
+
)
|
199
|
+
|
200
|
+
RegulationInstance.new(@version, payload, sid: @solution[:sid], )
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# Provide a user friendly representation
|
205
|
+
def to_s
|
206
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
207
|
+
"#<Twilio.Numbers.V2.RegulationContext #{context}>"
|
208
|
+
end
|
209
|
+
|
210
|
+
##
|
211
|
+
# Provide a detailed, user friendly representation
|
212
|
+
def inspect
|
213
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
214
|
+
"#<Twilio.Numbers.V2.RegulationContext #{context}>"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
class RegulationInstance < InstanceResource
|
219
|
+
##
|
220
|
+
# Initialize the RegulationInstance
|
221
|
+
# @param [Version] version Version that contains the resource
|
222
|
+
# @param [Hash] payload payload that contains response from Twilio
|
223
|
+
# @param [String] sid The unique string that identifies the Regulation resource.
|
224
|
+
# @return [RegulationInstance] RegulationInstance
|
225
|
+
def initialize(version, payload, sid: nil)
|
226
|
+
super(version)
|
227
|
+
|
228
|
+
# Marshaled Properties
|
229
|
+
@properties = {
|
230
|
+
'sid' => payload['sid'],
|
231
|
+
'friendly_name' => payload['friendly_name'],
|
232
|
+
'iso_country' => payload['iso_country'],
|
233
|
+
'number_type' => payload['number_type'],
|
234
|
+
'end_user_type' => payload['end_user_type'],
|
235
|
+
'requirements' => payload['requirements'],
|
236
|
+
'url' => payload['url'],
|
237
|
+
}
|
238
|
+
|
239
|
+
# Context
|
240
|
+
@instance_context = nil
|
241
|
+
@params = {'sid' => sid || @properties['sid'], }
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# Generate an instance context for the instance, the context is capable of
|
246
|
+
# performing various actions. All instance actions are proxied to the context
|
247
|
+
# @return [RegulationContext] RegulationContext for this RegulationInstance
|
248
|
+
def context
|
249
|
+
unless @instance_context
|
250
|
+
@instance_context = RegulationContext.new(@version, @params['sid'], )
|
251
|
+
end
|
252
|
+
@instance_context
|
253
|
+
end
|
254
|
+
|
255
|
+
##
|
256
|
+
# @return [String] The unique string that identifies the Regulation resource
|
257
|
+
def sid
|
258
|
+
@properties['sid']
|
259
|
+
end
|
260
|
+
|
261
|
+
##
|
262
|
+
# @return [String] A human-readable description of the Regulation resource
|
263
|
+
def friendly_name
|
264
|
+
@properties['friendly_name']
|
265
|
+
end
|
266
|
+
|
267
|
+
##
|
268
|
+
# @return [String] The ISO country code of the phone number's country
|
269
|
+
def iso_country
|
270
|
+
@properties['iso_country']
|
271
|
+
end
|
272
|
+
|
273
|
+
##
|
274
|
+
# @return [String] The type of phone number restricted by the regulatory requirement
|
275
|
+
def number_type
|
276
|
+
@properties['number_type']
|
277
|
+
end
|
278
|
+
|
279
|
+
##
|
280
|
+
# @return [regulation.EndUserType] The type of End User of the Regulation resource
|
281
|
+
def end_user_type
|
282
|
+
@properties['end_user_type']
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# @return [Hash] The sid of a regulation object that dictates requirements
|
287
|
+
def requirements
|
288
|
+
@properties['requirements']
|
289
|
+
end
|
290
|
+
|
291
|
+
##
|
292
|
+
# @return [String] The absolute URL of the Regulation resource
|
293
|
+
def url
|
294
|
+
@properties['url']
|
295
|
+
end
|
296
|
+
|
297
|
+
##
|
298
|
+
# Fetch a RegulationInstance
|
299
|
+
# @return [RegulationInstance] Fetched RegulationInstance
|
300
|
+
def fetch
|
301
|
+
context.fetch
|
302
|
+
end
|
303
|
+
|
304
|
+
##
|
305
|
+
# Provide a user friendly representation
|
306
|
+
def to_s
|
307
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
308
|
+
"<Twilio.Numbers.V2.RegulationInstance #{values}>"
|
309
|
+
end
|
310
|
+
|
311
|
+
##
|
312
|
+
# Provide a detailed, user friendly representation
|
313
|
+
def inspect
|
314
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
315
|
+
"<Twilio.Numbers.V2.RegulationInstance #{values}>"
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|