twilio-ruby 5.31.1 → 5.31.2
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +4 -3
- data/CHANGES.md +16 -0
- data/LICENSE.md +1 -1
- data/README.md +2 -2
- data/lib/twilio-ruby.rb +5 -5
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/numbers.rb +44 -0
- data/lib/twilio-ruby/rest/numbers/v2.rb +35 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +189 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +482 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.rb +333 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +361 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user_type.rb +281 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +374 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document_type.rb +281 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +30 -5
- data/lib/twilio-ruby/rest/studio.rb +16 -3
- data/lib/twilio-ruby/rest/studio/v2.rb +50 -0
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +451 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +343 -0
- data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +126 -0
- data/lib/twilio-ruby/twiml/voice_response.rb +3 -2
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/numbers/v2/regulatory_compliance/bundle/item_assignment_spec.rb +198 -0
- data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +226 -0
- data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +214 -0
- data/spec/integration/numbers/v2/regulatory_compliance/end_user_type_spec.rb +143 -0
- data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +226 -0
- data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_type_spec.rb +133 -0
- data/spec/integration/numbers/v2/regulatory_compliance_spec.rb +12 -0
- data/spec/integration/serverless/v1/service/environment/log_spec.rb +2 -2
- data/spec/integration/studio/v2/flow/flow_revision_spec.rb +112 -0
- data/spec/integration/studio/v2/flow_spec.rb +234 -0
- data/spec/integration/studio/v2/flow_validate_spec.rb +42 -0
- data/twilio-ruby.gemspec +2 -2
- metadata +39 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97e9af8abf406d407ed5b2ac3335d5920a14b3f15c57959ccb08f19d767380bd
|
4
|
+
data.tar.gz: 45777c544fddd89d53041a640e43d3eef9efb62d3b14a89955c42dc031a113ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1166fef8722efcdf85db0594e8ffc1b94612d3ac64f78c0caf955e55a98f7c73cd437a731bab380daff56ac297a0f1e4badc68b42214dab5c4c716105eaa14d
|
7
|
+
data.tar.gz: 0a135ab533b362d551dc6832925fbcf8e295165d020a08c9108dd35c85ae931750fe8463d67135b24b316a09efdb15fbabc3f94dd6f352d7403ceac6907e6c30
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-01-06 13:56:04 -0300 using RuboCop version 0.79.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -16,7 +16,7 @@ Gemspec/OrderedDependencies:
|
|
16
16
|
|
17
17
|
# Offense count: 1
|
18
18
|
# Configuration parameters: Include.
|
19
|
-
# Include: **/*.gemspec
|
19
|
+
# Include: **/*.gemspec
|
20
20
|
Gemspec/RequiredRubyVersion:
|
21
21
|
Exclude:
|
22
22
|
- 'twilio-ruby.gemspec'
|
@@ -37,7 +37,8 @@ Layout/ExtraSpacing:
|
|
37
37
|
|
38
38
|
# Offense count: 2
|
39
39
|
# Cop supports --auto-correct.
|
40
|
-
# Configuration parameters: AllowForAlignment.
|
40
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
41
|
+
# SupportedStylesForExponentOperator: space, no_space
|
41
42
|
Layout/SpaceAroundOperators:
|
42
43
|
Exclude:
|
43
44
|
- 'spec/jwt/client_capability_spec.rb'
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2020-01-08] Version 5.31.2
|
5
|
+
---------------------------
|
6
|
+
**Library - Chore**
|
7
|
+
- [PR #491](https://github.com/twilio/twilio-ruby/pull/491): upgrade rubocop to 0.79.0. Thanks to [@juampi](https://github.com/juampi)!
|
8
|
+
- [PR #489](https://github.com/twilio/twilio-ruby/pull/489): upgrade faraday to 1.0.0. Thanks to [@juampi](https://github.com/juampi)!
|
9
|
+
|
10
|
+
**Numbers**
|
11
|
+
- Add Regulatory Compliance CRUD APIs
|
12
|
+
|
13
|
+
**Studio**
|
14
|
+
- Add parameter validation for Studio v2 Flows API
|
15
|
+
|
16
|
+
**Twiml**
|
17
|
+
- Add support for `speech_model` to `Gather` verb
|
18
|
+
|
19
|
+
|
4
20
|
[2019-12-18] Version 5.31.1
|
5
21
|
---------------------------
|
6
22
|
**Library - Chore**
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (C)
|
3
|
+
Copyright (C) 2020, Twilio, Inc. <help@twilio.com>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
@@ -31,13 +31,13 @@ This library supports the following Ruby implementations:
|
|
31
31
|
To install using [Bundler][bundler] grab the latest stable version:
|
32
32
|
|
33
33
|
```ruby
|
34
|
-
gem 'twilio-ruby', '~> 5.31.
|
34
|
+
gem 'twilio-ruby', '~> 5.31.2'
|
35
35
|
```
|
36
36
|
|
37
37
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
38
38
|
|
39
39
|
```bash
|
40
|
-
gem install twilio-ruby -v 5.31.
|
40
|
+
gem install twilio-ruby -v 5.31.2
|
41
41
|
```
|
42
42
|
|
43
43
|
To build and install the development branch yourself from the latest source:
|
data/lib/twilio-ruby.rb
CHANGED
@@ -27,19 +27,19 @@ require 'twilio-ruby/twiml/fax_response'
|
|
27
27
|
require 'twilio-ruby/twiml/messaging_response'
|
28
28
|
require 'twilio-ruby/twiml/voice_response'
|
29
29
|
|
30
|
-
Dir[File.dirname(__FILE__) + '/twilio-ruby/http/**/*.rb'].each do |file|
|
30
|
+
Dir[File.dirname(__FILE__) + '/twilio-ruby/http/**/*.rb'].sort.each do |file|
|
31
31
|
require file
|
32
32
|
end
|
33
|
-
Dir[File.dirname(__FILE__) + '/twilio-ruby/framework/**/*.rb'].each do |file|
|
33
|
+
Dir[File.dirname(__FILE__) + '/twilio-ruby/framework/**/*.rb'].sort.each do |file|
|
34
34
|
require file
|
35
35
|
end
|
36
|
-
Dir[File.dirname(__FILE__) + '/twilio-ruby/rest/*.rb'].each do |file|
|
36
|
+
Dir[File.dirname(__FILE__) + '/twilio-ruby/rest/*.rb'].sort.each do |file|
|
37
37
|
require file
|
38
38
|
end
|
39
|
-
Dir[File.dirname(__FILE__) + '/twilio-ruby/rest/**/*.rb'].each do |file|
|
39
|
+
Dir[File.dirname(__FILE__) + '/twilio-ruby/rest/**/*.rb'].sort.each do |file|
|
40
40
|
require file
|
41
41
|
end
|
42
|
-
Dir[File.dirname(__FILE__) + '/twilio-ruby/compatibility/**/*.rb'].each do |file|
|
42
|
+
Dir[File.dirname(__FILE__) + '/twilio-ruby/compatibility/**/*.rb'].sort.each do |file|
|
43
43
|
require file
|
44
44
|
end
|
45
45
|
|
@@ -39,6 +39,7 @@ module Twilio
|
|
39
39
|
@messaging = nil
|
40
40
|
@monitor = nil
|
41
41
|
@notify = nil
|
42
|
+
@numbers = nil
|
42
43
|
@preview = nil
|
43
44
|
@pricing = nil
|
44
45
|
@proxy = nil
|
@@ -185,6 +186,12 @@ module Twilio
|
|
185
186
|
@notify ||= Notify.new self
|
186
187
|
end
|
187
188
|
|
189
|
+
##
|
190
|
+
# Access the Numbers Twilio Domain
|
191
|
+
def numbers
|
192
|
+
@numbers ||= Numbers.new self
|
193
|
+
end
|
194
|
+
|
188
195
|
##
|
189
196
|
# Access the Preview Twilio Domain
|
190
197
|
def preview
|
@@ -0,0 +1,44 @@
|
|
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
|
+
##
|
13
|
+
# Initialize the Numbers Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://numbers.twilio.com'
|
18
|
+
@host = 'numbers.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v2 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v2 of numbers
|
27
|
+
def v2
|
28
|
+
@v2 ||= V2.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# @return [Twilio::REST::Numbers::V2::RegulatoryComplianceInstance]
|
33
|
+
def regulatory_compliance
|
34
|
+
self.v2.regulatory_compliance()
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Provide a user friendly representation
|
39
|
+
def to_s
|
40
|
+
'#<Twilio::REST::Numbers>'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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
|
12
|
+
class V2 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V2 version of Numbers
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v2'
|
18
|
+
@regulatory_compliance = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @return [Twilio::REST::Numbers::V2::RegulatoryComplianceContext]
|
23
|
+
def regulatory_compliance
|
24
|
+
@regulatory_compliance ||= RegulatoryComplianceList.new self
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'<Twilio::REST::Numbers::V2>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,189 @@
|
|
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
|
+
##
|
15
|
+
# Initialize the RegulatoryComplianceList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [RegulatoryComplianceList] RegulatoryComplianceList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
|
24
|
+
# Components
|
25
|
+
@bundles = nil
|
26
|
+
@end_users = nil
|
27
|
+
@end_user_types = nil
|
28
|
+
@regulations = nil
|
29
|
+
@supporting_documents = nil
|
30
|
+
@supporting_document_types = nil
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Access the bundles
|
35
|
+
# @param [String] sid The unique string that we created to identify the Bundle
|
36
|
+
# resource.
|
37
|
+
# @return [BundleList]
|
38
|
+
# @return [BundleContext] if sid was passed.
|
39
|
+
def bundles(sid=:unset)
|
40
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
41
|
+
|
42
|
+
if sid != :unset
|
43
|
+
return BundleContext.new(@version, sid, )
|
44
|
+
end
|
45
|
+
|
46
|
+
@bundles ||= BundleList.new(@version, )
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Access the end_users
|
51
|
+
# @param [String] sid The unique string that we created to identify the End User
|
52
|
+
# resource.
|
53
|
+
# @return [EndUserList]
|
54
|
+
# @return [EndUserContext] if sid was passed.
|
55
|
+
def end_users(sid=:unset)
|
56
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
57
|
+
|
58
|
+
if sid != :unset
|
59
|
+
return EndUserContext.new(@version, sid, )
|
60
|
+
end
|
61
|
+
|
62
|
+
@end_users ||= EndUserList.new(@version, )
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Access the end_user_types
|
67
|
+
# @param [String] sid The unique string that identifies the End-User Type
|
68
|
+
# resource.
|
69
|
+
# @return [EndUserTypeList]
|
70
|
+
# @return [EndUserTypeContext] if sid was passed.
|
71
|
+
def end_user_types(sid=:unset)
|
72
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
73
|
+
|
74
|
+
if sid != :unset
|
75
|
+
return EndUserTypeContext.new(@version, sid, )
|
76
|
+
end
|
77
|
+
|
78
|
+
@end_user_types ||= EndUserTypeList.new(@version, )
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Access the regulations
|
83
|
+
# @param [String] sid The unique string that identifies the Regulation resource.
|
84
|
+
# @return [RegulationList]
|
85
|
+
# @return [RegulationContext] if sid was passed.
|
86
|
+
def regulations(sid=:unset)
|
87
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
88
|
+
|
89
|
+
if sid != :unset
|
90
|
+
return RegulationContext.new(@version, sid, )
|
91
|
+
end
|
92
|
+
|
93
|
+
@regulations ||= RegulationList.new(@version, )
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Access the supporting_documents
|
98
|
+
# @param [String] sid The unique string that we created to identify the Supporting
|
99
|
+
# Document resource.
|
100
|
+
# @return [SupportingDocumentList]
|
101
|
+
# @return [SupportingDocumentContext] if sid was passed.
|
102
|
+
def supporting_documents(sid=:unset)
|
103
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
104
|
+
|
105
|
+
if sid != :unset
|
106
|
+
return SupportingDocumentContext.new(@version, sid, )
|
107
|
+
end
|
108
|
+
|
109
|
+
@supporting_documents ||= SupportingDocumentList.new(@version, )
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Access the supporting_document_types
|
114
|
+
# @param [String] sid The unique string that identifies the Supporting Document
|
115
|
+
# Type resource.
|
116
|
+
# @return [SupportingDocumentTypeList]
|
117
|
+
# @return [SupportingDocumentTypeContext] if sid was passed.
|
118
|
+
def supporting_document_types(sid=:unset)
|
119
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
120
|
+
|
121
|
+
if sid != :unset
|
122
|
+
return SupportingDocumentTypeContext.new(@version, sid, )
|
123
|
+
end
|
124
|
+
|
125
|
+
@supporting_document_types ||= SupportingDocumentTypeList.new(@version, )
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Provide a user friendly representation
|
130
|
+
def to_s
|
131
|
+
'#<Twilio.Numbers.V2.RegulatoryComplianceList>'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class RegulatoryCompliancePage < Page
|
136
|
+
##
|
137
|
+
# Initialize the RegulatoryCompliancePage
|
138
|
+
# @param [Version] version Version that contains the resource
|
139
|
+
# @param [Response] response Response from the API
|
140
|
+
# @param [Hash] solution Path solution for the resource
|
141
|
+
# @return [RegulatoryCompliancePage] RegulatoryCompliancePage
|
142
|
+
def initialize(version, response, solution)
|
143
|
+
super(version, response)
|
144
|
+
|
145
|
+
# Path Solution
|
146
|
+
@solution = solution
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Build an instance of RegulatoryComplianceInstance
|
151
|
+
# @param [Hash] payload Payload response from the API
|
152
|
+
# @return [RegulatoryComplianceInstance] RegulatoryComplianceInstance
|
153
|
+
def get_instance(payload)
|
154
|
+
RegulatoryComplianceInstance.new(@version, payload, )
|
155
|
+
end
|
156
|
+
|
157
|
+
##
|
158
|
+
# Provide a user friendly representation
|
159
|
+
def to_s
|
160
|
+
'<Twilio.Numbers.V2.RegulatoryCompliancePage>'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class RegulatoryComplianceInstance < InstanceResource
|
165
|
+
##
|
166
|
+
# Initialize the RegulatoryComplianceInstance
|
167
|
+
# @param [Version] version Version that contains the resource
|
168
|
+
# @param [Hash] payload payload that contains response from Twilio
|
169
|
+
# @return [RegulatoryComplianceInstance] RegulatoryComplianceInstance
|
170
|
+
def initialize(version, payload)
|
171
|
+
super(version)
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Provide a user friendly representation
|
176
|
+
def to_s
|
177
|
+
"<Twilio.Numbers.V2.RegulatoryComplianceInstance>"
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Provide a detailed, user friendly representation
|
182
|
+
def inspect
|
183
|
+
"<Twilio.Numbers.V2.RegulatoryComplianceInstance>"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,482 @@
|
|
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 BundleList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the BundleList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @return [BundleList] BundleList
|
19
|
+
def initialize(version)
|
20
|
+
super(version)
|
21
|
+
|
22
|
+
# Path Solution
|
23
|
+
@solution = {}
|
24
|
+
@uri = "/RegulatoryCompliance/Bundles"
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Retrieve a single page of BundleInstance records from the API.
|
29
|
+
# Request is executed immediately.
|
30
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
31
|
+
# resource.
|
32
|
+
# @param [String] email The email address that will receive updates when the
|
33
|
+
# Bundle resource changes status.
|
34
|
+
# @param [String] status_callback The URL we call to inform your application of
|
35
|
+
# status changes.
|
36
|
+
# @param [String] regulation_sid The unique string of a regulation that is
|
37
|
+
# associated to the Bundle resource.
|
38
|
+
# @param [String] iso_country The ISO country code of the Bundle's phone number
|
39
|
+
# country ownership request.
|
40
|
+
# @param [bundle.EndUserType] end_user_type The type of End User of the Bundle
|
41
|
+
# resource.
|
42
|
+
# @param [String] number_type The type of phone number of the Bundle's ownership
|
43
|
+
# request.
|
44
|
+
# @return [BundleInstance] Newly created BundleInstance
|
45
|
+
def create(friendly_name: nil, email: nil, status_callback: :unset, regulation_sid: :unset, iso_country: :unset, end_user_type: :unset, number_type: :unset)
|
46
|
+
data = Twilio::Values.of({
|
47
|
+
'FriendlyName' => friendly_name,
|
48
|
+
'Email' => email,
|
49
|
+
'StatusCallback' => status_callback,
|
50
|
+
'RegulationSid' => regulation_sid,
|
51
|
+
'IsoCountry' => iso_country,
|
52
|
+
'EndUserType' => end_user_type,
|
53
|
+
'NumberType' => number_type,
|
54
|
+
})
|
55
|
+
|
56
|
+
payload = @version.create(
|
57
|
+
'POST',
|
58
|
+
@uri,
|
59
|
+
data: data
|
60
|
+
)
|
61
|
+
|
62
|
+
BundleInstance.new(@version, payload, )
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Lists BundleInstance records from the API as a list.
|
67
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
68
|
+
# memory before returning.
|
69
|
+
# @param [bundle.Status] status The verification status of the Bundle resource.
|
70
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
71
|
+
# resource.
|
72
|
+
# @param [String] regulation_sid The unique string of a regulation that is
|
73
|
+
# associated to the Bundle resource.
|
74
|
+
# @param [String] iso_country The ISO country code of the Bundle's phone number
|
75
|
+
# country ownership request.
|
76
|
+
# @param [String] number_type The type of phone number of the Bundle's ownership
|
77
|
+
# request.
|
78
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
79
|
+
# guarantees to never return more than limit. Default is no limit
|
80
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
81
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
82
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
83
|
+
# efficient page size, i.e. min(limit, 1000)
|
84
|
+
# @return [Array] Array of up to limit results
|
85
|
+
def list(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
|
86
|
+
self.stream(
|
87
|
+
status: status,
|
88
|
+
friendly_name: friendly_name,
|
89
|
+
regulation_sid: regulation_sid,
|
90
|
+
iso_country: iso_country,
|
91
|
+
number_type: number_type,
|
92
|
+
limit: limit,
|
93
|
+
page_size: page_size
|
94
|
+
).entries
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Streams BundleInstance records from the API as an Enumerable.
|
99
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
100
|
+
# is reached.
|
101
|
+
# @param [bundle.Status] status The verification status of the Bundle resource.
|
102
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
103
|
+
# resource.
|
104
|
+
# @param [String] regulation_sid The unique string of a regulation that is
|
105
|
+
# associated to the Bundle resource.
|
106
|
+
# @param [String] iso_country The ISO country code of the Bundle's phone number
|
107
|
+
# country ownership request.
|
108
|
+
# @param [String] number_type The type of phone number of the Bundle's ownership
|
109
|
+
# request.
|
110
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
111
|
+
# guarantees to never return more than limit. Default is no limit.
|
112
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
113
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
114
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
115
|
+
# efficient page size, i.e. min(limit, 1000)
|
116
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
117
|
+
def stream(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
|
118
|
+
limits = @version.read_limits(limit, page_size)
|
119
|
+
|
120
|
+
page = self.page(
|
121
|
+
status: status,
|
122
|
+
friendly_name: friendly_name,
|
123
|
+
regulation_sid: regulation_sid,
|
124
|
+
iso_country: iso_country,
|
125
|
+
number_type: number_type,
|
126
|
+
page_size: limits[:page_size],
|
127
|
+
)
|
128
|
+
|
129
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
130
|
+
end
|
131
|
+
|
132
|
+
##
|
133
|
+
# When passed a block, yields BundleInstance records from the API.
|
134
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
135
|
+
# is reached.
|
136
|
+
def each
|
137
|
+
limits = @version.read_limits
|
138
|
+
|
139
|
+
page = self.page(page_size: limits[:page_size], )
|
140
|
+
|
141
|
+
@version.stream(page,
|
142
|
+
limit: limits[:limit],
|
143
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# Retrieve a single page of BundleInstance records from the API.
|
148
|
+
# Request is executed immediately.
|
149
|
+
# @param [bundle.Status] status The verification status of the Bundle resource.
|
150
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
151
|
+
# resource.
|
152
|
+
# @param [String] regulation_sid The unique string of a regulation that is
|
153
|
+
# associated to the Bundle resource.
|
154
|
+
# @param [String] iso_country The ISO country code of the Bundle's phone number
|
155
|
+
# country ownership request.
|
156
|
+
# @param [String] number_type The type of phone number of the Bundle's ownership
|
157
|
+
# request.
|
158
|
+
# @param [String] page_token PageToken provided by the API
|
159
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
160
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
161
|
+
# @return [Page] Page of BundleInstance
|
162
|
+
def page(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
163
|
+
params = Twilio::Values.of({
|
164
|
+
'Status' => status,
|
165
|
+
'FriendlyName' => friendly_name,
|
166
|
+
'RegulationSid' => regulation_sid,
|
167
|
+
'IsoCountry' => iso_country,
|
168
|
+
'NumberType' => number_type,
|
169
|
+
'PageToken' => page_token,
|
170
|
+
'Page' => page_number,
|
171
|
+
'PageSize' => page_size,
|
172
|
+
})
|
173
|
+
response = @version.page(
|
174
|
+
'GET',
|
175
|
+
@uri,
|
176
|
+
params
|
177
|
+
)
|
178
|
+
BundlePage.new(@version, response, @solution)
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# Retrieve a single page of BundleInstance records from the API.
|
183
|
+
# Request is executed immediately.
|
184
|
+
# @param [String] target_url API-generated URL for the requested results page
|
185
|
+
# @return [Page] Page of BundleInstance
|
186
|
+
def get_page(target_url)
|
187
|
+
response = @version.domain.request(
|
188
|
+
'GET',
|
189
|
+
target_url
|
190
|
+
)
|
191
|
+
BundlePage.new(@version, response, @solution)
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# Provide a user friendly representation
|
196
|
+
def to_s
|
197
|
+
'#<Twilio.Numbers.V2.BundleList>'
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
class BundlePage < Page
|
202
|
+
##
|
203
|
+
# Initialize the BundlePage
|
204
|
+
# @param [Version] version Version that contains the resource
|
205
|
+
# @param [Response] response Response from the API
|
206
|
+
# @param [Hash] solution Path solution for the resource
|
207
|
+
# @return [BundlePage] BundlePage
|
208
|
+
def initialize(version, response, solution)
|
209
|
+
super(version, response)
|
210
|
+
|
211
|
+
# Path Solution
|
212
|
+
@solution = solution
|
213
|
+
end
|
214
|
+
|
215
|
+
##
|
216
|
+
# Build an instance of BundleInstance
|
217
|
+
# @param [Hash] payload Payload response from the API
|
218
|
+
# @return [BundleInstance] BundleInstance
|
219
|
+
def get_instance(payload)
|
220
|
+
BundleInstance.new(@version, payload, )
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Provide a user friendly representation
|
225
|
+
def to_s
|
226
|
+
'<Twilio.Numbers.V2.BundlePage>'
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
class BundleContext < InstanceContext
|
231
|
+
##
|
232
|
+
# Initialize the BundleContext
|
233
|
+
# @param [Version] version Version that contains the resource
|
234
|
+
# @param [String] sid The unique string that we created to identify the Bundle
|
235
|
+
# resource.
|
236
|
+
# @return [BundleContext] BundleContext
|
237
|
+
def initialize(version, sid)
|
238
|
+
super(version)
|
239
|
+
|
240
|
+
# Path Solution
|
241
|
+
@solution = {sid: sid, }
|
242
|
+
@uri = "/RegulatoryCompliance/Bundles/#{@solution[:sid]}"
|
243
|
+
|
244
|
+
# Dependents
|
245
|
+
@item_assignments = nil
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Fetch a BundleInstance
|
250
|
+
# @return [BundleInstance] Fetched BundleInstance
|
251
|
+
def fetch
|
252
|
+
params = Twilio::Values.of({})
|
253
|
+
|
254
|
+
payload = @version.fetch(
|
255
|
+
'GET',
|
256
|
+
@uri,
|
257
|
+
params,
|
258
|
+
)
|
259
|
+
|
260
|
+
BundleInstance.new(@version, payload, sid: @solution[:sid], )
|
261
|
+
end
|
262
|
+
|
263
|
+
##
|
264
|
+
# Update the BundleInstance
|
265
|
+
# @param [bundle.Status] status The verification status of the Bundle resource.
|
266
|
+
# @param [String] status_callback The URL we call to inform your application of
|
267
|
+
# status changes.
|
268
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
269
|
+
# resource.
|
270
|
+
# @param [String] email The email address that will receive updates when the
|
271
|
+
# Bundle resource changes status.
|
272
|
+
# @return [BundleInstance] Updated BundleInstance
|
273
|
+
def update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset)
|
274
|
+
data = Twilio::Values.of({
|
275
|
+
'Status' => status,
|
276
|
+
'StatusCallback' => status_callback,
|
277
|
+
'FriendlyName' => friendly_name,
|
278
|
+
'Email' => email,
|
279
|
+
})
|
280
|
+
|
281
|
+
payload = @version.update(
|
282
|
+
'POST',
|
283
|
+
@uri,
|
284
|
+
data: data,
|
285
|
+
)
|
286
|
+
|
287
|
+
BundleInstance.new(@version, payload, sid: @solution[:sid], )
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# Access the item_assignments
|
292
|
+
# @return [ItemAssignmentList]
|
293
|
+
# @return [ItemAssignmentContext] if sid was passed.
|
294
|
+
def item_assignments(sid=:unset)
|
295
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
296
|
+
|
297
|
+
if sid != :unset
|
298
|
+
return ItemAssignmentContext.new(@version, @solution[:sid], sid, )
|
299
|
+
end
|
300
|
+
|
301
|
+
unless @item_assignments
|
302
|
+
@item_assignments = ItemAssignmentList.new(@version, bundle_sid: @solution[:sid], )
|
303
|
+
end
|
304
|
+
|
305
|
+
@item_assignments
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# Provide a user friendly representation
|
310
|
+
def to_s
|
311
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
312
|
+
"#<Twilio.Numbers.V2.BundleContext #{context}>"
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# Provide a detailed, user friendly representation
|
317
|
+
def inspect
|
318
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
319
|
+
"#<Twilio.Numbers.V2.BundleContext #{context}>"
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
class BundleInstance < InstanceResource
|
324
|
+
##
|
325
|
+
# Initialize the BundleInstance
|
326
|
+
# @param [Version] version Version that contains the resource
|
327
|
+
# @param [Hash] payload payload that contains response from Twilio
|
328
|
+
# @param [String] sid The unique string that we created to identify the Bundle
|
329
|
+
# resource.
|
330
|
+
# @return [BundleInstance] BundleInstance
|
331
|
+
def initialize(version, payload, sid: nil)
|
332
|
+
super(version)
|
333
|
+
|
334
|
+
# Marshaled Properties
|
335
|
+
@properties = {
|
336
|
+
'sid' => payload['sid'],
|
337
|
+
'account_sid' => payload['account_sid'],
|
338
|
+
'regulation_sid' => payload['regulation_sid'],
|
339
|
+
'friendly_name' => payload['friendly_name'],
|
340
|
+
'status' => payload['status'],
|
341
|
+
'email' => payload['email'],
|
342
|
+
'status_callback' => payload['status_callback'],
|
343
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
344
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
345
|
+
'url' => payload['url'],
|
346
|
+
'links' => payload['links'],
|
347
|
+
}
|
348
|
+
|
349
|
+
# Context
|
350
|
+
@instance_context = nil
|
351
|
+
@params = {'sid' => sid || @properties['sid'], }
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# Generate an instance context for the instance, the context is capable of
|
356
|
+
# performing various actions. All instance actions are proxied to the context
|
357
|
+
# @return [BundleContext] BundleContext for this BundleInstance
|
358
|
+
def context
|
359
|
+
unless @instance_context
|
360
|
+
@instance_context = BundleContext.new(@version, @params['sid'], )
|
361
|
+
end
|
362
|
+
@instance_context
|
363
|
+
end
|
364
|
+
|
365
|
+
##
|
366
|
+
# @return [String] The unique string that identifies the resource.
|
367
|
+
def sid
|
368
|
+
@properties['sid']
|
369
|
+
end
|
370
|
+
|
371
|
+
##
|
372
|
+
# @return [String] The SID of the Account that created the resource
|
373
|
+
def account_sid
|
374
|
+
@properties['account_sid']
|
375
|
+
end
|
376
|
+
|
377
|
+
##
|
378
|
+
# @return [String] The unique string of a regulation.
|
379
|
+
def regulation_sid
|
380
|
+
@properties['regulation_sid']
|
381
|
+
end
|
382
|
+
|
383
|
+
##
|
384
|
+
# @return [String] The string that you assigned to describe the resource
|
385
|
+
def friendly_name
|
386
|
+
@properties['friendly_name']
|
387
|
+
end
|
388
|
+
|
389
|
+
##
|
390
|
+
# @return [bundle.Status] The verification status of the Bundle resource
|
391
|
+
def status
|
392
|
+
@properties['status']
|
393
|
+
end
|
394
|
+
|
395
|
+
##
|
396
|
+
# @return [String] The email address
|
397
|
+
def email
|
398
|
+
@properties['email']
|
399
|
+
end
|
400
|
+
|
401
|
+
##
|
402
|
+
# @return [String] The URL we call to inform your application of status changes.
|
403
|
+
def status_callback
|
404
|
+
@properties['status_callback']
|
405
|
+
end
|
406
|
+
|
407
|
+
##
|
408
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
409
|
+
def date_created
|
410
|
+
@properties['date_created']
|
411
|
+
end
|
412
|
+
|
413
|
+
##
|
414
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
|
415
|
+
def date_updated
|
416
|
+
@properties['date_updated']
|
417
|
+
end
|
418
|
+
|
419
|
+
##
|
420
|
+
# @return [String] The absolute URL of the Bundle resource
|
421
|
+
def url
|
422
|
+
@properties['url']
|
423
|
+
end
|
424
|
+
|
425
|
+
##
|
426
|
+
# @return [String] The URLs of the Assigned Items of the Bundle resource
|
427
|
+
def links
|
428
|
+
@properties['links']
|
429
|
+
end
|
430
|
+
|
431
|
+
##
|
432
|
+
# Fetch a BundleInstance
|
433
|
+
# @return [BundleInstance] Fetched BundleInstance
|
434
|
+
def fetch
|
435
|
+
context.fetch
|
436
|
+
end
|
437
|
+
|
438
|
+
##
|
439
|
+
# Update the BundleInstance
|
440
|
+
# @param [bundle.Status] status The verification status of the Bundle resource.
|
441
|
+
# @param [String] status_callback The URL we call to inform your application of
|
442
|
+
# status changes.
|
443
|
+
# @param [String] friendly_name The string that you assigned to describe the
|
444
|
+
# resource.
|
445
|
+
# @param [String] email The email address that will receive updates when the
|
446
|
+
# Bundle resource changes status.
|
447
|
+
# @return [BundleInstance] Updated BundleInstance
|
448
|
+
def update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset)
|
449
|
+
context.update(
|
450
|
+
status: status,
|
451
|
+
status_callback: status_callback,
|
452
|
+
friendly_name: friendly_name,
|
453
|
+
email: email,
|
454
|
+
)
|
455
|
+
end
|
456
|
+
|
457
|
+
##
|
458
|
+
# Access the item_assignments
|
459
|
+
# @return [item_assignments] item_assignments
|
460
|
+
def item_assignments
|
461
|
+
context.item_assignments
|
462
|
+
end
|
463
|
+
|
464
|
+
##
|
465
|
+
# Provide a user friendly representation
|
466
|
+
def to_s
|
467
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
468
|
+
"<Twilio.Numbers.V2.BundleInstance #{values}>"
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Provide a detailed, user friendly representation
|
473
|
+
def inspect
|
474
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
475
|
+
"<Twilio.Numbers.V2.BundleInstance #{values}>"
|
476
|
+
end
|
477
|
+
end
|
478
|
+
end
|
479
|
+
end
|
480
|
+
end
|
481
|
+
end
|
482
|
+
end
|