twilio-ruby 5.5.1 → 5.6.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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +18 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +96 -0
  5. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb +396 -0
  6. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb +396 -0
  7. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb +396 -0
  8. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb +396 -0
  9. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +4 -1
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +15 -15
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +1 -1
  12. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +7 -1
  13. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +17 -10
  14. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +41 -3
  15. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +6 -6
  16. data/lib/twilio-ruby/twiml/messaging_response.rb +3 -2
  17. data/lib/twilio-ruby/twiml/voice_response.rb +10 -6
  18. data/lib/twilio-ruby/version.rb +1 -1
  19. data/spec/integration/api/v2010/account/available_phone_number/machine_to_machine_spec.rb +101 -0
  20. data/spec/integration/api/v2010/account/available_phone_number/national_spec.rb +101 -0
  21. data/spec/integration/api/v2010/account/available_phone_number/shared_cost_spec.rb +101 -0
  22. data/spec/integration/api/v2010/account/available_phone_number/voip_spec.rb +101 -0
  23. data/spec/integration/api/v2010/account/call/recording_spec.rb +28 -28
  24. data/spec/integration/api/v2010/account/conference_spec.rb +6 -3
  25. data/spec/integration/api/v2010/account/recording_spec.rb +32 -24
  26. data/spec/integration/notify/v1/service_spec.rb +4 -0
  27. data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +50 -5
  28. data/spec/integration/proxy/v1/service/session_spec.rb +3 -3
  29. metadata +14 -2
@@ -365,7 +365,7 @@ module Twilio
365
365
  end
366
366
 
367
367
  ##
368
- # @return [participant.Status] The status of the conference
368
+ # @return [recording.Status] The status of the conference
369
369
  def status
370
370
  @properties['status']
371
371
  end
@@ -63,8 +63,12 @@ module Twilio
63
63
  # conference_recording_status_callback
64
64
  # @param [String] conference_recording_status_callback_method The
65
65
  # conference_recording_status_callback_method
66
+ # @param [String] recording_status_callback_event The
67
+ # recording_status_callback_event
68
+ # @param [String] conference_recording_status_callback_event The
69
+ # conference_recording_status_callback_event
66
70
  # @return [ParticipantInstance] Newly created ParticipantInstance
67
- 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)
71
+ 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)
68
72
  data = Twilio::Values.of({
69
73
  'From' => from,
70
74
  'To' => to,
@@ -94,6 +98,8 @@ module Twilio
94
98
  'Region' => region,
95
99
  'ConferenceRecordingStatusCallback' => conference_recording_status_callback,
96
100
  'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method,
101
+ 'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e },
102
+ 'ConferenceRecordingStatusCallbackEvent' => Twilio.serialize_list(conference_recording_status_callback_event) { |e| e },
97
103
  })
98
104
 
99
105
  payload = @version.create(
@@ -293,9 +293,10 @@ module Twilio
293
293
  'status' => payload['status'],
294
294
  'channels' => payload['channels'].to_i,
295
295
  'source' => payload['source'],
296
+ 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
296
297
  'uri' => payload['uri'],
297
298
  'encryption_details' => payload['encryption_details'],
298
- 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
299
+ 'subresource_uris' => payload['subresource_uris'],
299
300
  }
300
301
 
301
302
  # Context
@@ -327,7 +328,7 @@ module Twilio
327
328
  end
328
329
 
329
330
  ##
330
- # @return [String] The call during which the recording was made.
331
+ # @return [String] The unique id for the call leg that corresponds to the recording.
331
332
  def call_sid
332
333
  @properties['call_sid']
333
334
  end
@@ -357,35 +358,41 @@ module Twilio
357
358
  end
358
359
 
359
360
  ##
360
- # @return [String] The price
361
+ # @return [String] The one-time cost of creating this recording.
361
362
  def price
362
363
  @properties['price']
363
364
  end
364
365
 
365
366
  ##
366
- # @return [String] The price_unit
367
+ # @return [String] The currency used in the Price property.
367
368
  def price_unit
368
369
  @properties['price_unit']
369
370
  end
370
371
 
371
372
  ##
372
- # @return [transcription.Status] The status
373
+ # @return [transcription.Status] The status of the recording.
373
374
  def status
374
375
  @properties['status']
375
376
  end
376
377
 
