twilio-ruby 5.5.1 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +18 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +96 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +396 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +396 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +396 -0
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +396 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +4 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +15 -15
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +7 -1
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +17 -10
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +41 -3
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +6 -6
- data/lib/twilio-ruby/twiml/messaging_response.rb +3 -2
- data/lib/twilio-ruby/twiml/voice_response.rb +10 -6
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/available_phone_number/machine_to_machine_spec.rb +101 -0
- data/spec/integration/api/v2010/account/available_phone_number/national_spec.rb +101 -0
- data/spec/integration/api/v2010/account/available_phone_number/shared_cost_spec.rb +101 -0
- data/spec/integration/api/v2010/account/available_phone_number/voip_spec.rb +101 -0
- data/spec/integration/api/v2010/account/call/recording_spec.rb +28 -28
- data/spec/integration/api/v2010/account/conference_spec.rb +6 -3
- data/spec/integration/api/v2010/account/recording_spec.rb +32 -24
- data/spec/integration/notify/v1/service_spec.rb +4 -0
- data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +50 -5
- data/spec/integration/proxy/v1/service/session_spec.rb +3 -3
- metadata +14 -2
@@ -0,0 +1,396 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module REST
|
9
|
+
class Api < Domain
|
10
|
+
class V2010 < Version
|
11
|
+
class AccountContext < InstanceContext
|
12
|
+
class AvailablePhoneNumberCountryContext < InstanceContext
|
13
|
+
class NationalList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the NationalList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @param [String] account_sid The 34 character string that uniquely identifies
|
18
|
+
# your account.
|
19
|
+
# @param [String] country_code The ISO Country code to lookup phone numbers for.
|
20
|
+
# @return [NationalList] NationalList
|
21
|
+
def initialize(version, account_sid: nil, country_code: nil)
|
22
|
+
super(version)
|
23
|
+
|
24
|
+
# Path Solution
|
25
|
+
@solution = {account_sid: account_sid, country_code: country_code}
|
26
|
+
@uri = "/Accounts/#{@solution[:account_sid]}/AvailablePhoneNumbers/#{@solution[:country_code]}/National.json"
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Lists NationalInstance records from the API as a list.
|
31
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
32
|
+
# memory before returning.
|
33
|
+
# @param [String] area_code The area_code
|
34
|
+
# @param [String] contains The contains
|
35
|
+
# @param [Boolean] sms_enabled The sms_enabled
|
36
|
+
# @param [Boolean] mms_enabled The mms_enabled
|
37
|
+
# @param [Boolean] voice_enabled The voice_enabled
|
38
|
+
# @param [Boolean] exclude_all_address_required The exclude_all_address_required
|
39
|
+
# @param [Boolean] exclude_local_address_required The
|
40
|
+
# exclude_local_address_required
|
41
|
+
# @param [Boolean] exclude_foreign_address_required The
|
42
|
+
# exclude_foreign_address_required
|
43
|
+
# @param [Boolean] beta The beta
|
44
|
+
# @param [String] near_number The near_number
|
45
|
+
# @param [String] near_lat_long The near_lat_long
|
46
|
+
# @param [String] distance The distance
|
47
|
+
# @param [String] in_postal_code The in_postal_code
|
48
|
+
# @param [String] in_region The in_region
|
49
|
+
# @param [String] in_rate_center The in_rate_center
|
50
|
+
# @param [String] in_lata The in_lata
|
51
|
+
# @param [String] in_locality The in_locality
|
52
|
+
# @param [Boolean] fax_enabled The fax_enabled
|
53
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
54
|
+
# guarantees to never return more than limit. Default is no limit
|
55
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
56
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
57
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
58
|
+
# efficient page size, i.e. min(limit, 1000)
|
59
|
+
# @return [Array] Array of up to limit results
|
60
|
+
def list(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil)
|
61
|
+
self.stream(
|
62
|
+
area_code: area_code,
|
63
|
+
contains: contains,
|
64
|
+
sms_enabled: sms_enabled,
|
65
|
+
mms_enabled: mms_enabled,
|
66
|
+
voice_enabled: voice_enabled,
|
67
|
+
exclude_all_address_required: exclude_all_address_required,
|
68
|
+
exclude_local_address_required: exclude_local_address_required,
|
69
|
+
exclude_foreign_address_required: exclude_foreign_address_required,
|
70
|
+
beta: beta,
|
71
|
+
near_number: near_number,
|
72
|
+
near_lat_long: near_lat_long,
|
73
|
+
distance: distance,
|
74
|
+
in_postal_code: in_postal_code,
|
75
|
+
in_region: in_region,
|
76
|
+
in_rate_center: in_rate_center,
|
77
|
+
in_lata: in_lata,
|
78
|
+
in_locality: in_locality,
|
79
|
+
fax_enabled: fax_enabled,
|
80
|
+
limit: limit,
|
81
|
+
page_size: page_size
|
82
|
+
).entries
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Streams NationalInstance records from the API as an Enumerable.
|
87
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
88
|
+
# is reached.
|
89
|
+
# @param [String] area_code The area_code
|
90
|
+
# @param [String] contains The contains
|
91
|
+
# @param [Boolean] sms_enabled The sms_enabled
|
92
|
+
# @param [Boolean] mms_enabled The mms_enabled
|
93
|
+
# @param [Boolean] voice_enabled The voice_enabled
|
94
|
+
# @param [Boolean] exclude_all_address_required The exclude_all_address_required
|
95
|
+
# @param [Boolean] exclude_local_address_required The
|
96
|
+
# exclude_local_address_required
|
97
|
+
# @param [Boolean] exclude_foreign_address_required The
|
98
|
+
# exclude_foreign_address_required
|
99
|
+
# @param [Boolean] beta The beta
|
100
|
+
# @param [String] near_number The near_number
|
101
|
+
# @param [String] near_lat_long The near_lat_long
|
102
|
+
# @param [String] distance The distance
|
103
|
+
# @param [String] in_postal_code The in_postal_code
|
104
|
+
# @param [String] in_region The in_region
|
105
|
+
# @param [String] in_rate_center The in_rate_center
|
106
|
+
# @param [String] in_lata The in_lata
|
107
|
+
# @param [String] in_locality The in_locality
|
108
|
+
# @param [Boolean] fax_enabled The fax_enabled
|
109
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
110
|
+
# guarantees to never return more than limit. Default is no limit.
|
111
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
112
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
113
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
114
|
+
# efficient page size, i.e. min(limit, 1000)
|
115
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
116
|
+
def stream(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil)
|
117
|
+
limits = @version.read_limits(limit, page_size)
|
118
|
+
|
119
|
+
page = self.page(
|
120
|
+
area_code: area_code,
|
121
|
+
contains: contains,
|
122
|
+
sms_enabled: sms_enabled,
|
123
|
+
mms_enabled: mms_enabled,
|
124
|
+
voice_enabled: voice_enabled,
|
125
|
+
exclude_all_address_required: exclude_all_address_required,
|
126
|
+
exclude_local_address_required: exclude_local_address_required,
|
127
|
+
exclude_foreign_address_required: exclude_foreign_address_required,
|
128
|
+
beta: beta,
|
129
|
+
near_number: near_number,
|
130
|
+
near_lat_long: near_lat_long,
|
131
|
+
distance: distance,
|
132
|
+
in_postal_code: in_postal_code,
|
133
|
+
in_region: in_region,
|
134
|
+
in_rate_center: in_rate_center,
|
135
|
+
in_lata: in_lata,
|
136
|
+
in_locality: in_locality,
|
137
|
+
fax_enabled: fax_enabled,
|
138
|
+
page_size: limits[:page_size],
|
139
|
+
)
|
140
|
+
|
141
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# When passed a block, yields NationalInstance records from the API.
|
146
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
147
|
+
# is reached.
|
148
|
+
def each
|
149
|
+
limits = @version.read_limits
|
150
|
+
|
151
|
+
page = self.page(page_size: limits[:page_size])
|
152
|
+
|
153
|
+
@version.stream(page,
|
154
|
+
limit: limits[:limit],
|
155
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Retrieve a single page of NationalInstance records from the API.
|
160
|
+
# Request is executed immediately.
|
161
|
+
# @param [String] area_code The area_code
|
162
|
+
# @param [String] contains The contains
|
163
|
+
# @param [Boolean] sms_enabled The sms_enabled
|
164
|
+
# @param [Boolean] mms_enabled The mms_enabled
|
165
|
+
# @param [Boolean] voice_enabled The voice_enabled
|
166
|
+
# @param [Boolean] exclude_all_address_required The exclude_all_address_required
|
167
|
+
# @param [Boolean] exclude_local_address_required The
|
168
|
+
# exclude_local_address_required
|
169
|
+
# @param [Boolean] exclude_foreign_address_required The
|
170
|
+
# exclude_foreign_address_required
|
171
|
+
# @param [Boolean] beta The beta
|
172
|
+
# @param [String] near_number The near_number
|
173
|
+
# @param [String] near_lat_long The near_lat_long
|
174
|
+
# @param [String] distance The distance
|
175
|
+
# @param [String] in_postal_code The in_postal_code
|
176
|
+
# @param [String] in_region The in_region
|
177
|
+
# @param [String] in_rate_center The in_rate_center
|
178
|
+
# @param [String] in_lata The in_lata
|
179
|
+
# @param [String] in_locality The in_locality
|
180
|
+
# @param [Boolean] fax_enabled The fax_enabled
|
181
|
+
# @param [String] page_token PageToken provided by the API
|
182
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
183
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
184
|
+
# @return [Page] Page of NationalInstance
|
185
|
+
def page(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
186
|
+
params = Twilio::Values.of({
|
187
|
+
'AreaCode' => area_code,
|
188
|
+
'Contains' => contains,
|
189
|
+
'SmsEnabled' => sms_enabled,
|
190
|
+
'MmsEnabled' => mms_enabled,
|
191
|
+
'VoiceEnabled' => voice_enabled,
|
192
|
+
'ExcludeAllAddressRequired' => exclude_all_address_required,
|
193
|
+
'ExcludeLocalAddressRequired' => exclude_local_address_required,
|
194
|
+
'ExcludeForeignAddressRequired' => exclude_foreign_address_required,
|
195
|
+
'Beta' => beta,
|
196
|
+
'NearNumber' => near_number,
|
197
|
+
'NearLatLong' => near_lat_long,
|
198
|
+
'Distance' => distance,
|
199
|
+
'InPostalCode' => in_postal_code,
|
200
|
+
'InRegion' => in_region,
|
201
|
+
'InRateCenter' => in_rate_center,
|
202
|
+
'InLata' => in_lata,
|
203
|
+
'InLocality' => in_locality,
|
204
|
+
'FaxEnabled' => fax_enabled,
|
205
|
+
'PageToken' => page_token,
|
206
|
+
'Page' => page_number,
|
207
|
+
'PageSize' => page_size,
|
208
|
+
})
|
209
|
+
response = @version.page(
|
210
|
+
'GET',
|
211
|
+
@uri,
|
212
|
+
params
|
213
|
+
)
|
214
|
+
NationalPage.new(@version, response, @solution)
|
215
|
+
end
|
216
|
+
|
217
|
+
##
|
218
|
+
# Retrieve a single page of NationalInstance records from the API.
|
219
|
+
# Request is executed immediately.
|
220
|
+
# @param [String] target_url API-generated URL for the requested results page
|
221
|
+
# @return [Page] Page of NationalInstance
|
222
|
+
def get_page(target_url)
|
223
|
+
response = @version.domain.request(
|
224
|
+
'GET',
|
225
|
+
target_url
|
226
|
+
)
|
227
|
+
NationalPage.new(@version, response, @solution)
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Provide a user friendly representation
|
232
|
+
def to_s
|
233
|
+
'#<Twilio.Api.V2010.NationalList>'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
class NationalPage < Page
|
238
|
+
##
|
239
|
+
# Initialize the NationalPage
|
240
|
+
# @param [Version] version Version that contains the resource
|
241
|
+
# @param [Response] response Response from the API
|
242
|
+
# @param [Hash] solution Path solution for the resource
|
243
|
+
# @return [NationalPage] NationalPage
|
244
|
+
def initialize(version, response, solution)
|
245
|
+
super(version, response)
|
246
|
+
|
247
|
+
# Path Solution
|
248
|
+
@solution = solution
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Build an instance of NationalInstance
|
253
|
+
# @param [Hash] payload Payload response from the API
|
254
|
+
# @return [NationalInstance] NationalInstance
|
255
|
+
def get_instance(payload)
|
256
|
+
NationalInstance.new(
|
257
|
+
@version,
|
258
|
+
payload,
|
259
|
+
account_sid: @solution[:account_sid],
|
260
|
+
country_code: @solution[:country_code],
|
261
|
+
)
|
262
|
+
end
|
263
|
+
|
264
|
+
##
|
265
|
+
# Provide a user friendly representation
|
266
|
+
def to_s
|
267
|
+
'<Twilio.Api.V2010.NationalPage>'
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
class NationalInstance < InstanceResource
|
272
|
+
##
|
273
|
+
# Initialize the NationalInstance
|
274
|
+
# @param [Version] version Version that contains the resource
|
275
|
+
# @param [Hash] payload payload that contains response from Twilio
|
276
|
+
# @param [String] account_sid The 34 character string that uniquely identifies
|
277
|
+
# your account.
|
278
|
+
# @param [String] country_code The ISO Country code to lookup phone numbers for.
|
279
|
+
# @return [NationalInstance] NationalInstance
|
280
|
+
def initialize(version, payload, account_sid: nil, country_code: nil)
|
281
|
+
super(version)
|
282
|
+
|
283
|
+
# Marshaled Properties
|
284
|
+
@properties = {
|
285
|
+
'friendly_name' => payload['friendly_name'],
|
286
|
+
'phone_number' => payload['phone_number'],
|
287
|
+
'lata' => payload['lata'],
|
288
|
+
'locality' => payload['locality'],
|
289
|
+
'rate_center' => payload['rate_center'],
|
290
|
+
'latitude' => payload['latitude'].to_f,
|
291
|
+
'longitude' => payload['longitude'].to_f,
|
292
|
+
'region' => payload['region'],
|
293
|
+
'postal_code' => payload['postal_code'],
|
294
|
+
'iso_country' => payload['iso_country'],
|
295
|
+
'address_requirements' => payload['address_requirements'],
|
296
|
+
'beta' => payload['beta'],
|
297
|
+
'capabilities' => payload['capabilities'],
|
298
|
+
}
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# @return [String] The friendly_name
|
303
|
+
def friendly_name
|
304
|
+
@properties['friendly_name']
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# @return [String] The phone_number
|
309
|
+
def phone_number
|
310
|
+
@properties['phone_number']
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# @return [String] The lata
|
315
|
+
def lata
|
316
|
+
@properties['lata']
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# @return [String] The locality
|
321
|
+
def locality
|
322
|
+
@properties['locality']
|
323
|
+
end
|
324
|
+
|
325
|
+
##
|
326
|
+
# @return [String] The rate_center
|
327
|
+
def rate_center
|
328
|
+
@properties['rate_center']
|
329
|
+
end
|
330
|
+
|
331
|
+
##
|
332
|
+
# @return [String] The latitude
|
333
|
+
def latitude
|
334
|
+
@properties['latitude']
|
335
|
+
end
|
336
|
+
|
337
|
+
##
|
338
|
+
# @return [String] The longitude
|
339
|
+
def longitude
|
340
|
+
@properties['longitude']
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# @return [String] The region
|
345
|
+
def region
|
346
|
+
@properties['region']
|
347
|
+
end
|
348
|
+
|
349
|
+
##
|
350
|
+
# @return [String] The postal_code
|
351
|
+
def postal_code
|
352
|
+
@properties['postal_code']
|
353
|
+
end
|
354
|
+
|
355
|
+
##
|
356
|
+
# @return [String] The iso_country
|
357
|
+
def iso_country
|
358
|
+
@properties['iso_country']
|
359
|
+
end
|
360
|
+
|
361
|
+
##
|
362
|
+
# @return [String] The address_requirements
|
363
|
+
def address_requirements
|
364
|
+
@properties['address_requirements']
|
365
|
+
end
|
366
|
+
|
367
|
+
##
|
368
|
+
# @return [Boolean] The beta
|
369
|
+
def beta
|
370
|
+
@properties['beta']
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# @return [String] The capabilities
|
375
|
+
def capabilities
|
376
|
+
@properties['capabilities']
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# Provide a user friendly representation
|
381
|
+
def to_s
|
382
|
+
"<Twilio.Api.V2010.NationalInstance>"
|
383
|
+
end
|
384
|
+
|
385
|
+
##
|
386
|
+
# Provide a detailed, user friendly representation
|
387
|
+
def inspect
|
388
|
+
"<Twilio.Api.V2010.NationalInstance>"
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
@@ -0,0 +1,396 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module REST
|
9
|
+
class Api < Domain
|
10
|
+
class V2010 < Version
|
11
|
+
class AccountContext < InstanceContext
|
12
|
+
class AvailablePhoneNumberCountryContext < InstanceContext
|
13
|
+
class SharedCostList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the SharedCostList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @param [String] account_sid The 34 character string that uniquely identifies
|
18
|
+
# your account.
|
19
|
+
# @param [String] country_code The ISO Country code to lookup phone numbers for.
|
20
|
+
# @return [SharedCostList] SharedCostList
|
21
|
+
def initialize(version, account_sid: nil, country_code: nil)
|
22
|
+
super(version)
|
23
|
+
|
24
|
+
# Path Solution
|
25
|
+
@solution = {account_sid: account_sid, country_code: country_code}
|
26
|
+
@uri = "/Accounts/#{@solution[:account_sid]}/AvailablePhoneNumbers/#{@solution[:country_code]}/SharedCost.json"
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Lists SharedCostInstance records from the API as a list.
|
31
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
32
|
+
# memory before returning.
|
33
|
+
# @param [String] area_code The area_code
|
34
|
+
# @param [String] contains The contains
|
35
|
+
# @param [Boolean] sms_enabled The sms_enabled
|
36
|
+
# @param [Boolean] mms_enabled The mms_enabled
|
37
|
+
# @param [Boolean] voice_enabled The voice_enabled
|
38
|
+
# @param [Boolean] exclude_all_address_required The exclude_all_address_required
|
39
|
+
# @param [Boolean] exclude_local_address_required The
|
40
|
+
# exclude_local_address_required
|
41
|
+
# @param [Boolean] exclude_foreign_address_required The
|
42
|
+
# exclude_foreign_address_required
|
43
|
+
# @param [Boolean] beta The beta
|
44
|
+
# @param [String] near_number The near_number
|
45
|
+
# @param [String] near_lat_long The near_lat_long
|
46
|
+
# @param [String] distance The distance
|
47
|
+
# @param [String] in_postal_code The in_postal_code
|
48
|
+
# @param [String] in_region The in_region
|
49
|
+
# @param [String] in_rate_center The in_rate_center
|
50
|
+
# @param [String] in_lata The in_lata
|
51
|
+
# @param [String] in_locality The in_locality
|
52
|
+
# @param [Boolean] fax_enabled The fax_enabled
|
53
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
54
|
+
# guarantees to never return more than limit. Default is no limit
|
55
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
56
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
57
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
58
|
+
# efficient page size, i.e. min(limit, 1000)
|
59
|
+
# @return [Array] Array of up to limit results
|
60
|
+
def list(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil)
|
61
|
+
self.stream(
|
62
|
+
area_code: area_code,
|
63
|
+
contains: contains,
|
64
|
+
sms_enabled: sms_enabled,
|
65
|
+
mms_enabled: mms_enabled,
|
66
|
+
voice_enabled: voice_enabled,
|
67
|
+
exclude_all_address_required: exclude_all_address_required,
|
68
|
+
exclude_local_address_required: exclude_local_address_required,
|
69
|
+
exclude_foreign_address_required: exclude_foreign_address_required,
|
70
|
+
beta: beta,
|
71
|
+
near_number: near_number,
|
72
|
+
near_lat_long: near_lat_long,
|
73
|
+
distance: distance,
|
74
|
+
in_postal_code: in_postal_code,
|
75
|
+
in_region: in_region,
|
76
|
+
in_rate_center: in_rate_center,
|
77
|
+
in_lata: in_lata,
|
78
|
+
in_locality: in_locality,
|
79
|
+
fax_enabled: fax_enabled,
|
80
|
+
limit: limit,
|
81
|
+
page_size: page_size
|
82
|
+
).entries
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Streams SharedCostInstance records from the API as an Enumerable.
|
87
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
88
|
+
# is reached.
|
89
|
+
# @param [String] area_code The area_code
|
90
|
+
# @param [String] contains The contains
|
91
|
+
# @param [Boolean] sms_enabled The sms_enabled
|
92
|
+
# @param [Boolean] mms_enabled The mms_enabled
|
93
|
+
# @param [Boolean] voice_enabled The voice_enabled
|
94
|
+
# @param [Boolean] exclude_all_address_required The exclude_all_address_required
|
95
|
+
# @param [Boolean] exclude_local_address_required The
|
96
|
+
# exclude_local_address_required
|
97
|
+
# @param [Boolean] exclude_foreign_address_required The
|
98
|
+
# exclude_foreign_address_required
|
99
|
+
# @param [Boolean] beta The beta
|
100
|
+
# @param [String] near_number The near_number
|
101
|
+
# @param [String] near_lat_long The near_lat_long
|
102
|
+
# @param [String] distance The distance
|
103
|
+
# @param [String] in_postal_code The in_postal_code
|
104
|
+
# @param [String] in_region The in_region
|
105
|
+
# @param [String] in_rate_center The in_rate_center
|
106
|
+
# @param [String] in_lata The in_lata
|
107
|
+
# @param [String] in_locality The in_locality
|
108
|
+
# @param [Boolean] fax_enabled The fax_enabled
|
109
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
110
|
+
# guarantees to never return more than limit. Default is no limit.
|
111
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
112
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
113
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
114
|
+
# efficient page size, i.e. min(limit, 1000)
|
115
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
116
|
+
def stream(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, limit: nil, page_size: nil)
|
117
|
+
limits = @version.read_limits(limit, page_size)
|
118
|
+
|
119
|
+
page = self.page(
|
120
|
+
area_code: area_code,
|
121
|
+
contains: contains,
|
122
|
+
sms_enabled: sms_enabled,
|
123
|
+
mms_enabled: mms_enabled,
|
124
|
+
voice_enabled: voice_enabled,
|
125
|
+
exclude_all_address_required: exclude_all_address_required,
|
126
|
+
exclude_local_address_required: exclude_local_address_required,
|
127
|
+
exclude_foreign_address_required: exclude_foreign_address_required,
|
128
|
+
beta: beta,
|
129
|
+
near_number: near_number,
|
130
|
+
near_lat_long: near_lat_long,
|
131
|
+
distance: distance,
|
132
|
+
in_postal_code: in_postal_code,
|
133
|
+
in_region: in_region,
|
134
|
+
in_rate_center: in_rate_center,
|
135
|
+
in_lata: in_lata,
|
136
|
+
in_locality: in_locality,
|
137
|
+
fax_enabled: fax_enabled,
|
138
|
+
page_size: limits[:page_size],
|
139
|
+
)
|
140
|
+
|
141
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# When passed a block, yields SharedCostInstance records from the API.
|
146
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
147
|
+
# is reached.
|
148
|
+
def each
|
149
|
+
limits = @version.read_limits
|
150
|
+
|
151
|
+
page = self.page(page_size: limits[:page_size])
|
152
|
+
|
153
|
+
@version.stream(page,
|
154
|
+
limit: limits[:limit],
|
155
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Retrieve a single page of SharedCostInstance records from the API.
|
160
|
+
# Request is executed immediately.
|
161
|
+
# @param [String] area_code The area_code
|
162
|
+
# @param [String] contains The contains
|
163
|
+
# @param [Boolean] sms_enabled The sms_enabled
|
164
|
+
# @param [Boolean] mms_enabled The mms_enabled
|
165
|
+
# @param [Boolean] voice_enabled The voice_enabled
|
166
|
+
# @param [Boolean] exclude_all_address_required The exclude_all_address_required
|
167
|
+
# @param [Boolean] exclude_local_address_required The
|
168
|
+
# exclude_local_address_required
|
169
|
+
# @param [Boolean] exclude_foreign_address_required The
|
170
|
+
# exclude_foreign_address_required
|
171
|
+
# @param [Boolean] beta The beta
|
172
|
+
# @param [String] near_number The near_number
|
173
|
+
# @param [String] near_lat_long The near_lat_long
|
174
|
+
# @param [String] distance The distance
|
175
|
+
# @param [String] in_postal_code The in_postal_code
|
176
|
+
# @param [String] in_region The in_region
|
177
|
+
# @param [String] in_rate_center The in_rate_center
|
178
|
+
# @param [String] in_lata The in_lata
|
179
|
+
# @param [String] in_locality The in_locality
|
180
|
+
# @param [Boolean] fax_enabled The fax_enabled
|
181
|
+
# @param [String] page_token PageToken provided by the API
|
182
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
183
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
184
|
+
# @return [Page] Page of SharedCostInstance
|
185
|
+
def page(area_code: :unset, contains: :unset, sms_enabled: :unset, mms_enabled: :unset, voice_enabled: :unset, exclude_all_address_required: :unset, exclude_local_address_required: :unset, exclude_foreign_address_required: :unset, beta: :unset, near_number: :unset, near_lat_long: :unset, distance: :unset, in_postal_code: :unset, in_region: :unset, in_rate_center: :unset, in_lata: :unset, in_locality: :unset, fax_enabled: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
186
|
+
params = Twilio::Values.of({
|
187
|
+
'AreaCode' => area_code,
|
188
|
+
'Contains' => contains,
|
189
|
+
'SmsEnabled' => sms_enabled,
|
190
|
+
'MmsEnabled' => mms_enabled,
|
191
|
+
'VoiceEnabled' => voice_enabled,
|
192
|
+
'ExcludeAllAddressRequired' => exclude_all_address_required,
|
193
|
+
'ExcludeLocalAddressRequired' => exclude_local_address_required,
|
194
|
+
'ExcludeForeignAddressRequired' => exclude_foreign_address_required,
|
195
|
+
'Beta' => beta,
|
196
|
+
'NearNumber' => near_number,
|
197
|
+
'NearLatLong' => near_lat_long,
|
198
|
+
'Distance' => distance,
|
199
|
+
'InPostalCode' => in_postal_code,
|
200
|
+
'InRegion' => in_region,
|
201
|
+
'InRateCenter' => in_rate_center,
|
202
|
+
'InLata' => in_lata,
|
203
|
+
'InLocality' => in_locality,
|
204
|
+
'FaxEnabled' => fax_enabled,
|
205
|
+
'PageToken' => page_token,
|
206
|
+
'Page' => page_number,
|
207
|
+
'PageSize' => page_size,
|
208
|
+
})
|
209
|
+
response = @version.page(
|
210
|
+
'GET',
|
211
|
+
@uri,
|
212
|
+
params
|
213
|
+
)
|
214
|
+
SharedCostPage.new(@version, response, @solution)
|
215
|
+
end
|
216
|
+
|
217
|
+
##
|
218
|
+
# Retrieve a single page of SharedCostInstance records from the API.
|
219
|
+
# Request is executed immediately.
|
220
|
+
# @param [String] target_url API-generated URL for the requested results page
|
221
|
+
# @return [Page] Page of SharedCostInstance
|
222
|
+
def get_page(target_url)
|
223
|
+
response = @version.domain.request(
|
224
|
+
'GET',
|
225
|
+
target_url
|
226
|
+
)
|
227
|
+
SharedCostPage.new(@version, response, @solution)
|
228
|
+
end
|
229
|
+
|
230
|
+
##
|
231
|
+
# Provide a user friendly representation
|
232
|
+
def to_s
|
233
|
+
'#<Twilio.Api.V2010.SharedCostList>'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
class SharedCostPage < Page
|
238
|
+
##
|
239
|
+
# Initialize the SharedCostPage
|
240
|
+
# @param [Version] version Version that contains the resource
|
241
|
+
# @param [Response] response Response from the API
|
242
|
+
# @param [Hash] solution Path solution for the resource
|
243
|
+
# @return [SharedCostPage] SharedCostPage
|
244
|
+
def initialize(version, response, solution)
|
245
|
+
super(version, response)
|
246
|
+
|
247
|
+
# Path Solution
|
248
|
+
@solution = solution
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Build an instance of SharedCostInstance
|
253
|
+
# @param [Hash] payload Payload response from the API
|
254
|
+
# @return [SharedCostInstance] SharedCostInstance
|
255
|
+
def get_instance(payload)
|
256
|
+
SharedCostInstance.new(
|
257
|
+
@version,
|
258
|
+
payload,
|
259
|
+
account_sid: @solution[:account_sid],
|
260
|
+
country_code: @solution[:country_code],
|
261
|
+
)
|
262
|
+
end
|
263
|
+
|
264
|
+
##
|
265
|
+
# Provide a user friendly representation
|
266
|
+
def to_s
|
267
|
+
'<Twilio.Api.V2010.SharedCostPage>'
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
class SharedCostInstance < InstanceResource
|
272
|
+
##
|
273
|
+
# Initialize the SharedCostInstance
|
274
|
+
# @param [Version] version Version that contains the resource
|
275
|
+
# @param [Hash] payload payload that contains response from Twilio
|
276
|
+
# @param [String] account_sid The 34 character string that uniquely identifies
|
277
|
+
# your account.
|
278
|
+
# @param [String] country_code The ISO Country code to lookup phone numbers for.
|
279
|
+
# @return [SharedCostInstance] SharedCostInstance
|
280
|
+
def initialize(version, payload, account_sid: nil, country_code: nil)
|
281
|
+
super(version)
|
282
|
+
|
283
|
+
# Marshaled Properties
|
284
|
+
@properties = {
|
285
|
+
'friendly_name' => payload['friendly_name'],
|
286
|
+
'phone_number' => payload['phone_number'],
|
287
|
+
'lata' => payload['lata'],
|
288
|
+
'locality' => payload['locality'],
|
289
|
+
'rate_center' => payload['rate_center'],
|
290
|
+
'latitude' => payload['latitude'].to_f,
|
291
|
+
'longitude' => payload['longitude'].to_f,
|
292
|
+
'region' => payload['region'],
|
293
|
+
'postal_code' => payload['postal_code'],
|
294
|
+
'iso_country' => payload['iso_country'],
|
295
|
+
'address_requirements' => payload['address_requirements'],
|
296
|
+
'beta' => payload['beta'],
|
297
|
+
'capabilities' => payload['capabilities'],
|
298
|
+
}
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# @return [String] The friendly_name
|
303
|
+
def friendly_name
|
304
|
+
@properties['friendly_name']
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# @return [String] The phone_number
|
309
|
+
def phone_number
|
310
|
+
@properties['phone_number']
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# @return [String] The lata
|
315
|
+
def lata
|
316
|
+
@properties['lata']
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# @return [String] The locality
|
321
|
+
def locality
|
322
|
+
@properties['locality']
|
323
|
+
end
|
324
|
+
|
325
|
+
##
|
326
|
+
# @return [String] The rate_center
|
327
|
+
def rate_center
|
328
|
+
@properties['rate_center']
|
329
|
+
end
|
330
|
+
|
331
|
+
##
|
332
|
+
# @return [String] The latitude
|
333
|
+
def latitude
|
334
|
+
@properties['latitude']
|
335
|
+
end
|
336
|
+
|
337
|
+
##
|
338
|
+
# @return [String] The longitude
|
339
|
+
def longitude
|
340
|
+
@properties['longitude']
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# @return [String] The region
|
345
|
+
def region
|
346
|
+
@properties['region']
|
347
|
+
end
|
348
|
+
|
349
|
+
##
|
350
|
+
# @return [String] The postal_code
|
351
|
+
def postal_code
|
352
|
+
@properties['postal_code']
|
353
|
+
end
|
354
|
+
|
355
|
+
##
|
356
|
+
# @return [String] The iso_country
|
357
|
+
def iso_country
|
358
|
+
@properties['iso_country']
|
359
|
+
end
|
360
|
+
|
361
|
+
##
|
362
|
+
# @return [String] The address_requirements
|
363
|
+
def address_requirements
|
364
|
+
@properties['address_requirements']
|
365
|
+
end
|
366
|
+
|
367
|
+
##
|
368
|
+
# @return [Boolean] The beta
|
369
|
+
def beta
|
370
|
+
@properties['beta']
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# @return [String] The capabilities
|
375
|
+
def capabilities
|
376
|
+
@properties['capabilities']
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# Provide a user friendly representation
|
381
|
+
def to_s
|
382
|
+
"<Twilio.Api.V2010.SharedCostInstance>"
|
383
|
+
end
|
384
|
+
|
385
|
+
##
|
386
|
+
# Provide a detailed, user friendly representation
|
387
|
+
def inspect
|
388
|
+
"<Twilio.Api.V2010.SharedCostInstance>"
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|