twilio-ruby 6.1.0 → 6.2.0

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.
@@ -0,0 +1,229 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Numbers
8
+ # This is the public Twilio REST API.
9
+ #
10
+ # NOTE: This class is auto generated by OpenAPI Generator.
11
+ # https://openapi-generator.tech
12
+ # Do not edit the class manually.
13
+ #
14
+
15
+
16
+ module Twilio
17
+ module REST
18
+ class Numbers < NumbersBase
19
+ class V1 < Version
20
+ class PortingBulkPortabilityList < ListResource
21
+ ##
22
+ # Initialize the PortingBulkPortabilityList
23
+ # @param [Version] version Version that contains the resource
24
+ # @return [PortingBulkPortabilityList] PortingBulkPortabilityList
25
+ def initialize(version)
26
+ super(version)
27
+ # Path Solution
28
+ @solution = { }
29
+ @uri = "/Porting/Portability"
30
+
31
+ end
32
+ ##
33
+ # Create the PortingBulkPortabilityInstance
34
+ # @param [Array[String]] phone_numbers The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). .
35
+ # @return [PortingBulkPortabilityInstance] Created PortingBulkPortabilityInstance
36
+ def create(
37
+ phone_numbers: nil
38
+ )
39
+
40
+ data = Twilio::Values.of({
41
+ 'PhoneNumbers' => Twilio.serialize_list(phone_numbers) { |e| e },
42
+ })
43
+
44
+ payload = @version.create('POST', @uri, data: data)
45
+ PortingBulkPortabilityInstance.new(
46
+ @version,
47
+ payload,
48
+ )
49
+ end
50
+
51
+
52
+
53
+
54
+ # Provide a user friendly representation
55
+ def to_s
56
+ '#<Twilio.Numbers.V1.PortingBulkPortabilityList>'
57
+ end
58
+ end
59
+
60
+
61
+ ##
62
+ #PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
63
+ class PortingBulkPortabilityContext < InstanceContext
64
+ ##
65
+ # Initialize the PortingBulkPortabilityContext
66
+ # @param [Version] version Version that contains the resource
67
+ # @param [String] sid A 34 character string that uniquely identifies the Portability check.
68
+ # @return [PortingBulkPortabilityContext] PortingBulkPortabilityContext
69
+ def initialize(version, sid)
70
+ super(version)
71
+
72
+ # Path Solution
73
+ @solution = { sid: sid, }
74
+ @uri = "/Porting/Portability/#{@solution[:sid]}"
75
+
76
+
77
+ end
78
+ ##
79
+ # Fetch the PortingBulkPortabilityInstance
80
+ # @return [PortingBulkPortabilityInstance] Fetched PortingBulkPortabilityInstance
81
+ def fetch
82
+
83
+ payload = @version.fetch('GET', @uri)
84
+ PortingBulkPortabilityInstance.new(
85
+ @version,
86
+ payload,
87
+ sid: @solution[:sid],
88
+ )
89
+ end
90
+
91
+
92
+ ##
93
+ # Provide a user friendly representation
94
+ def to_s
95
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
96
+ "#<Twilio.Numbers.V1.PortingBulkPortabilityContext #{context}>"
97
+ end
98
+
99
+ ##
100
+ # Provide a detailed, user friendly representation
101
+ def inspect
102
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
103
+ "#<Twilio.Numbers.V1.PortingBulkPortabilityContext #{context}>"
104
+ end
105
+ end
106
+
107
+ class PortingBulkPortabilityPage < Page
108
+ ##
109
+ # Initialize the PortingBulkPortabilityPage
110
+ # @param [Version] version Version that contains the resource
111
+ # @param [Response] response Response from the API
112
+ # @param [Hash] solution Path solution for the resource
113
+ # @return [PortingBulkPortabilityPage] PortingBulkPortabilityPage
114
+ def initialize(version, response, solution)
115
+ super(version, response)
116
+
117
+ # Path Solution
118
+ @solution = solution
119
+ end
120
+
121
+ ##
122
+ # Build an instance of PortingBulkPortabilityInstance
123
+ # @param [Hash] payload Payload response from the API
124
+ # @return [PortingBulkPortabilityInstance] PortingBulkPortabilityInstance
125
+ def get_instance(payload)
126
+ PortingBulkPortabilityInstance.new(@version, payload)
127
+ end
128
+
129
+ ##
130
+ # Provide a user friendly representation
131
+ def to_s
132
+ '<Twilio.Numbers.V1.PortingBulkPortabilityPage>'
133
+ end
134
+ end
135
+ class PortingBulkPortabilityInstance < InstanceResource
136
+ ##
137
+ # Initialize the PortingBulkPortabilityInstance
138
+ # @param [Version] version Version that contains the resource
139
+ # @param [Hash] payload payload that contains response from Twilio
140
+ # @param [String] account_sid The SID of the
141
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PortingBulkPortability
142
+ # resource.
143
+ # @param [String] sid The SID of the Call resource to fetch.
144
+ # @return [PortingBulkPortabilityInstance] PortingBulkPortabilityInstance
145
+ def initialize(version, payload , sid: nil)
146
+ super(version)
147
+
148
+ # Marshaled Properties
149
+ @properties = {
150
+ 'sid' => payload['sid'],
151
+ 'status' => payload['status'],
152
+ 'datetime_created' => Twilio.deserialize_iso8601_datetime(payload['datetime_created']),
153
+ 'phone_numbers' => payload['phone_numbers'],
154
+ 'url' => payload['url'],
155
+ }
156
+
157
+ # Context
158
+ @instance_context = nil
159
+ @params = { 'sid' => sid || @properties['sid'] , }
160
+ end
161
+
162
+ ##
163
+ # Generate an instance context for the instance, the context is capable of
164
+ # performing various actions. All instance actions are proxied to the context
165
+ # @return [PortingBulkPortabilityContext] CallContext for this CallInstance
166
+ def context
167
+ unless @instance_context
168
+ @instance_context = PortingBulkPortabilityContext.new(@version , @params['sid'])
169
+ end
170
+ @instance_context
171
+ end
172
+
173
+ ##
174
+ # @return [String] A 34 character string that uniquely identifies this Portability check.
175
+ def sid
176
+ @properties['sid']
177
+ end
178
+
179
+ ##
180
+ # @return [Status]
181
+ def status
182
+ @properties['status']
183
+ end
184
+
185
+ ##
186
+ # @return [Time] The date that the Portability check was created, given in ISO 8601 format.
187
+ def datetime_created
188
+ @properties['datetime_created']
189
+ end
190
+
191
+ ##
192
+ # @return [Array<Hash>] Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number.
193
+ def phone_numbers
194
+ @properties['phone_numbers']
195
+ end
196
+
197
+ ##
198
+ # @return [String] This is the url of the request that you're trying to reach out to locate the resource.
199
+ def url
200
+ @properties['url']
201
+ end
202
+
203
+ ##
204
+ # Fetch the PortingBulkPortabilityInstance
205
+ # @return [PortingBulkPortabilityInstance] Fetched PortingBulkPortabilityInstance
206
+ def fetch
207
+
208
+ context.fetch
209
+ end
210
+
211
+ ##
212
+ # Provide a user friendly representation
213
+ def to_s
214
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
215
+ "<Twilio.Numbers.V1.PortingBulkPortabilityInstance #{values}>"
216
+ end
217
+
218
+ ##
219
+ # Provide a detailed, user friendly representation
220
+ def inspect
221
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
222
+ "<Twilio.Numbers.V1.PortingBulkPortabilityInstance #{values}>"
223
+ end
224
+ end
225
+
226
+ end
227
+ end
228
+ end
229
+ end
@@ -0,0 +1,245 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Numbers
8
+ # This is the public Twilio REST API.
9
+ #
10
+ # NOTE: This class is auto generated by OpenAPI Generator.
11
+ # https://openapi-generator.tech
12
+ # Do not edit the class manually.
13
+ #
14
+
15
+
16
+ module Twilio
17
+ module REST
18
+ class Numbers < NumbersBase
19
+ class V1 < Version
20
+ class PortingPortabilityList < ListResource
21
+ ##
22
+ # Initialize the PortingPortabilityList
23
+ # @param [Version] version Version that contains the resource
24
+ # @return [PortingPortabilityList] PortingPortabilityList
25
+ def initialize(version)
26
+ super(version)
27
+ # Path Solution
28
+ @solution = { }
29
+
30
+
31
+ end
32
+
33
+
34
+
35
+ # Provide a user friendly representation
36
+ def to_s
37
+ '#<Twilio.Numbers.V1.PortingPortabilityList>'
38
+ end
39
+ end
40
+
41
+
42
+ ##
43
+ #PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
44
+ class PortingPortabilityContext < InstanceContext
45
+ ##
46
+ # Initialize the PortingPortabilityContext
47
+ # @param [Version] version Version that contains the resource
48
+ # @param [String] phone_number The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
49
+ # @return [PortingPortabilityContext] PortingPortabilityContext
50
+ def initialize(version, phone_number)
51
+ super(version)
52
+
53
+ # Path Solution
54
+ @solution = { phone_number: phone_number, }
55
+ @uri = "/Porting/Portability/PhoneNumber/#{CGI.escape(@solution[:phone_number]).gsub("+", "%20")}"
56
+
57
+
58
+ end
59
+ ##
60
+ # Fetch the PortingPortabilityInstance
61
+ # @return [PortingPortabilityInstance] Fetched PortingPortabilityInstance
62
+ def fetch
63
+
64
+ payload = @version.fetch('GET', @uri)
65
+ PortingPortabilityInstance.new(
66
+ @version,
67
+ payload,
68
+ phone_number: @solution[:phone_number],
69
+ )
70
+ end
71
+
72
+
73
+ ##
74
+ # Provide a user friendly representation
75
+ def to_s
76
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
77
+ "#<Twilio.Numbers.V1.PortingPortabilityContext #{context}>"
78
+ end
79
+
80
+ ##
81
+ # Provide a detailed, user friendly representation
82
+ def inspect
83
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
84
+ "#<Twilio.Numbers.V1.PortingPortabilityContext #{context}>"
85
+ end
86
+ end
87
+
88
+ class PortingPortabilityPage < Page
89
+ ##
90
+ # Initialize the PortingPortabilityPage
91
+ # @param [Version] version Version that contains the resource
92
+ # @param [Response] response Response from the API
93
+ # @param [Hash] solution Path solution for the resource
94
+ # @return [PortingPortabilityPage] PortingPortabilityPage
95
+ def initialize(version, response, solution)
96
+ super(version, response)
97
+
98
+ # Path Solution
99
+ @solution = solution
100
+ end
101
+
102
+ ##
103
+ # Build an instance of PortingPortabilityInstance
104
+ # @param [Hash] payload Payload response from the API
105
+ # @return [PortingPortabilityInstance] PortingPortabilityInstance
106
+ def get_instance(payload)
107
+ PortingPortabilityInstance.new(@version, payload)
108
+ end
109
+
110
+ ##
111
+ # Provide a user friendly representation
112
+ def to_s
113
+ '<Twilio.Numbers.V1.PortingPortabilityPage>'
114
+ end
115
+ end
116
+ class PortingPortabilityInstance < InstanceResource
117
+ ##
118
+ # Initialize the PortingPortabilityInstance
119
+ # @param [Version] version Version that contains the resource
120
+ # @param [Hash] payload payload that contains response from Twilio
121
+ # @param [String] account_sid The SID of the
122
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this PortingPortability
123
+ # resource.
124
+ # @param [String] sid The SID of the Call resource to fetch.
125
+ # @return [PortingPortabilityInstance] PortingPortabilityInstance
126
+ def initialize(version, payload , phone_number: nil)
127
+ super(version)
128
+
129
+ # Marshaled Properties
130
+ @properties = {
131
+ 'phone_number' => payload['phone_number'],
132
+ 'portable' => payload['portable'],
133
+ 'pin_and_account_number_required' => payload['pin_and_account_number_required'],
134
+ 'not_portable_reason' => payload['not_portable_reason'],
135
+ 'not_portable_reason_code' => payload['not_portable_reason_code'] == nil ? payload['not_portable_reason_code'] : payload['not_portable_reason_code'].to_i,
136
+ 'number_type' => payload['number_type'],
137
+ 'country' => payload['country'],
138
+ 'messaging_carrier' => payload['messaging_carrier'],
139
+ 'voice_carrier' => payload['voice_carrier'],
140
+ 'url' => payload['url'],
141
+ }
142
+
143
+ # Context
144
+ @instance_context = nil
145
+ @params = { 'phone_number' => phone_number || @properties['phone_number'] , }
146
+ end
147
+
148
+ ##
149
+ # Generate an instance context for the instance, the context is capable of
150
+ # performing various actions. All instance actions are proxied to the context
151
+ # @return [PortingPortabilityContext] CallContext for this CallInstance
152
+ def context
153
+ unless @instance_context
154
+ @instance_context = PortingPortabilityContext.new(@version , @params['phone_number'])
155
+ end
156
+ @instance_context
157
+ end
158
+
159
+ ##
160
+ # @return [String] The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
161
+ def phone_number
162
+ @properties['phone_number']
163
+ end
164
+
165
+ ##
166
+ # @return [Boolean] Boolean flag specifying if phone number is portable or not.
167
+ def portable
168
+ @properties['portable']
169
+ end
170
+
171
+ ##
172
+ # @return [Boolean] Boolean flag specifying if PIN and account number is required for the phone number.
173
+ def pin_and_account_number_required
174
+ @properties['pin_and_account_number_required']
175
+ end
176
+
177
+ ##
178
+ # @return [String] Reason why the phone number cannot be ported into Twilio, `null` otherwise.
179
+ def not_portable_reason
180
+ @properties['not_portable_reason']
181
+ end
182
+
183
+ ##
184
+ # @return [String] The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`.
185
+ def not_portable_reason_code
186
+ @properties['not_portable_reason_code']
187
+ end
188
+
189
+ ##
190
+ # @return [NumberType]
191
+ def number_type
192
+ @properties['number_type']
193
+ end
194
+
195
+ ##
196
+ # @return [String] Country the phone number belongs to.
197
+ def country
198
+ @properties['country']
199
+ end
200
+
201
+ ##
202
+ # @return [String] Current messaging carrier of the phone number
203
+ def messaging_carrier
204
+ @properties['messaging_carrier']
205
+ end
206
+
207
+ ##
208
+ # @return [String] Current voice carrier of the phone number
209
+ def voice_carrier
210
+ @properties['voice_carrier']
211
+ end
212
+
213
+ ##
214
+ # @return [String] This is the url of the request that you're trying to reach out to locate the resource.
215
+ def url
216
+ @properties['url']
217
+ end
218
+
219
+ ##
220
+ # Fetch the PortingPortabilityInstance
221
+ # @return [PortingPortabilityInstance] Fetched PortingPortabilityInstance
222
+ def fetch
223
+
224
+ context.fetch
225
+ end
226
+
227
+ ##
228
+ # Provide a user friendly representation
229
+ def to_s
230
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
231
+ "<Twilio.Numbers.V1.PortingPortabilityInstance #{values}>"
232
+ end
233
+
234
+ ##
235
+ # Provide a detailed, user friendly representation
236
+ def inspect
237
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
238
+ "<Twilio.Numbers.V1.PortingPortabilityInstance #{values}>"
239
+ end
240
+ end
241
+
242
+ end
243
+ end
244
+ end
245
+ end
@@ -22,6 +22,8 @@ module Twilio
22
22
  super
