twilio-ruby 5.67.0 → 5.67.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +29 -0
- data/Makefile +3 -2
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +6 -6
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +7 -0
- data/lib/twilio-ruby/rest/client.rb +0 -7
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +9 -9
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +23 -16
- data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +1 -1
- data/lib/twilio-ruby/rest/flex_api.rb +1 -1
- data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
- data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
- data/lib/twilio-ruby/rest/lookups.rb +7 -0
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +1 -1
- data/lib/twilio-ruby/rest/media/v1/media_recording.rb +4 -4
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -0
- data/lib/twilio-ruby/twiml/voice_response.rb +68 -5
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +4 -6
- data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +0 -314
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -459
- data/lib/twilio-ruby/rest/fax/v1.rb +0 -45
- data/lib/twilio-ruby/rest/fax.rb +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d37fa716f009ccbc9d5ee9811fc3189a03e7bcb
|
4
|
+
data.tar.gz: 6b6131fc2557ddc198144eb055c7fad105e53d8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bcc67be6b13ac0862a1940c6efaeb8d4ce9a16d6f087d52c07e936ab041ca2557a35b2373358e2788a96c6d80f8fb70f313d09fb8eaffb50e809c5c68367cd8
|
7
|
+
data.tar.gz: 30b767d5f2657da4388f0f1dfee239d4badf1c516c0e4736094507c017c9a58603f75750c558730d5ab74604141c175ef4474b1bd726555a8c423d5157499487
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,35 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2022-06-15] Version 5.67.3
|
5
|
+
---------------------------
|
6
|
+
**Lookups**
|
7
|
+
- Adding support for Lookup V2 API
|
8
|
+
|
9
|
+
**Studio**
|
10
|
+
- Corrected PII labels to be 30 days and added context to be PII
|
11
|
+
|
12
|
+
**Twiml**
|
13
|
+
- Add `statusCallbackMethod` attribute, nested `<Config` and `<Parameter>` elements to `<VirtualAgent>` noun.
|
14
|
+
- Add support for new Amazon Polly voices (Q2 2022) for `Say` verb
|
15
|
+
- Add support for `<Conversation>` noun
|
16
|
+
|
17
|
+
|
18
|
+
[2022-06-01] Version 5.67.2
|
19
|
+
---------------------------
|
20
|
+
**Library - Chore**
|
21
|
+
- [PR #608](https://github.com/twilio/twilio-ruby/pull/608): use Docker 'rc' tag for release candidate images. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
22
|
+
|
23
|
+
|
24
|
+
[2022-05-18] Version 5.67.1
|
25
|
+
---------------------------
|
26
|
+
**Api**
|
27
|
+
- Add property `media_url` to the recording resources
|
28
|
+
|
29
|
+
**Verify**
|
30
|
+
- Include `silent` as a channel type in the verifications API.
|
31
|
+
|
32
|
+
|
4
33
|
[2022-05-04] Version 5.67.0
|
5
34
|
---------------------------
|
6
35
|
**Library - Fix**
|
data/Makefile
CHANGED
@@ -17,13 +17,14 @@ authors:
|
|
17
17
|
git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
|
18
18
|
|
19
19
|
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
|
20
|
+
CURRENT_TAG=$(shell [[ "${GITHUB_TAG}" == *"-rc"* ]] && echo "rc" || echo "latest")
|
20
21
|
docker-build:
|
21
22
|
docker build -t twilio/twilio-ruby .
|
22
23
|
docker tag twilio/twilio-ruby twilio/twilio-ruby:${GITHUB_TAG}
|
23
24
|
docker tag twilio/twilio-ruby twilio/twilio-ruby:apidefs-${API_DEFINITIONS_SHA}
|
24
|
-
docker tag twilio/twilio-ruby twilio/twilio-ruby
|
25
|
+
docker tag twilio/twilio-ruby twilio/twilio-ruby:${CURRENT_TAG}
|
25
26
|
|
26
27
|
docker-push:
|
27
28
|
docker push twilio/twilio-ruby:${GITHUB_TAG}
|
28
29
|
docker push twilio/twilio-ruby:apidefs-${API_DEFINITIONS_SHA}
|
29
|
-
docker push twilio/twilio-ruby
|
30
|
+
docker push twilio/twilio-ruby:${CURRENT_TAG}
|
data/README.md
CHANGED
@@ -34,13 +34,13 @@ This library supports the following Ruby implementations:
|
|
34
34
|
To install using [Bundler][bundler] grab the latest stable version:
|
35
35
|
|
36
36
|
```ruby
|
37
|
-
gem 'twilio-ruby', '~> 5.67.
|
37
|
+
gem 'twilio-ruby', '~> 5.67.3'
|
38
38
|
```
|
39
39
|
|
40
40
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
41
41
|
|
42
42
|
```bash
|
43
|
-
gem install twilio-ruby -v 5.67.
|
43
|
+
gem install twilio-ruby -v 5.67.3
|
44
44
|
```
|
45
45
|
|
46
46
|
To build and install the development branch yourself from the latest source:
|
@@ -52,7 +52,7 @@ module Twilio
|
|
52
52
|
# overwritten with `currency` field. Leave blank or set to 0 to tokenize.
|
53
53
|
# @param [String] currency The currency of the `charge_amount`, formatted as {ISO
|
54
54
|
# 4127}[http://www.iso.org/iso/home/standards/currency_codes.htm] format. The
|
55
|
-
# default value is `USD` and all values allowed from the
|
55
|
+
# default value is `USD` and all values allowed from the Pay Connector are
|
56
56
|
# accepted.
|
57
57
|
# @param [String] description The description can be used to provide more details
|
58
58
|
# regarding the transaction. This information is submitted along with the payment
|
@@ -68,9 +68,9 @@ module Twilio
|
|
68
68
|
# that has to be included here depends on the <Pay> Connector. {Read
|
69
69
|
# more}[https://www.twilio.com/console/voice/pay-connectors].
|
70
70
|
# @param [String] payment_connector This is the unique name corresponding to the
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
71
|
+
# Pay Connector installed in the Twilio Add-ons. Learn more about {<Pay>
|
72
|
+
# Connectors}[https://www.twilio.com/console/voice/pay-connectors]. The default
|
73
|
+
# value is `Default`.
|
74
74
|
# @param [payment.PaymentMethod] payment_method Type of payment being captured.
|
75
75
|
# One of `credit-card` or `ach-debit`. The default value is `credit-card`.
|
76
76
|
# @param [Boolean] postal_code Indicates whether the credit card postal code (zip
|
@@ -202,7 +202,7 @@ module Twilio
|
|
202
202
|
# @param [payment.Status] status Indicates whether the current payment session
|
203
203
|
# should be cancelled or completed. When `cancel` the payment session is
|
204
204
|
# cancelled. When `complete`, Twilio sends the payment information to the selected
|
205
|
-
#
|
205
|
+
# Pay Connector for processing.
|
206
206
|
# @return [PaymentInstance] Updated PaymentInstance
|
207
207
|
def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset)
|
208
208
|
data = Twilio::Values.of({
|
@@ -342,7 +342,7 @@ module Twilio
|
|
342
342
|
# @param [payment.Status] status Indicates whether the current payment session
|
343
343
|
# should be cancelled or completed. When `cancel` the payment session is
|
344
344
|
# cancelled. When `complete`, Twilio sends the payment information to the selected
|
345
|
-
#
|
345
|
+
# Pay Connector for processing.
|
346
346
|
# @return [PaymentInstance] Updated PaymentInstance
|
347
347
|
def update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset)
|
348
348
|
context.update(
|
@@ -335,6 +335,7 @@ module Twilio
|
|
335
335
|
'uri' => payload['uri'],
|
336
336
|
'encryption_details' => payload['encryption_details'],
|
337
337
|
'subresource_uris' => payload['subresource_uris'],
|
338
|
+
'media_url' => payload['media_url'],
|
338
339
|
}
|
339
340
|
|
340
341
|
# Context
|
@@ -461,6 +462,12 @@ module Twilio
|
|
461
462
|
@properties['subresource_uris']
|
462
463
|
end
|
463
464
|
|
465
|
+
##
|
466
|
+
# @return [String] The URL of the media file.
|
467
|
+
def media_url
|
468
|
+
@properties['media_url']
|
469
|
+
end
|
470
|
+
|
464
471
|
##
|
465
472
|
# Fetch the RecordingInstance
|
466
473
|
# @param [Boolean] include_soft_deleted A boolean parameter indicating whether to
|
@@ -36,7 +36,6 @@ module Twilio
|
|
36
36
|
@chat = nil
|
37
37
|
@conversations = nil
|
38
38
|
@events = nil
|
39
|
-
@fax = nil
|
40
39
|
@flex_api = nil
|
41
40
|
@frontline_api = nil
|
42
41
|
@insights = nil
|
@@ -198,12 +197,6 @@ module Twilio
|
|
198
197
|
@events ||= Events.new self
|
199
198
|
end
|
200
199
|
|
201
|
-
##
|
202
|
-
# Access the Fax Twilio Domain
|
203
|
-
def fax
|
204
|
-
@fax ||= Fax.new self
|
205
|
-
end
|
206
|
-
|
207
200
|
##
|
208
201
|
# Access the FlexApi Twilio Domain
|
209
202
|
def flex_api
|
data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb
CHANGED
@@ -16,8 +16,8 @@ module Twilio
|
|
16
16
|
##
|
17
17
|
# Initialize the InteractionChannelInviteList
|
18
18
|
# @param [Version] version Version that contains the resource
|
19
|
-
# @param [String] interaction_sid The
|
20
|
-
# @param [String] channel_sid The
|
19
|
+
# @param [String] interaction_sid The Interaction SID for this Channel.
|
20
|
+
# @param [String] channel_sid The Channel SID for this Invite.
|
21
21
|
# @return [InteractionChannelInviteList] InteractionChannelInviteList
|
22
22
|
def initialize(version, interaction_sid: nil, channel_sid: nil)
|
23
23
|
super(version)
|
@@ -29,7 +29,7 @@ module Twilio
|
|
29
29
|
|
30
30
|
##
|
31
31
|
# Create the InteractionChannelInviteInstance
|
32
|
-
# @param [Hash] routing The routing
|
32
|
+
# @param [Hash] routing The Interaction's routing logic.
|
33
33
|
# @return [InteractionChannelInviteInstance] Created InteractionChannelInviteInstance
|
34
34
|
def create(routing: nil)
|
35
35
|
data = Twilio::Values.of({'Routing' => Twilio.serialize_object(routing), })
|
@@ -170,8 +170,8 @@ module Twilio
|
|
170
170
|
# Initialize the InteractionChannelInviteInstance
|
171
171
|
# @param [Version] version Version that contains the resource
|
172
172
|
# @param [Hash] payload payload that contains response from Twilio
|
173
|
-
# @param [String] interaction_sid The
|
174
|
-
# @param [String] channel_sid The
|
173
|
+
# @param [String] interaction_sid The Interaction SID for this Channel.
|
174
|
+
# @param [String] channel_sid The Channel SID for this Invite.
|
175
175
|
# @return [InteractionChannelInviteInstance] InteractionChannelInviteInstance
|
176
176
|
def initialize(version, payload, interaction_sid: nil, channel_sid: nil)
|
177
177
|
super(version)
|
@@ -187,25 +187,25 @@ module Twilio
|
|
187
187
|
end
|
188
188
|
|
189
189
|
##
|
190
|
-
# @return [String] The
|
190
|
+
# @return [String] The unique string that identifies the resource
|
191
191
|
def sid
|
192
192
|
@properties['sid']
|
193
193
|
end
|
194
194
|
|
195
195
|
##
|
196
|
-
# @return [String] The
|
196
|
+
# @return [String] The Interaction SID for this Channel
|
197
197
|
def interaction_sid
|
198
198
|
@properties['interaction_sid']
|
199
199
|
end
|
200
200
|
|
201
201
|
##
|
202
|
-
# @return [String] The
|
202
|
+
# @return [String] The Channel SID for this Invite
|
203
203
|
def channel_sid
|
204
204
|
@properties['channel_sid']
|
205
205
|
end
|
206
206
|
|
207
207
|
##
|
208
|
-
# @return [Hash]
|
208
|
+
# @return [Hash] A JSON object representing the routing rules for the Interaction Channel
|
209
209
|
def routing
|
210
210
|
@properties['routing']
|
211
211
|
end
|
@@ -15,7 +15,8 @@ module Twilio
|
|
15
15
|
##
|
16
16
|
# Initialize the InteractionChannelList
|
17
17
|
# @param [Version] version Version that contains the resource
|
18
|
-
# @param [String] interaction_sid The
|
18
|
+
# @param [String] interaction_sid The unique string created by Twilio to identify
|
19
|
+
# an Interaction resource, prefixed with KD.
|
19
20
|
# @return [InteractionChannelList] InteractionChannelList
|
20
21
|
def initialize(version, interaction_sid: nil)
|
21
22
|
super(version)
|
@@ -145,8 +146,10 @@ module Twilio
|
|
145
146
|
##
|
146
147
|
# Initialize the InteractionChannelContext
|
147
148
|
# @param [Version] version Version that contains the resource
|
148
|
-
# @param [String] interaction_sid The
|
149
|
-
#
|
149
|
+
# @param [String] interaction_sid The unique string created by Twilio to identify
|
150
|
+
# an Interaction resource, prefixed with KD.
|
151
|
+
# @param [String] sid The unique string created by Twilio to identify an
|
152
|
+
# Interaction Channel resource, prefixed with UO.
|
150
153
|
# @return [InteractionChannelContext] InteractionChannelContext
|
151
154
|
def initialize(version, interaction_sid, sid)
|
152
155
|
super(version)
|
@@ -176,11 +179,12 @@ module Twilio
|
|
176
179
|
|
177
180
|
##
|
178
181
|
# Update the InteractionChannelInstance
|
179
|
-
# @param [interaction_channel.Status] status
|
180
|
-
#
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
182
|
+
# @param [interaction_channel.Status] status Required. Indicates the Interaction
|
183
|
+
# channel's status. When a channel is set to `closed`, all tasks are put in the
|
184
|
+
# `wrapping` state by default unless the Routing status is set to `closed` in
|
185
|
+
# which case the tasks will be `completed`. Value: `closed`.
|
186
|
+
# @param [Hash] routing Optional. The state of associated tasks. If not specified,
|
187
|
+
# all tasks will be set to `wrapping`.
|
184
188
|
# @return [InteractionChannelInstance] Updated InteractionChannelInstance
|
185
189
|
def update(status: nil, routing: :unset)
|
186
190
|
data = Twilio::Values.of({'Status' => status, 'Routing' => Twilio.serialize_object(routing), })
|
@@ -258,8 +262,10 @@ module Twilio
|
|
258
262
|
# Initialize the InteractionChannelInstance
|
259
263
|
# @param [Version] version Version that contains the resource
|
260
264
|
# @param [Hash] payload payload that contains response from Twilio
|
261
|
-
# @param [String] interaction_sid The
|
262
|
-
#
|
265
|
+
# @param [String] interaction_sid The unique string created by Twilio to identify
|
266
|
+
# an Interaction resource, prefixed with KD.
|
267
|
+
# @param [String] sid The unique string created by Twilio to identify an
|
268
|
+
# Interaction Channel resource, prefixed with UO.
|
263
269
|
# @return [InteractionChannelInstance] InteractionChannelInstance
|
264
270
|
def initialize(version, payload, interaction_sid: nil, sid: nil)
|
265
271
|
super(version)
|
@@ -300,7 +306,7 @@ module Twilio
|
|
300
306
|
end
|
301
307
|
|
302
308
|
##
|
303
|
-
# @return [String] The
|
309
|
+
# @return [String] The unique string that identifies the resource
|
304
310
|
def interaction_sid
|
305
311
|
@properties['interaction_sid']
|
306
312
|
end
|
@@ -332,11 +338,12 @@ module Twilio
|
|
332
338
|
|
333
339
|
##
|
334
340
|
# Update the InteractionChannelInstance
|
335
|
-
# @param [interaction_channel.Status] status
|
336
|
-
#
|
337
|
-
#
|
338
|
-
#
|
339
|
-
#
|
341
|
+
# @param [interaction_channel.Status] status Required. Indicates the Interaction
|
342
|
+
# channel's status. When a channel is set to `closed`, all tasks are put in the
|
343
|
+
# `wrapping` state by default unless the Routing status is set to `closed` in
|
344
|
+
# which case the tasks will be `completed`. Value: `closed`.
|
345
|
+
# @param [Hash] routing Optional. The state of associated tasks. If not specified,
|
346
|
+
# all tasks will be set to `wrapping`.
|
340
347
|
# @return [InteractionChannelInstance] Updated InteractionChannelInstance
|
341
348
|
def update(status: nil, routing: :unset)
|
342
349
|
context.update(status: status, routing: routing, )
|
@@ -54,7 +54,7 @@ module Twilio
|
|
54
54
|
|
55
55
|
##
|
56
56
|
# @param [String] sid The unique string created by Twilio to identify an
|
57
|
-
# Interaction resource.
|
57
|
+
# Interaction resource, prefixed with KD.
|
58
58
|
# @return [Twilio::REST::Flex_api::V1::InteractionInstance] if sid was passed.
|
59
59
|
# @return [Twilio::REST::Flex_api::V1::InteractionList]
|
60
60
|
def interaction(sid=:unset)
|
@@ -0,0 +1,268 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Lookups < Domain
|
12
|
+
class V2 < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
15
|
+
class PhoneNumberList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the PhoneNumberList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [PhoneNumberList] PhoneNumberList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'#<Twilio.Lookups.V2.PhoneNumberList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
36
|
+
class PhoneNumberPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the PhoneNumberPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [PhoneNumberPage] PhoneNumberPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of PhoneNumberInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [PhoneNumberInstance] PhoneNumberInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
PhoneNumberInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.Lookups.V2.PhoneNumberPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
67
|
+
class PhoneNumberContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the PhoneNumberContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @param [String] phone_number The phone number to lookup in E.164 or national
|
72
|
+
# format. Default country code is +1 (North America).
|
73
|
+
# @return [PhoneNumberContext] PhoneNumberContext
|
74
|
+
def initialize(version, phone_number)
|
75
|
+
super(version)
|
76
|
+
|
77
|
+
# Path Solution
|
78
|
+
@solution = {phone_number: phone_number, }
|
79
|
+
@uri = "/PhoneNumbers/#{@solution[:phone_number]}"
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Fetch the PhoneNumberInstance
|
84
|
+
# @param [String] fields A comma-separated list of fields to return. Possible
|
85
|
+
# values are caller_name, sim_swap, call_forwarding, live_activity,
|
86
|
+
# enhanced_line_type or line_type_intelligence.
|
87
|
+
# @param [String] country_code The {country
|
88
|
+
# code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] used if the phone number
|
89
|
+
# provided is in national format.
|
90
|
+
# @return [PhoneNumberInstance] Fetched PhoneNumberInstance
|
91
|
+
def fetch(fields: :unset, country_code: :unset)
|
92
|
+
params = Twilio::Values.of({'Fields' => fields, 'CountryCode' => country_code, })
|
93
|
+
|
94
|
+
payload = @version.fetch('GET', @uri, params: params)
|
95
|
+
|
96
|
+
PhoneNumberInstance.new(@version, payload, phone_number: @solution[:phone_number], )
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Provide a user friendly representation
|
101
|
+
def to_s
|
102
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
103
|
+
"#<Twilio.Lookups.V2.PhoneNumberContext #{context}>"
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Provide a detailed, user friendly representation
|
108
|
+
def inspect
|
109
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
110
|
+
"#<Twilio.Lookups.V2.PhoneNumberContext #{context}>"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
116
|
+
class PhoneNumberInstance < InstanceResource
|
117
|
+
##
|
118
|
+
# Initialize the PhoneNumberInstance
|
119
|
+
# @param [Version] version Version that contains the resource
|
120
|
+
# @param [Hash] payload payload that contains response from Twilio
|
121
|
+
# @param [String] phone_number The phone number to lookup in E.164 or national
|
122
|
+
# format. Default country code is +1 (North America).
|
123
|
+
# @return [PhoneNumberInstance] PhoneNumberInstance
|
124
|
+
def initialize(version, payload, phone_number: nil)
|
125
|
+
super(version)
|
126
|
+
|
127
|
+
# Marshaled Properties
|
128
|
+
@properties = {
|
129
|
+
'calling_country_code' => payload['calling_country_code'],
|
130
|
+
'country_code' => payload['country_code'],
|
131
|
+
'phone_number' => payload['phone_number'],
|
132
|
+
'national_format' => payload['national_format'],
|
133
|
+
'valid' => payload['valid'],
|
134
|
+
'validation_errors' => payload['validation_errors'],
|
135
|
+
'caller_name' => payload['caller_name'],
|
136
|
+
'sim_swap' => payload['sim_swap'],
|
137
|
+
'call_forwarding' => payload['call_forwarding'],
|
138
|
+
'live_activity' => payload['live_activity'],
|
139
|
+
'enhanced_line_type' => payload['enhanced_line_type'],
|
140
|
+
'line_type_intelligence' => payload['line_type_intelligence'],
|
141
|
+
'url' => payload['url'],
|
142
|
+
}
|
143
|
+
|
144
|
+
# Context
|
145
|
+
@instance_context = nil
|
146
|
+
@params = {'phone_number' => phone_number || @properties['phone_number'], }
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Generate an instance context for the instance, the context is capable of
|
151
|
+
# performing various actions. All instance actions are proxied to the context
|
152
|
+
# @return [PhoneNumberContext] PhoneNumberContext for this PhoneNumberInstance
|
153
|
+
def context
|
154
|
+
unless @instance_context
|
155
|
+
@instance_context = PhoneNumberContext.new(@version, @params['phone_number'], )
|
156
|
+
end
|
157
|
+
@instance_context
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# @return [String] International dialing prefix
|
162
|
+
def calling_country_code
|
163
|
+
@properties['calling_country_code']
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# @return [String] Phone number's ISO country code
|
168
|
+
def country_code
|
169
|
+
@properties['country_code']
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# @return [String] Phone number in E.164 format
|
174
|
+
def phone_number
|
175
|
+
@properties['phone_number']
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# @return [String] Phone number in national format
|
180
|
+
def national_format
|
181
|
+
@properties['national_format']
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# @return [Boolean] Boolean which indicates if the phone number is valid
|
186
|
+
def valid
|
187
|
+
@properties['valid']
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# @return [Array[phone_number.ValidationError]] Contains reasons why a phone number is invalid
|
192
|
+
def validation_errors
|
193
|
+
@properties['validation_errors']
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# @return [Hash] An object that contains caller name information
|
198
|
+
def caller_name
|
199
|
+
@properties['caller_name']
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# @return [Hash] An object that contains SIM swap information
|
204
|
+
def sim_swap
|
205
|
+
@properties['sim_swap']
|
206
|
+
end
|
207
|
+
|
208
|
+
##
|
209
|
+
# @return [Hash] An object that contains call forwarding status information
|
210
|
+
def call_forwarding
|
211
|
+
@properties['call_forwarding']
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
# @return [Hash] An object that contains live activity information
|
216
|
+
def live_activity
|
217
|
+
@properties['live_activity']
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# @return [Hash] An object that contains line type information
|
222
|
+
def enhanced_line_type
|
223
|
+
@properties['enhanced_line_type']
|
224
|
+
end
|
225
|
+
|
226
|
+
##
|
227
|
+
# @return [Hash] An object that contains line type information
|
228
|
+
def line_type_intelligence
|
229
|
+
@properties['line_type_intelligence']
|
230
|
+
end
|
231
|
+
|
232
|
+
##
|
233
|
+
# @return [String] The absolute URL of the resource
|
234
|
+
def url
|
235
|
+
@properties['url']
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# Fetch the PhoneNumberInstance
|
240
|
+
# @param [String] fields A comma-separated list of fields to return. Possible
|
241
|
+
# values are caller_name, sim_swap, call_forwarding, live_activity,
|
242
|
+
# enhanced_line_type or line_type_intelligence.
|
243
|
+
# @param [String] country_code The {country
|
244
|
+
# code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] used if the phone number
|
245
|
+
# provided is in national format.
|
246
|
+
# @return [PhoneNumberInstance] Fetched PhoneNumberInstance
|
247
|
+
def fetch(fields: :unset, country_code: :unset)
|
248
|
+
context.fetch(fields: fields, country_code: country_code, )
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Provide a user friendly representation
|
253
|
+
def to_s
|
254
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
255
|
+
"<Twilio.Lookups.V2.PhoneNumberInstance #{values}>"
|
256
|
+
end
|
257
|
+
|
258
|
+
##
|
259
|
+
# Provide a detailed, user friendly representation
|
260
|
+
def inspect
|
261
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
262
|
+
"<Twilio.Lookups.V2.PhoneNumberInstance #{values}>"
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Lookups
|
12
|
+
class V2 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V2 version of Lookups
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v2'
|
18
|
+
@phone_numbers = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [String] phone_number The phone number to lookup in E.164 or national
|
23
|
+
# format. Default country code is +1 (North America).
|
24
|
+
# @return [Twilio::REST::Lookups::V2::PhoneNumberContext] if phone_number was passed.
|
25
|
+
# @return [Twilio::REST::Lookups::V2::PhoneNumberList]
|
26
|
+
def phone_numbers(phone_number=:unset)
|
27
|
+
if phone_number.nil?
|
28
|
+
raise ArgumentError, 'phone_number cannot be nil'
|
29
|
+
end
|
30
|
+
if phone_number == :unset
|
31
|
+
@phone_numbers ||= PhoneNumberList.new self
|
32
|
+
else
|
33
|
+
PhoneNumberContext.new(self, phone_number)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Provide a user friendly representation
|
39
|
+
def to_s
|
40
|
+
'<Twilio::REST::Lookups::V2>'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -20,6 +20,7 @@ module Twilio
|
|
20
20
|
|
21
21
|
# Versions
|
22
22
|
@v1 = nil
|
23
|
+
@v2 = nil
|
23
24
|
end
|
24
25
|
|
25
26
|
##
|
@@ -28,6 +29,12 @@ module Twilio
|
|
28
29
|
@v1 ||= V1.new self
|
29
30
|
end
|
30
31
|
|
32
|
+
##
|
33
|
+
# Version v2 of lookups
|
34
|
+
def v2
|
35
|
+
@v2 ||= V2.new self
|
36
|
+
end
|
37
|
+
|
31
38
|
##
|
32
39
|
# @param [String] phone_number The phone number in
|
33
40
|
# {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, which consists
|