twilio-ruby 5.37.0 → 5.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +32 -9
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +41 -5
  5. data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +0 -16
  6. data/lib/twilio-ruby/rest/client.rb +0 -7
  7. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +28 -3
  8. data/lib/twilio-ruby/rest/monitor/v1/alert.rb +8 -8
  9. data/lib/twilio-ruby/rest/verify/v2/service.rb +26 -0
  10. data/lib/twilio-ruby/rest/{authy/v1/service/entity.rb → verify/v2/service/webhook.rb} +154 -108
  11. data/lib/twilio-ruby/version.rb +1 -1
  12. data/spec/integration/api/v2010/account/conference/participant_spec.rb +60 -0
  13. data/spec/integration/autopilot/v1/assistant_spec.rb +4 -8
  14. data/spec/integration/conversations/v1/conversation_spec.rb +16 -0
  15. data/spec/integration/verify/v2/service/webhook_spec.rb +262 -0
  16. data/spec/integration/verify/v2/service_spec.rb +8 -4
  17. metadata +5 -22
  18. data/lib/twilio-ruby/rest/authy.rb +0 -55
  19. data/lib/twilio-ruby/rest/authy/v1.rb +0 -59
  20. data/lib/twilio-ruby/rest/authy/v1/form.rb +0 -197
  21. data/lib/twilio-ruby/rest/authy/v1/service.rb +0 -404
  22. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +0 -500
  23. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +0 -494
  24. data/lib/twilio-ruby/rest/autopilot/v1/assistant/export_assistant.rb +0 -222
  25. data/spec/integration/authy/v1/form_spec.rb +0 -48
  26. data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +0 -353
  27. data/spec/integration/authy/v1/service/entity/factor_spec.rb +0 -298
  28. data/spec/integration/authy/v1/service/entity_spec.rb +0 -201
  29. data/spec/integration/authy/v1/service_spec.rb +0 -231
  30. data/spec/integration/autopilot/v1/assistant/export_assistant_spec.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a5c3a5328774c9a62a5bc9c1ff6c5e8938fdf26c2e79c1a408fde52a3aef190
4
- data.tar.gz: 066e9a04142cdcbe8638908d37fd5344387db572650f3eb155edc05511ba3e3d
3
+ metadata.gz: 0f977335dfe45b56523f320b3d4fbcf8e9dc4ab69b6f5459b61a5451ad3aacde
4
+ data.tar.gz: 5dcb7888fd08da7ebdf1c815abb1a5b9c44a71393d31c23d1f1c97547794dea6
5
5
  SHA512:
6
- metadata.gz: c2bf78da3f3bbbe12183da2fbff0c9353637a489d07fab78ef5c0b213865c4b9ed4368798888b79adb518df1f042bdd1272d0e7379f0b21ed587cc15c2d85c82
7
- data.tar.gz: 50a5abff923ede90115ad0987c8d1ff3e3c68a24faf055bfa2b8829c06d1af3b6cac19533791fa235dafcd865ce99810ba70d68c495001840bb41c5eb93162ad
6
+ metadata.gz: 84713b37e22092294e75e6b26397d8e767392916dc4cf5959c54f6969f414ee79e56ea5410f6085ddd933835bb1c3e2661a560c8220245cef033b46923c0d3b1
7
+ data.tar.gz: 046fa6c107c85e0ce763ecb21d1d2c755dff0bebc2534394e35b401fad32d5265c93feaf0ee4b5309caa868d918bfa66ffc370927fd31e6dbda8cfe41f77837d
data/CHANGES.md CHANGED
@@ -1,6 +1,38 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2020-06-24] Version 5.38.0
5
+ ---------------------------
6
+ **Api**
7
+ - Added optional `JitterBufferSize` parameter for creating conference participant
8
+ - Added optional `label` property for conference participants
9
+ - Added optional parameter `caller_id` for creating conference participant endpoint.
10
+
11
+ **Autopilot**
12
+ - Remove Export resource from Autopilot Assistant
13
+
14
+ **Conversations**
15
+ - Expose Conversation timers
16
+
17
+ **Monitor**
18
+ - Update start/end date filter params to support date-or-time format **(breaking change)**
19
+
20
+ **Numbers**
21
+ - Add `provisionally-approved` as a Supporting Document status
22
+
23
+ **Preview**
24
+ - Removed `Authy` resources. **(breaking change)**
25
+
26
+ **Supersim**
27
+ - Add ready state to the allowed transitions in the sim update call behind the feature flag supersim.ready-state.v1
28
+
29
+ **Verify**
30
+ - Webhook resources added to Verify services and put behind the `api.verify.push` beta feature
31
+
32
+ **Twiml**
33
+ - Add more supported locales for the `Gather` verb.
34
+
35
+
4
36
  [2020-06-10] Version 5.37.0
5
37
  ---------------------------
6
38
  **Library - Docs**
@@ -13,15 +45,6 @@ twilio-ruby changelog
13
45
  **Autopilot**
14
46
  - Add dialogue_sid param to Query list resource
15
47
 