23
23
  @version = 'v1'
24
24
  @bulk_eligibilities = nil
25
+ @porting_bulk_portabilities = nil
26
+ @porting_portabilities = nil
25
27
  end
26
28
 
27
29
  ##
@@ -39,6 +41,34 @@ module Twilio
39
41
  end
40
42
  end
41
43
  ##
44
+ # @param [String] sid A 34 character string that uniquely identifies the Portability check.
45
+ # @return [Twilio::REST::Numbers::V1::PortingBulkPortabilityContext] if sid was passed.
46
+ # @return [Twilio::REST::Numbers::V1::PortingBulkPortabilityList]
47
+ def porting_bulk_portabilities(sid=:unset)
48
+ if sid.nil?
49
+ raise ArgumentError, 'sid cannot be nil'
50
+ end
51
+ if sid == :unset
52
+ @porting_bulk_portabilities ||= PortingBulkPortabilityList.new self
53
+ else
54
+ PortingBulkPortabilityContext.new(self, sid)
55
+ end
56
+ end
57
+ ##
58
+ # @param [String] phone_number The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
59
+ # @return [Twilio::REST::Numbers::V1::PortingPortabilityContext] if phoneNumber was passed.
60
+ # @return [Twilio::REST::Numbers::V1::PortingPortabilityList]
61
+ def porting_portabilities(phone_number=:unset)
62
+ if phone_number.nil?
63
+ raise ArgumentError, 'phone_number cannot be nil'
64
+ end
65
+ if phone_number == :unset
66
+ @porting_portabilities ||= PortingPortabilityList.new self
67
+ else
68
+ PortingPortabilityContext.new(self, phone_number)
69
+ end
70
+ end
71
+ ##
42
72
  # Provide a user friendly representation
43
73
  def to_s
44
74
  '<Twilio::REST::Numbers::V1>';