377
378
  ##
378
- # @return [String] The channels
379
+ # @return [String] The number of channels in the final recording file as an integer.
379
380
  def channels
380
381
  @properties['channels']
381
382
  end
382
383
 
383
384
  ##
384
- # @return [recording.Source] The source
385
+ # @return [recording.Source] The way in which this recording was created.
385
386
  def source
386
387
  @properties['source']
387
388
  end
388
389
 
390
+ ##
391
+ # @return [String] More information about the recording failure, if Status is failed.
392
+ def error_code
393
+ @properties['error_code']
394
+ end
395
+
389
396
  ##
390
397
  # @return [String] The URI for this resource
391
398
  def uri
@@ -399,9 +406,9 @@ module Twilio
399
406
  end
400
407
 
401
408
  ##
402
- # @return [String] More information about the recording failure, if Status is failed.
403
- def error_code
404
- @properties['error_code']
409
+ # @return [String] The subresource_uris
410
+ def subresource_uris
411
+ @properties['subresource_uris']
405
412
  end
406
413
 
407
414
  ##
@@ -198,8 +198,14 @@ module Twilio
198
198
  # phone number.
199
199
  # @param [String] email Optional. Email of the owner of this phone number that is
200
200
  # being hosted.
201
+ # @param [hosted_number_order.VerificationType] verification_type Optional. The
202
+ # method used for verifying ownership of the number to be hosted. One of
203
+ # phone-call (default) or phone-bill.
204
+ # @param [String] verification_document_sid Optional. The unique sid identifier of
205
+ # the Identity Document that represents the document for verifying ownership of
206
+ # the number to be hosted. Required when VerificationType is phone-bill.
201
207
  # @return [HostedNumberOrderInstance] Newly created HostedNumberOrderInstance
202
- def create(phone_number: nil, sms_capability: nil, account_sid: :unset, friendly_name: :unset, unique_name: :unset, cc_emails: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, sms_application_sid: :unset, address_sid: :unset, email: :unset)
208
+ def create(phone_number: nil, sms_capability: nil, account_sid: :unset, friendly_name: :unset, unique_name: :unset, cc_emails: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, sms_application_sid: :unset, address_sid: :unset, email: :unset, verification_type: :unset, verification_document_sid: :unset)
203
209
  data = Twilio::Values.of({
204
210
  'PhoneNumber' => phone_number,
205
211
  'SmsCapability' => sms_capability,
@@ -216,6 +222,8 @@ module Twilio
216
222
  'SmsApplicationSid' => sms_application_sid,
217
223
  'AddressSid' => address_sid,
218
224
  'Email' => email,
225
+ 'VerificationType' => verification_type,
226
+ 'VerificationDocumentSid' => verification_document_sid,
219
227
  })
220
228
 