16
- **Contacts**
17
- - Added contacts channel create, update, read, delete API definition
18
- - Added contacts Get API definition
19
- - Added contacts Update API definition
20
- - Added contacts Delete API definition
21
- - Added contacts Search API definition
22
- - Added AccountSID to CFD CREATE and GET Responses
23
- - Added contacts location Create, update, read and delete API definitions
24
-
25
48
  **Notify**
26
49
  - delivery_callback_url and delivery_callback_enabled added
27
50
 
data/README.md CHANGED
@@ -32,13 +32,13 @@ This library supports the following Ruby implementations:
32
32
  To install using [Bundler][bundler] grab the latest stable version:
33
33
 
34
34
  ```ruby
35
- gem 'twilio-ruby', '~> 5.37.0'
35
+ gem 'twilio-ruby', '~> 5.38.0'
36
36
  ```
37
37
 
38
38
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
39
39
 
40
40
  ```bash
41
- gem install twilio-ruby -v 5.37.0
41
+ gem install twilio-ruby -v 5.38.0
42
42
  ```
43
43
 
44
44
  To build and install the development branch yourself from the latest source:
@@ -32,10 +32,21 @@ module Twilio
32
32
  ##
33
33
  # Retrieve a single page of ParticipantInstance records from the API.
34
34
  # Request is executed immediately.
35
- # @param [String] from The `from` phone number that will dial the new conference
36
- # participant. Can be a phone number or a client id.
37
- # @param [String] to The phone number, client id, or sip address to invite to the
38
- # conference. [Custom
35
+ # @param [String] from The phone number, Client identifier, or username portion of
36
+ # SIP address that made this call. Phone numbers are in
37
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g.,
38
+ # +16175551212). Client identifiers are formatted `client:name`. If using a phone
39
+ # number, it must be a Twilio number or a Verified [outgoing caller
40
+ # id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account.
41
+ # If the `to` parameter is a phone number, `from` must also be a phone number. If
42
+ # `to` is sip address, this value of `from` should be a username portion to be
43
+ # used to populate the P-Asserted-Identity header that is passed to the SIP
44
+ # endpoint.
45
+ # @param [String] to The phone number, SIP address, or Client identifier that
46
+ # received this call. Phone numbers are in
47
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g.,
48
+ # +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client
49
+ # identifiers are formatted `client:name`. [Custom
39
50
  # parameters](https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters) may also be specified.
40
51
  # @param [String] status_callback The URL we should call using the
41
52
  # `status_callback_method` to send status information to your application.
@@ -45,6 +56,8 @@ module Twilio
45
56
  # generate a call to `status_callback`. Can be: `initiated`, `ringing`,
46
57
  # `answered`, and `completed`. Separate multiple values with a space. The default
47
58
  # value is `completed`.
59
+ # @param [String] label A label for this participant. If one is supplied, it may
60
+ # subsequently be used to fetch, update or delete the participant.
48
61
  # @param [String] timeout The number of seconds that we should allow the phone to
49
62
  # ring before assuming there is no answer. Can be an integer between `5` and
50
63
  # `600`, inclusive. The default value is `60`. We always add a 5-second timeout
@@ -128,17 +141,31 @@ module Twilio
128
141
  # @param [String] call_sid_to_coach The SID of the participant who is being
129
142
  # `coached`. The participant being coached is the only participant who can hear
130
143
  # the participant who is `coaching`.
144
+ # @param [String] jitter_buffer_size Jitter buffer size for the connecting
145
+ # participant. Twilio will use this setting to apply Jitter Buffer before
146
+ # participant's audio is mixed into the conference. Can be: `off`, `small`,
147
+ # `medium`, and `large`. Default to `large`.
131
148
  # @param [String] byoc The SID of a BYOC (Bring Your Own Carrier) trunk to route
132
149
  # this call with. Note that `byoc` is only meaningful when `to` is a phone number;
133
150
  # it will otherwise be ignored. (Beta)
151
+ # @param [String] caller_id The phone number, Client identifier, or username
152
+ # portion of SIP address that made this call. Phone numbers are in
153
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g.,
154
+ # +16175551212). Client identifiers are formatted `client:name`. If using a phone
155
+ # number, it must be a Twilio number or a Verified [outgoing caller
156
+ # id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account.
157
+ # If the `to` parameter is a phone number, `callerId` must also be a phone number.
158
+ # If `to` is sip address, this value of `callerId` should be a username portion to
159
+ # be used to populate the From header that is passed to the SIP endpoint.
134
160
  # @return [ParticipantInstance] Newly created ParticipantInstance
135
- def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, coaching: :unset, call_sid_to_coach: :unset, byoc: :unset)
161
+ def create(from: nil, to: nil, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, label: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_record: :unset, conference_trim: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, region: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, recording_status_callback_event: :unset, conference_recording_status_callback_event: :unset, coaching: :unset, call_sid_to_coach: :unset, jitter_buffer_size: :unset, byoc: :unset, caller_id: :unset)
136
162
  data = Twilio::Values.of({
137
163
  'From' => from,
138
164
  'To' => to,
139
165
  'StatusCallback' => status_callback,
140
166
  'StatusCallbackMethod' => status_callback_method,
141
167
  'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
168
+ 'Label' => label,
142
169
  'Timeout' => timeout,
143
170
  'Record' => record,
144
171
  'Muted' => muted,
@@ -166,7 +193,9 @@ module Twilio
166
193
  'ConferenceRecordingStatusCallbackEvent' => Twilio.serialize_list(conference_recording_status_callback_event) { |e| e },
167
194
  'Coaching' => coaching,
168
195
  'CallSidToCoach' => call_sid_to_coach,
196
+ 'JitterBufferSize' => jitter_buffer_size,
169
197
  'Byoc' => byoc,
198
+ 'CallerId' => caller_id,
170
199
  })
171
200
 
172
201
  payload = @version.create(
@@ -487,6 +516,7 @@ module Twilio
487
516
  @properties = {
488
517
  'account_sid' => payload['account_sid'],
489
518
  'call_sid' => payload['call_sid'],
519
+ 'label' => payload['label'],
490
520
  'call_sid_to_coach' => payload['call_sid_to_coach'],
491
521
  'coaching' => payload['coaching'],
492
522
  'conference_sid' => payload['conference_sid'],
@@ -537,6 +567,12 @@ module Twilio
537
567
  @properties['call_sid']
538
568
  end
539
569
 
570
+ ##
571
+ # @return [String] The label of this participant
572
+ def label
573
+ @properties['label']
574
+ end
575
+
540
576
  ##
541
577
  # @return [String] The SID of the participant who is being `coached`
542
578
  def call_sid_to_coach
@@ -209,7 +209,6 @@ module Twilio
209
209
  @defaults = nil
210
210
  @dialogues = nil
211
211
  @webhooks = nil
212
- @export_assistant = nil
213
212
  end
214
213
 
215
214
  ##
@@ -399,14 +398,6 @@ module Twilio
399
398
  @webhooks
400
399
  end
401
400
 
402
- ##
403
- # Access the export_assistant
404
- # @return [ExportAssistantList]
405
- # @return [ExportAssistantContext]
406
- def export_assistant
407
- ExportAssistantContext.new(@version, @solution[:sid], )
408
- end
409
-
410
401
  ##
411
402
  # Provide a user friendly representation
412
403
  def to_s
@@ -656,13 +647,6 @@ module Twilio
656
647
  context.webhooks
657
648
  end
658
649
 
659
- ##
660
- # Access the export_assistant
661
- # @return [export_assistant] export_assistant
662
- def export_assistant
663
- context.export_assistant
664
- end
665
-
666
650
  ##
667
651
  # Provide a user friendly representation
668
652
  def to_s
@@ -30,7 +30,6 @@ module Twilio
30
30
  # Domains
31
31
  @accounts = nil
32
32
  @api = nil
33
- @authy = nil
34
33
  @autopilot = nil
35
34
  @chat = nil
36
35
  @conversations = nil
@@ -143,12 +142,6 @@ module Twilio
143
142
  @api ||= Api.new self
144
143
  end
145
144
 
146
- ##
147
- # Access the Authy Twilio Domain
148
- def authy
149
- @authy ||= Authy.new self
150
- end
151
-
152
145
  ##
153
146
  # Access the Autopilot Twilio Domain
154
147
  def autopilot
@@ -41,8 +41,12 @@ module Twilio
41
41
  # returned.
42
42
  # @param [conversation.State] state Current state of this conversation. Can be
43
43
  # either `active`, `inactive` or `closed` and defaults to `active`
44
+ # @param [String] timers_inactive ISO8601 duration when conversation will be
45
+ # switched to `inactive` state. Minimum value for this timer is 1 minute.
46
+ # @param [String] timers_closed ISO8601 duration when conversation will be
47
+ # switched to `closed` state. Minimum value for this timer is 10 minutes.
44
48
  # @return [ConversationInstance] Newly created ConversationInstance
45
- def create(friendly_name: :unset, date_created: :unset, date_updated: :unset, messaging_service_sid: :unset, attributes: :unset, state: :unset)
49
+ def create(friendly_name: :unset, date_created: :unset, date_updated: :unset, messaging_service_sid: :unset, attributes: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset)
46
50
  data = Twilio::Values.of({
47
51
  'FriendlyName' => friendly_name,
48
52
  'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
@@ -50,6 +54,8 @@ module Twilio
50
54
  'MessagingServiceSid' => messaging_service_sid,
51
55
  'Attributes' => attributes,
52
56
  'State' => state,
57
+ 'Timers.Inactive' => timers_inactive,
58
+ 'Timers.Closed' => timers_closed,
53
59
  })
54
60
 
55
61
  payload = @version.create(
@@ -218,8 +224,12 @@ module Twilio
218
224
  # to.
219
225
  # @param [conversation.State] state Current state of this conversation. Can be
220
226
  # either `active`, `inactive` or `closed` and defaults to `active`
227
+ # @param [String] timers_inactive ISO8601 duration when conversation will be
228
+ # switched to `inactive` state. Minimum value for this timer is 1 minute.
229
+ # @param [String] timers_closed ISO8601 duration when conversation will be
230
+ # switched to `closed` state. Minimum value for this timer is 10 minutes.
221
231
  # @return [ConversationInstance] Updated ConversationInstance
222
- def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset)
232
+ def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset)
223
233
  data = Twilio::Values.of({
224
234
  'FriendlyName' => friendly_name,
225
235
  'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
@@ -227,6 +237,8 @@ module Twilio
227
237
  'Attributes' => attributes,
228
238
  'MessagingServiceSid' => messaging_service_sid,
229
239
  'State' => state,
240
+ 'Timers.Inactive' => timers_inactive,
241
+ 'Timers.Closed' => timers_closed,
230
242
  })
231
243
 
232
244
  payload = @version.update(
@@ -353,6 +365,7 @@ module Twilio
353
365
  'state' => payload['state'],
354
366
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
355
367
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
368
+ 'timers' => payload['timers'],
356
369
  'url' => payload['url'],
357
370
  'links' => payload['links'],
358
371
  }
@@ -427,6 +440,12 @@ module Twilio
427
440
  @properties['date_updated']
428
441
  end
429
442
 
443
+ ##
444
+ # @return [Hash] Timer date values for this conversation.
445
+ def timers
446
+ @properties['timers']
447
+ end
448
+
430
449
  ##
431
450
  # @return [String] An absolute URL for this conversation.
432
451
  def url
@@ -454,8 +473,12 @@ module Twilio
454
473
  # to.
455
474
  # @param [conversation.State] state Current state of this conversation. Can be
456
475
  # either `active`, `inactive` or `closed` and defaults to `active`
476
+ # @param [String] timers_inactive ISO8601 duration when conversation will be
477
+ # switched to `inactive` state. Minimum value for this timer is 1 minute.
478
+ # @param [String] timers_closed ISO8601 duration when conversation will be
479
+ # switched to `closed` state. Minimum value for this timer is 10 minutes.
457
480
  # @return [ConversationInstance] Updated ConversationInstance
458
- def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset)
481
+ def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset)
459
482
  context.update(
460
483
  friendly_name: friendly_name,
461
484
  date_created: date_created,
@@ -463,6 +486,8 @@ module Twilio
463
486
  attributes: attributes,
464
487
  messaging_service_sid: messaging_service_sid,
465
488
  state: state,
489
+ timers_inactive: timers_inactive,
490
+ timers_closed: timers_closed,
466
491
  )