221
229
  payload = @version.create(
@@ -319,8 +327,14 @@ module Twilio
319
327
  # User can only update this to `pending-loa` or `pending-verification`.
320
328
  # @param [String] verification_code A verification code that is given to the user
321
329
  # via a phone call to the phone number that is being hosted.
330
+ # @param [hosted_number_order.VerificationType] verification_type Optional. The
331
+ # method used for verifying ownership of the number to be hosted. One of
332
+ # phone-call (default) or phone-bill.
333
+ # @param [String] verification_document_sid Optional. The unique sid identifier of
334
+ # the Identity Document that represents the document for verifying ownership of
335
+ # the number to be hosted. Required when VerificationType is phone-bill.
322
336
  # @return [HostedNumberOrderInstance] Updated HostedNumberOrderInstance
323
- def update(friendly_name: :unset, unique_name: :unset, email: :unset, cc_emails: :unset, status: :unset, verification_code: :unset)
337
+ def update(friendly_name: :unset, unique_name: :unset, email: :unset, cc_emails: :unset, status: :unset, verification_code: :unset, verification_type: :unset, verification_document_sid: :unset)
324
338
  data = Twilio::Values.of({
325
339
  'FriendlyName' => friendly_name,
326
340
  'UniqueName' => unique_name,
@@ -328,6 +342,8 @@ module Twilio
328
342
  'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
329
343
  'Status' => status,
330
344
  'VerificationCode' => verification_code,
345
+ 'VerificationType' => verification_type,
346
+ 'VerificationDocumentSid' => verification_document_sid,
331
347
  })
332
348
 
333
349
  payload = @version.update(
@@ -378,6 +394,8 @@ module Twilio
378
394
  'email' => payload['email'],
379
395
  'cc_emails' => payload['cc_emails'],
380
396
  'url' => payload['url'],
397
+ 'verification_type' => payload['verification_type'],
398
+ 'verification_document_sid' => payload['verification_document_sid'],
381
399
  }
382
400
 
383
401
  # Context
@@ -492,6 +510,18 @@ module Twilio
492
510
  @properties['url']
493
511
  end
494
512
 
513
+ ##
514
+ # @return [hosted_number_order.VerificationType] The method used for verifying ownership of the number to be hosted.
515
+ def verification_type
516
+ @properties['verification_type']
517
+ end
518
+
519
+ ##
520
+ # @return [String] Verification Document Sid.
521
+ def verification_document_sid
522
+ @properties['verification_document_sid']
523
+ end
524
+
495
525
  ##
496
526
  # Fetch a HostedNumberOrderInstance
497
527
  # @return [HostedNumberOrderInstance] Fetched HostedNumberOrderInstance
@@ -521,8 +551,14 @@ module Twilio
521
551
  # User can only update this to `pending-loa` or `pending-verification`.
522
552
  # @param [String] verification_code A verification code that is given to the user
523
553
  # via a phone call to the phone number that is being hosted.
554
+ # @param [hosted_number_order.VerificationType] verification_type Optional. The
555
+ # method used for verifying ownership of the number to be hosted. One of
556
+ # phone-call (default) or phone-bill.
557
+ # @param [String] verification_document_sid Optional. The unique sid identifier of
558
+ # the Identity Document that represents the document for verifying ownership of
559
+ # the number to be hosted. Required when VerificationType is phone-bill.
524
560
  # @return [HostedNumberOrderInstance] Updated HostedNumberOrderInstance
525
- def update(friendly_name: :unset, unique_name: :unset, email: :unset, cc_emails: :unset, status: :unset, verification_code: :unset)
561
+ def update(friendly_name: :unset, unique_name: :unset, email: :unset, cc_emails: :unset, status: :unset, verification_code: :unset, verification_type: :unset, verification_document_sid: :unset)
526
562
  context.update(
527
563
  friendly_name: friendly_name,
528
564
  unique_name: unique_name,
@@ -530,6 +566,8 @@ module Twilio
530
566
  cc_emails: cc_emails,
531
567
  status: status,
532
568
  verification_code: verification_code,
569
+ verification_type: verification_type,
570
+ verification_document_sid: verification_document_sid,
533
571
  )
534
572
  end
535
573
 
@@ -32,7 +32,7 @@ module Twilio
32
32
  # @param [String] unique_name Provides a unique and addressable name to be
33
33
  # assigned to this Session, assigned by the developer, to be optionally used in
34
34
  # addition to SID.
35
- # @param [session.Status] status The Status of this Session. One of `in-progess`,
35
+ # @param [session.Status] status The Status of this Session. One of `in-progress`,
36
36
  # `closed`, `failed`, `unknown` or `completed`.
37
37
  # @param [Integer] limit Upper limit for the number of records to return. stream()
38
38
  # guarantees to never return more than limit. Default is no limit
@@ -52,7 +52,7 @@ module Twilio
52
52
  # @param [String] unique_name Provides a unique and addressable name to be
53
53
  # assigned to this Session, assigned by the developer, to be optionally used in
54
54
  # addition to SID.
55
- # @param [session.Status] status The Status of this Session. One of `in-progess`,
55
+ # @param [session.Status] status The Status of this Session. One of `in-progress`,
56
56
  # `closed`, `failed`, `unknown` or `completed`.
57
57
  # @param [Integer] limit Upper limit for the number of records to return. stream()
58
58
  # guarantees to never return more than limit. Default is no limit.
@@ -89,7 +89,7 @@ module Twilio
89
89
  # @param [String] unique_name Provides a unique and addressable name to be
90
90
  # assigned to this Session, assigned by the developer, to be optionally used in
91
91
  # addition to SID.
92
- # @param [session.Status] status The Status of this Session. One of `in-progess`,
92
+ # @param [session.Status] status The Status of this Session. One of `in-progress`,
93
93
  # `closed`, `failed`, `unknown` or `completed`.
94
94
  # @param [String] page_token PageToken provided by the API
95
95
  # @param [Integer] page_number Page Number, this value is simply for client state
@@ -135,7 +135,7 @@ module Twilio
135
135
  # @param [String] ttl The Time to Live for a Session, in seconds.
136
136
  # @param [session.Mode] mode The Mode of this Session. One of `message-only`,
137
137
  # `voice-only` or `voice-and-message`.
138
- # @param [session.Status] status The Status of this Session. One of `in-progess`,
138
+ # @param [session.Status] status The Status of this Session. One of `in-progress`,
139
139
  # `closed`, `failed`, `unknown` or `completed`.
140
140
  # @param [Hash] participants A list of phone numbers to add to this Session.
141
141
  # @return [SessionInstance] Newly created SessionInstance
@@ -249,7 +249,7 @@ module Twilio
249
249
  # @param [String] ttl The Time to Live for a Session, in seconds.
250
250
  # @param [session.Mode] mode The Mode of this Session. One of `message-only`,
251
251
  # `voice-only` or `voice-and-message`.
252
- # @param [session.Status] status The Status of this Session. One of `in-progess`,
252
+ # @param [session.Status] status The Status of this Session. One of `in-progress`,
253
253
  # `closed`, `failed`, `unknown` or `completed`.
254
254
  # @param [Hash] participants A list of phone numbers to add to this Session.
255
255
  # @return [SessionInstance] Updated SessionInstance
@@ -493,7 +493,7 @@ module Twilio
493
493
  # @param [String] ttl The Time to Live for a Session, in seconds.
494
494
  # @param [session.Mode] mode The Mode of this Session. One of `message-only`,
495
495
  # `voice-only` or `voice-and-message`.
496
- # @param [session.Status] status The Status of this Session. One of `in-progess`,
496
+ # @param [session.Status] status The Status of this Session. One of `in-progress`,
497
497
  # `closed`, `failed`, `unknown` or `completed`.
498
498
  # @param [Hash] participants A list of phone numbers to add to this Session.
499
499
  # @return [SessionInstance] Updated SessionInstance
@@ -23,9 +23,10 @@ module Twilio
23
23
  # from:: Phone Number to send Message from
24
24
  # action:: Action URL
25
25
  # method:: Action URL Method
26
+ # status_callback:: Status callback URL. Deprecated in favor of action.
26
27
  # keyword_args:: additional attributes
27
- def message(body: nil, to: nil, from: nil, action: nil, method: nil, **keyword_args)
28
- message = Message.new(body: body, to: to, from: from, action: action, method: method, **keyword_args)
28
+ def message(body: nil, to: nil, from: nil, action: nil, method: nil, status_callback: nil, **keyword_args)
29
+ message = Message.new(body: body, to: to, from: from, action: action, method: method, status_callback: status_callback, **keyword_args)
29
30
 
30
31
  yield(message) if block_given?
31
32
  append(message)
@@ -29,11 +29,12 @@ module Twilio
29
29
  # trim:: Trim the recording
30
30
  # recording_status_callback:: Recording status callback URL
31
31
  # recording_status_callback_method:: Recording status callback URL method
32
+ # recording_status_callback_event:: Recording status callback events
32
33
  # answer_on_bridge:: Preserve the ringing behavior of the inbound call until the Dialed call picks up
33
34
  # ring_tone:: Ringtone allows you to override the ringback tone that Twilio will play back to the caller while executing the Dial
34
35
  # keyword_args:: additional attributes
35
- def dial(number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, answer_on_bridge: nil, ring_tone: nil, **keyword_args)
36
- dial = Dial.new(number: number, action: action, method: method, timeout: timeout, hangup_on_star: hangup_on_star, time_limit: time_limit, caller_id: caller_id, record: record, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, answer_on_bridge: answer_on_bridge, ring_tone: ring_tone, **keyword_args)
36
+ def dial(number: nil, action: nil, method: nil, timeout: nil, hangup_on_star: nil, time_limit: nil, caller_id: nil, record: nil, trim: nil, recording_status_callback: nil, recording_status_callback_method: nil, recording_status_callback_event: nil, answer_on_bridge: nil, ring_tone: nil, **keyword_args)
37
+ dial = Dial.new(number: number, action: action, method: method, timeout: timeout, hangup_on_star: hangup_on_star, time_limit: time_limit, caller_id: caller_id, record: record, trim: trim, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, recording_status_callback_event: recording_status_callback_event, answer_on_bridge: answer_on_bridge, ring_tone: ring_tone, **keyword_args)
37
38
 
38
39
  yield(dial) if block_given?
39
40
  append(dial)
@@ -353,9 +354,11 @@ module Twilio
353
354
  ##
354
355
  # Create a new <Task> element
355
356
  # body:: TaskRouter task attributes
357
+ # priority:: Task priority
358
+ # timeout:: Timeout associated with task
356
359
  # keyword_args:: additional attributes
357
- def task(body, **keyword_args)
358
- append(Task.new(body, **keyword_args))
360
+ def task(body, priority: nil, timeout: nil, **keyword_args)
361
+ append(Task.new(body, priority: priority, timeout: timeout, **keyword_args))
359
362
  end
360
363
  end
361
364
 
@@ -423,10 +426,11 @@ module Twilio
423
426
  # status_callback_method:: Status callback URL method
424
427
  # recording_status_callback:: Recording status callback URL
425
428
  # recording_status_callback_method:: Recording status callback URL method
429
+ # recording_status_callback_event:: Recording status callback events
426
430
  # event_callback_url:: Event callback URL
427
431
  # keyword_args:: additional attributes
428
- def conference(name, muted: nil, beep: nil, start_conference_on_enter: nil, end_conference_on_exit: nil, wait_url: nil, wait_method: nil, max_participants: nil, record: nil, region: nil, whisper: nil, trim: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, recording_status_callback: nil, recording_status_callback_method: nil, event_callback_url: nil, **keyword_args)
429
- append(Conference.new(name, muted: muted, beep: beep, start_conference_on_enter: start_conference_on_enter, end_conference_on_exit: end_conference_on_exit, wait_url: wait_url, wait_method: wait_method, max_participants: max_participants, record: record, region: region, whisper: whisper, trim: trim, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, event_callback_url: event_callback_url, **keyword_args))
432
+ def conference(name, muted: nil, beep: nil, start_conference_on_enter: nil, end_conference_on_exit: nil, wait_url: nil, wait_method: nil, max_participants: nil, record: nil, region: nil, whisper: nil, trim: nil, status_callback_event: nil, status_callback: nil, status_callback_method: nil, recording_status_callback: nil, recording_status_callback_method: nil, recording_status_callback_event: nil, event_callback_url: nil, **keyword_args)
433
+ append(Conference.new(name, muted: muted, beep: beep, start_conference_on_enter: start_conference_on_enter, end_conference_on_exit: end_conference_on_exit, wait_url: wait_url, wait_method: wait_method, max_participants: max_participants, record: record, region: region, whisper: whisper, trim: trim, status_callback_event: status_callback_event, status_callback: status_callback, status_callback_method: status_callback_method, recording_status_callback: recording_status_callback, recording_status_callback_method: recording_status_callback_method, recording_status_callback_event: recording_status_callback_event, event_callback_url: event_callback_url, **keyword_args))
430
434
  end
431
435
 
432
436
  ##
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.5.1'
2
+ VERSION = '5.6.0'
3
3
  end
@@ -0,0 +1,101 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'MachineToMachine' do
10
+ it "can read" do
11
+ @holodeck.mock(Twilio::Response.new(500, ''))
12
+
13
+ expect {
14
+ @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .available_phone_numbers("US") \
16
+ .machine_to_machine.list()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives read_full responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "available_phone_numbers": [
33
+ {
34
+ "address_requirements": "none",
35
+ "beta": false,
36
+ "capabilities": {
37
+ "mms": false,
38
+ "sms": true,
39
+ "voice": false
40
+ },
41
+ "friendly_name": "+4759440374",
42
+ "iso_country": "NO",
43
+ "lata": null,
44
+ "latitude": null,
45
+ "locality": null,
46
+ "longitude": null,
47
+ "phone_number": "+4759440374",
48
+ "postal_code": null,
49
+ "rate_center": null,
50
+ "region": null
51
+ }
52
+ ],
53
+ "end": 1,
54
+ "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json?PageSize=50&Page=0",
55
+ "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json?PageSize=50&Page=0",
56
+ "next_page_uri": null,
57
+ "num_pages": 1,
58
+ "page": 0,
59
+ "page_size": 50,
60
+ "previous_page_uri": null,
61
+ "start": 0,
62
+ "total": 1,
63
+ "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json?PageSize=1"
64
+ }
65
+ ]
66
+ ))
67
+
68
+ actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
69
+ .available_phone_numbers("US") \
70
+ .machine_to_machine.list()
71
+
72
+ expect(actual).to_not eq(nil)
73
+ end
74
+
75
+ it "receives read_empty responses" do
76
+ @holodeck.mock(Twilio::Response.new(
77
+ 200,
78
+ %q[
79
+ {
80
+ "available_phone_numbers": [],
81
+ "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json?PageSize=50&Page=0",
82
+ "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json?PageSize=50&Page=0",
83
+ "next_page_uri": null,
84
+ "num_pages": 1,
85
+ "page": 0,
86
+ "page_size": 50,
87
+ "previous_page_uri": null,
88
+ "start": 0,
89
+ "total": 1,
90
+ "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/MachineToMachine.json?PageSize=1"
91
+ }
92
+ ]
93
+ ))
94
+
95
+ actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
96
+ .available_phone_numbers("US") \
97
+ .machine_to_machine.list()
98
+
99
+ expect(actual).to_not eq(nil)
100
+ end
101
+ end
@@ -0,0 +1,101 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ require 'spec_helper.rb'
8
+
9
+ describe 'National' do
10
+ it "can read" do
11
+ @holodeck.mock(Twilio::Response.new(500, ''))
12
+
13
+ expect {
14
+ @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
15
+ .available_phone_numbers("US") \
16
+ .national.list()
17
+ }.to raise_exception(Twilio::REST::TwilioError)
18
+
19
+ values = {}
20
+ expect(
21
+ @holodeck.has_request?(Holodeck::Request.new(
22
+ method: 'get',
23
+ url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json',
24
+ ))).to eq(true)
25
+ end
26
+
27
+ it "receives read_full responses" do
28
+ @holodeck.mock(Twilio::Response.new(
29
+ 200,
30
+ %q[
31
+ {
32
+ "available_phone_numbers": [
33
+ {
34
+ "address_requirements": "none",
35
+ "beta": false,
36
+ "capabilities": {
37
+ "mms": false,
38
+ "sms": true,
39
+ "voice": false
40
+ },
41
+ "friendly_name": "+4759440374",
42
+ "iso_country": "NO",
43
+ "lata": null,
44
+ "latitude": null,
45
+ "locality": null,
46
+ "longitude": null,
47
+ "phone_number": "+4759440374",
48
+ "postal_code": null,
49
+ "rate_center": null,
50
+ "region": null
51
+ }
52
+ ],
53
+ "end": 1,
54
+ "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json?PageSize=50&Page=0",
55
+ "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json?PageSize=50&Page=0",
56
+ "next_page_uri": null,
57
+ "num_pages": 1,
58
+ "page": 0,
59
+ "page_size": 50,
60
+ "previous_page_uri": null,
61
+ "start": 0,
62
+ "total": 1,
63
+ "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json?PageSize=1"
64
+ }
65
+ ]
66
+ ))
67
+
68
+ actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
69
+ .available_phone_numbers("US") \
70
+ .national.list()
71
+
72
+ expect(actual).to_not eq(nil)
73
+ end
74
+
75
+ it "receives read_empty responses" do
76
+ @holodeck.mock(Twilio::Response.new(
77
+ 200,
78
+ %q[
79
+ {
80
+ "available_phone_numbers": [],
81
+ "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json?PageSize=50&Page=0",
82
+ "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json?PageSize=50&Page=0",
83
+ "next_page_uri": null,
84
+ "num_pages": 1,
85
+ "page": 0,
86
+ "page_size": 50,
87
+ "previous_page_uri": null,
88
+ "start": 0,
89
+ "total": 1,
90
+ "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AvailablePhoneNumbers/US/National.json?PageSize=1"
91
+ }
92
+ ]
93
+ ))
94
+
95
+ actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
96
+ .available_phone_numbers("US") \
97
+ .national.list()
98
+
99
+ expect(actual).to_not eq(nil)
100
+ end
101
+ end