467
492
  end
468
493
 
@@ -29,10 +29,10 @@ module Twilio
29
29
  # memory before returning.
30
30
  # @param [String] log_level Only show alerts for this log-level. Can be: `error`,
31
31
  # `warning`, `notice`, or `debug`.
32
- # @param [Date] start_date Only include alerts that occurred on or after this date
32
+ # @param [Time] start_date Only include alerts that occurred on or after this date
33
33
  # and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or
34
34
  # `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
35
- # @param [Date] end_date Only include alerts that occurred on or before this date
35
+ # @param [Time] end_date Only include alerts that occurred on or before this date
36
36
  # and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or
37
37
  # `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
38
38
  # @param [Integer] limit Upper limit for the number of records to return. stream()
@@ -58,10 +58,10 @@ module Twilio
58
58
  # is reached.
59
59
  # @param [String] log_level Only show alerts for this log-level. Can be: `error`,
60
60
  # `warning`, `notice`, or `debug`.
61
- # @param [Date] start_date Only include alerts that occurred on or after this date
61
+ # @param [Time] start_date Only include alerts that occurred on or after this date
62
62
  # and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or
63
63
  # `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
64
- # @param [Date] end_date Only include alerts that occurred on or before this date
64
+ # @param [Time] end_date Only include alerts that occurred on or before this date
65
65
  # and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or
66
66
  # `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
67
67
  # @param [Integer] limit Upper limit for the number of records to return. stream()
@@ -103,10 +103,10 @@ module Twilio
103
103
  # Request is executed immediately.
104
104
  # @param [String] log_level Only show alerts for this log-level. Can be: `error`,
105
105
  # `warning`, `notice`, or `debug`.
106
- # @param [Date] start_date Only include alerts that occurred on or after this date
106
+ # @param [Time] start_date Only include alerts that occurred on or after this date
107
107
  # and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or
108
108
  # `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
109
- # @param [Date] end_date Only include alerts that occurred on or before this date
109
+ # @param [Time] end_date Only include alerts that occurred on or before this date
110
110
  # and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or
111
111
  # `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
112
112
  # @param [String] page_token PageToken provided by the API
@@ -116,8 +116,8 @@ module Twilio
116
116
  def page(log_level: :unset, start_date: :unset, end_date: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
117
117
  params = Twilio::Values.of({
118
118
  'LogLevel' => log_level,
119
- 'StartDate' => Twilio.serialize_iso8601_date(start_date),
120
- 'EndDate' => Twilio.serialize_iso8601_date(end_date),
119
+ 'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
120
+ 'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
121
121
  'PageToken' => page_token,
122
122
  'Page' => page_number,
123
123
  'PageSize' => page_size,
@@ -209,6 +209,7 @@ module Twilio
209
209
  @rate_limits = nil
210
210
  @messaging_configurations = nil
211
211
  @entities = nil
212
+ @webhooks = nil
212
213
  end
213
214
 
214
215
  ##
@@ -362,6 +363,24 @@ module Twilio
362
363
  @entities
363
364
  end
364
365
 
366
+ ##
367
+ # Access the webhooks
368
+ # @return [WebhookList]
369
+ # @return [WebhookContext] if sid was passed.
370
+ def webhooks(sid=:unset)
371
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
372
+
373
+ if sid != :unset
374
+ return WebhookContext.new(@version, @solution[:sid], sid, )
375
+ end
376
+
377
+ unless @webhooks
378
+ @webhooks = WebhookList.new(@version, service_sid: @solution[:sid], )
379
+ end
380
+
381
+ @webhooks
382
+ end
383
+
365
384
  ##
366
385
  # Provide a user friendly representation
367
386
  def to_s
@@ -599,6 +618,13 @@ module Twilio
599
618
  context.entities
600
619
  end
601
620
 
621
+ ##
622
+ # Access the webhooks
623
+ # @return [webhooks] webhooks
624
+ def webhooks
625
+ context.webhooks
626
+ end
627
+
602
628
  ##
603
629
  # Provide a user friendly representation
604
630
  def to_s
@@ -8,32 +8,44 @@
8
8
 
9
9
  module Twilio
10
10
  module REST
11
- class Authy < Domain
12
- class V1 < Version
11
+ class Verify < Domain
12
+ class V2 < Version
13
13
  class ServiceContext < InstanceContext
14
14
  ##
15
15
  # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
- class EntityList < ListResource
16
+ class WebhookList < ListResource
17
17
  ##
18
- # Initialize the EntityList
18
+ # Initialize the WebhookList
19
19
  # @param [Version] version Version that contains the resource
20
20
  # @param [String] service_sid The unique SID identifier of the Service.
21
- # @return [EntityList] EntityList
21
+ # @return [WebhookList] WebhookList
22
22
  def initialize(version, service_sid: nil)
23
23
  super(version)
24
24
 
25
25
  # Path Solution
26
26
  @solution = {service_sid: service_sid}
27
- @uri = "/Services/#{@solution[:service_sid]}/Entities"
27
+ @uri = "/Services/#{@solution[:service_sid]}/Webhooks"
28
28
  end
29
29
 
30
30
  ##
31
- # Retrieve a single page of EntityInstance records from the API.
31
+ # Retrieve a single page of WebhookInstance records from the API.
32
32
  # Request is executed immediately.
33
- # @param [String] identity Customer unique identity for the Entity of the Service
34
- # @return [EntityInstance] Newly created EntityInstance
35
- def create(identity: nil)
36
- data = Twilio::Values.of({'Identity' => identity, })
33
+ # @param [String] friendly_name The string that you assigned to describe the
34
+ # webhook. **This value should not contain PII.**
35
+ # @param [String] event_types The array of events that this Webhook is subscribed
36
+ # to. Possible event types: `*, factor.deleted, factor.created, factor.verified,
37
+ # challenge.approved, challenge.denied`
38
+ # @param [String] webhook_url The URL associated with this Webhook.
39
+ # @param [webhook.Status] status The webhook status. Default value is `enabled`.
40
+ # One of: `enabled` or `disabled`
41
+ # @return [WebhookInstance] Newly created WebhookInstance
42
+ def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset)
43
+ data = Twilio::Values.of({
44
+ 'FriendlyName' => friendly_name,
45
+ 'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
46
+ 'WebhookUrl' => webhook_url,
47
+ 'Status' => status,
48
+ })
37
49
 
38
50
  payload = @version.create(
39
51
  'POST',
@@ -41,11 +53,11 @@ module Twilio
41
53
  data: data
42
54
  )
43
55
 
44
- EntityInstance.new(@version, payload, service_sid: @solution[:service_sid], )
56
+ WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], )
45
57
  end
46
58
 
47
59
  ##
48
- # Lists EntityInstance records from the API as a list.
60
+ # Lists WebhookInstance records from the API as a list.
49
61
  # Unlike stream(), this operation is eager and will load `limit` records into
50
62
  # memory before returning.
51
63
  # @param [Integer] limit Upper limit for the number of records to return. stream()
@@ -60,7 +72,7 @@ module Twilio
60
72
  end
61
73
 
62
74
  ##
63
- # Streams EntityInstance records from the API as an Enumerable.
75
+ # Streams WebhookInstance records from the API as an Enumerable.
64
76
  # This operation lazily loads records as efficiently as possible until the limit
65
77
  # is reached.
66
78
  # @param [Integer] limit Upper limit for the number of records to return. stream()
@@ -79,7 +91,7 @@ module Twilio
79
91
  end
80
92
 
81
93
  ##
82
- # When passed a block, yields EntityInstance records from the API.
94
+ # When passed a block, yields WebhookInstance records from the API.
83
95
  # This operation lazily loads records as efficiently as possible until the limit
84
96
  # is reached.
85
97
  def each
@@ -93,12 +105,12 @@ module Twilio
93
105
  end
94
106
 
95
107
  ##
96
- # Retrieve a single page of EntityInstance records from the API.
108
+ # Retrieve a single page of WebhookInstance records from the API.
97
109
  # Request is executed immediately.
98
110
  # @param [String] page_token PageToken provided by the API
99
111
  # @param [Integer] page_number Page Number, this value is simply for client state
100
112
  # @param [Integer] page_size Number of records to return, defaults to 50
101
- # @return [Page] Page of EntityInstance
113
+ # @return [Page] Page of WebhookInstance
102
114
  def page(page_token: :unset, page_number: :unset, page_size: :unset)
103
115
  params = Twilio::Values.of({
104
116
  'PageToken' => page_token,
@@ -110,38 +122,38 @@ module Twilio
110
122
  @uri,
111
123
  params
112
124
  )
113
- EntityPage.new(@version, response, @solution)
125
+ WebhookPage.new(@version, response, @solution)
114
126
  end
115
127
 
116
128
  ##
117
- # Retrieve a single page of EntityInstance records from the API.
129
+ # Retrieve a single page of WebhookInstance records from the API.
118
130
  # Request is executed immediately.
119
131
  # @param [String] target_url API-generated URL for the requested results page
120
- # @return [Page] Page of EntityInstance
132
+ # @return [Page] Page of WebhookInstance
121
133
  def get_page(target_url)
122
134
  response = @version.domain.request(
123
135
  'GET',
124
136
  target_url
125
137
  )
126
- EntityPage.new(@version, response, @solution)
138
+ WebhookPage.new(@version, response, @solution)
127
139
  end
128
140
 
129
141
  ##
130
142
  # Provide a user friendly representation
131
143
  def to_s
132
- '#<Twilio.Authy.V1.EntityList>'
144
+ '#<Twilio.Verify.V2.WebhookList>'
133
145
  end
134
146
  end
135
147
 
136
148
  ##
137
149
  # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
138
- class EntityPage < Page
150
+ class WebhookPage < Page
139
151
  ##
140
- # Initialize the EntityPage
152
+ # Initialize the WebhookPage
141
153
  # @param [Version] version Version that contains the resource
142
154
  # @param [Response] response Response from the API
143
155
  # @param [Hash] solution Path solution for the resource
144
- # @return [EntityPage] EntityPage
156
+ # @return [WebhookPage] WebhookPage
145
157
  def initialize(version, response, solution)
146
158
  super(version, response)
147
159
 
@@ -150,50 +162,76 @@ module Twilio
150
162
  end
151
163
 
152
164
  ##
153
- # Build an instance of EntityInstance
165
+ # Build an instance of WebhookInstance
154
166
  # @param [Hash] payload Payload response from the API
155
- # @return [EntityInstance] EntityInstance
167
+ # @return [WebhookInstance] WebhookInstance
156
168
  def get_instance(payload)
157
- EntityInstance.new(@version, payload, service_sid: @solution[:service_sid], )
169
+ WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], )
158
170
  end
159
171
 
160
172
  ##
161
173
  # Provide a user friendly representation
162
174
  def to_s
163
- '<Twilio.Authy.V1.EntityPage>'
175
+ '<Twilio.Verify.V2.WebhookPage>'
164
176
  end
165
177
  end
166
178
 
167
179
  ##
168
180
  # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
169
- class EntityContext < InstanceContext
181
+ class WebhookContext < InstanceContext
170
182
  ##
171
- # Initialize the EntityContext
183
+ # Initialize the WebhookContext
172
184
  # @param [Version] version Version that contains the resource
173
185
  # @param [String] service_sid The unique SID identifier of the Service.
174
- # @param [String] identity Customer unique identity for the Entity of the Service
175
- # @return [EntityContext] EntityContext
176
- def initialize(version, service_sid, identity)
186
+ # @param [String] sid The Twilio-provided string that uniquely identifies the
187
+ # Webhook resource to fetch.
188
+ # @return [WebhookContext] WebhookContext
189
+ def initialize(version, service_sid, sid)
177
190
  super(version)
178
191
 
179
192
  # Path Solution
180
- @solution = {service_sid: service_sid, identity: identity, }
181
- @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}"
193
+ @solution = {service_sid: service_sid, sid: sid, }
194
+ @uri = "/Services/#{@solution[:service_sid]}/Webhooks/#{@solution[:sid]}"
195
+ end
196
+
197
+ ##
198
+ # Update the WebhookInstance
199
+ # @param [String] friendly_name The string that you assigned to describe the
200
+ # webhook. **This value should not contain PII.**
201
+ # @param [String] event_types The array of events that this Webhook is subscribed
202
+ # to. Possible event types: `*, factor.deleted, factor.created, factor.verified,
203
+ # challenge.approved, challenge.denied`
204
+ # @param [String] webhook_url The URL associated with this Webhook.
205
+ # @param [webhook.Status] status The webhook status. Default value is `enabled`.
206
+ # One of: `enabled` or `disabled`
207
+ # @return [WebhookInstance] Updated WebhookInstance
208
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
209
+ data = Twilio::Values.of({
210
+ 'FriendlyName' => friendly_name,
211
+ 'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
212
+ 'WebhookUrl' => webhook_url,
213
+ 'Status' => status,
214
+ })
215
+
216
+ payload = @version.update(
217
+ 'POST',
218
+ @uri,
219
+ data: data,
220
+ )
182
221
 
183
- # Dependents
184
- @factors = nil
222
+ WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
185
223
  end
186
224
 
187
225
  ##
188
- # Deletes the EntityInstance
226
+ # Deletes the WebhookInstance
189
227
  # @return [Boolean] true if delete succeeds, false otherwise
190
228
  def delete
191
229
  @version.delete('delete', @uri)
192
230
  end
193
231
 
194
232
  ##
195
- # Fetch a EntityInstance
196
- # @return [EntityInstance] Fetched EntityInstance
233
+ # Fetch a WebhookInstance
234
+ # @return [WebhookInstance] Fetched WebhookInstance
197
235
  def fetch
198
236
  params = Twilio::Values.of({})
199
237
 
@@ -203,173 +241,181 @@ module Twilio
203
241
  params,
204
242
  )
205
243
 
206
- EntityInstance.new(
207
- @version,
208
- payload,
209
- service_sid: @solution[:service_sid],
210
- identity: @solution[:identity],
211
- )
212
- end
213
-
214
- ##
215
- # Access the factors
216
- # @return [FactorList]
217
- # @return [FactorContext] if sid was passed.
218
- def factors(sid=:unset)
219
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
220
-
221
- if sid != :unset
222
- return FactorContext.new(@version, @solution[:service_sid], @solution[:identity], sid, )
223
- end
224
-
225
- unless @factors
226
- @factors = FactorList.new(
227
- @version,
228
- service_sid: @solution[:service_sid],
229
- identity: @solution[:identity],
230
- )
231
- end
232
-
233
- @factors
244
+ WebhookInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
234
245
  end
235
246
 
236
247
  ##
237
248
  # Provide a user friendly representation
238
249
  def to_s
239
250
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
240
- "#<Twilio.Authy.V1.EntityContext #{context}>"
251
+ "#<Twilio.Verify.V2.WebhookContext #{context}>"
241
252
  end
242
253
 
243
254
  ##
244
255
  # Provide a detailed, user friendly representation
245
256
  def inspect
246
257
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
247
- "#<Twilio.Authy.V1.EntityContext #{context}>"
258
+ "#<Twilio.Verify.V2.WebhookContext #{context}>"
248
259
  end
249
260
  end
250
261
 
251
262
  ##
252
263
  # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
253
- class EntityInstance < InstanceResource
264
+ class WebhookInstance < InstanceResource
254
265
  ##
255
- # Initialize the EntityInstance
266
+ # Initialize the WebhookInstance
256
267
  # @param [Version] version Version that contains the resource
257
268
  # @param [Hash] payload payload that contains response from Twilio
258
269
  # @param [String] service_sid The unique SID identifier of the Service.
259
- # @param [String] identity Customer unique identity for the Entity of the Service
260
- # @return [EntityInstance] EntityInstance
261
- def initialize(version, payload, service_sid: nil, identity: nil)
270
+ # @param [String] sid The Twilio-provided string that uniquely identifies the
271
+ # Webhook resource to fetch.
272
+ # @return [WebhookInstance] WebhookInstance
273
+ def initialize(version, payload, service_sid: nil, sid: nil)
262
274
  super(version)
263
275
 
264
276
  # Marshaled Properties
265
277
  @properties = {
266
278
  'sid' => payload['sid'],
267
- 'identity' => payload['identity'],
268
- 'account_sid' => payload['account_sid'],
269
279
  'service_sid' => payload['service_sid'],
280
+ 'account_sid' => payload['account_sid'],
281
+ 'friendly_name' => payload['friendly_name'],
282
+ 'event_types' => payload['event_types'],
283
+ 'status' => payload['status'],
284
+ 'webhook_url' => payload['webhook_url'],
285
+ 'webhook_method' => payload['webhook_method'],
270
286
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
271
287
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
272
288
  'url' => payload['url'],
273
- 'links' => payload['links'],
274
289
  }
275
290
 
276
291
  # Context
277
292
  @instance_context = nil
278
- @params = {'service_sid' => service_sid, 'identity' => identity || @properties['identity'], }
293
+ @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
279
294
  end
280
295
 
281
296
  ##
282
297
  # Generate an instance context for the instance, the context is capable of
283
298
  # performing various actions. All instance actions are proxied to the context
284
- # @return [EntityContext] EntityContext for this EntityInstance
299
+ # @return [WebhookContext] WebhookContext for this WebhookInstance
285
300
  def context
286
301
  unless @instance_context
287
- @instance_context = EntityContext.new(@version, @params['service_sid'], @params['identity'], )
302
+ @instance_context = WebhookContext.new(@version, @params['service_sid'], @params['sid'], )
288
303
  end
289
304
  @instance_context
290
305
  end
291
306
 
292
307
  ##
293
- # @return [String] A string that uniquely identifies this Entity.
308
+ # @return [String] The unique string that identifies the resource
294
309
  def sid
295
310
  @properties['sid']
296
311
  end
297
312
 
298
313
  ##
299
- # @return [String] Unique identity of the Entity
300
- def identity
301
- @properties['identity']
314
+ # @return [String] Service Sid.
315
+ def service_sid
316
+ @properties['service_sid']
302
317
  end
303
318
 
304
319
  ##
305
- # @return [String] Account Sid.
320
+ # @return [String] The SID of the Account that created the resource
306
321
  def account_sid
307
322
  @properties['account_sid']
308
323
  end
309
324
 
310
325
  ##
311
- # @return [String] Service Sid.
312
- def service_sid
313
- @properties['service_sid']
326
+ # @return [String] The string that you assigned to describe the webhook
327
+ def friendly_name
328
+ @properties['friendly_name']
329
+ end
330
+
331
+ ##
332
+ # @return [String] The array of events that this Webhook is subscribed to.
333
+ def event_types
334
+ @properties['event_types']
314
335
  end
315
336
 
316
337
  ##
317
- # @return [Time] The date this Entity was created
338
+ # @return [webhook.Status] The webhook status
339
+ def status
340
+ @properties['status']
341
+ end
342
+
343
+ ##
344
+ # @return [String] The URL associated with this Webhook.
345
+ def webhook_url
346
+ @properties['webhook_url']
347
+ end
348
+
349
+ ##
350
+ # @return [webhook.Methods] The method used when calling the webhook's URL.
351
+ def webhook_method
352
+ @properties['webhook_method']
353
+ end
354
+
355
+ ##
356
+ # @return [Time] The RFC 2822 date and time in GMT when the resource was created
318
357
  def date_created
319
358
  @properties['date_created']
320
359
  end
321
360
 
322
361
  ##
323
- # @return [Time] The date this Entity was updated
362
+ # @return [Time] The RFC 2822 date and time in GMT when the resource was last updated
324
363
  def date_updated
325
364
  @properties['date_updated']
326
365
  end
327
366
 
328
367
  ##
329
- # @return [String] The URL of this resource.
368
+ # @return [String] The absolute URL of the Webhook resource
330
369
  def url
331
370
  @properties['url']
332
371
  end
333
372
 
334
373
  ##
335
- # @return [String] Nested resource URLs.
336
- def links
337
- @properties['links']
374
+ # Update the WebhookInstance
375
+ # @param [String] friendly_name The string that you assigned to describe the
376
+ # webhook. **This value should not contain PII.**
377
+ # @param [String] event_types The array of events that this Webhook is subscribed
378
+ # to. Possible event types: `*, factor.deleted, factor.created, factor.verified,
379
+ # challenge.approved, challenge.denied`
380
+ # @param [String] webhook_url The URL associated with this Webhook.
381
+ # @param [webhook.Status] status The webhook status. Default value is `enabled`.
382
+ # One of: `enabled` or `disabled`
383
+ # @return [WebhookInstance] Updated WebhookInstance
384
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
385
+ context.update(
386
+ friendly_name: friendly_name,
387
+ event_types: event_types,
388
+ webhook_url: webhook_url,
389
+ status: status,
390
+ )
338
391
  end
339
392
 
340
393
  ##
341
- # Deletes the EntityInstance
394
+ # Deletes the WebhookInstance
342
395
  # @return [Boolean] true if delete succeeds, false otherwise
343
396
  def delete
344
397
  context.delete
345
398
  end
346
399
 
347
400
  ##
348
- # Fetch a EntityInstance
349
- # @return [EntityInstance] Fetched EntityInstance
401
+ # Fetch a WebhookInstance
402
+ # @return [WebhookInstance] Fetched WebhookInstance
350
403
  def fetch
351
404
  context.fetch
352
405
  end
353
406
 
354
- ##
355
- # Access the factors
356
- # @return [factors] factors
357
- def factors
358
- context.factors
359
- end
360
-
361
407
  ##
362
408
  # Provide a user friendly representation
363
409
  def to_s
364
410
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
365
- "<Twilio.Authy.V1.EntityInstance #{values}>"
411
+ "<Twilio.Verify.V2.WebhookInstance #{values}>"
366
412
  end
367
413
 
368
414
  ##
369
415
  # Provide a detailed, user friendly representation
370
416
  def inspect
371
417
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
372
- "<Twilio.Authy.V1.EntityInstance #{values}>"
418
+ "<Twilio.Verify.V2.WebhookInstance #{values}>"
373
419
  end
374
420
  end
375
421
  end