twilio-ruby 5.21.2 → 5.22.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.
- checksums.yaml +4 -4
- data/CHANGES.md +13 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +2 -6
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +3 -1
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +15 -9
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +5 -5
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +47 -43
- data/lib/twilio-ruby/rest/lookups/v1.rb +3 -1
- data/lib/twilio-ruby/rest/lookups.rb +3 -3
- data/lib/twilio-ruby/rest/messaging/v1/session/webhook.rb +448 -0
- data/lib/twilio-ruby/rest/messaging/v1/session.rb +26 -0
- data/lib/twilio-ruby/rest/messaging/v1/webhook.rb +15 -2
- data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +11 -7
- data/lib/twilio-ruby/rest/pricing/v1/messaging.rb +3 -1
- data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +11 -7
- data/lib/twilio-ruby/rest/pricing/v1/phone_number.rb +3 -1
- data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +11 -7
- data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +8 -8
- data/lib/twilio-ruby/rest/pricing/v1/voice.rb +4 -2
- data/lib/twilio-ruby/rest/pricing/v2/voice/country.rb +11 -9
- data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +23 -13
- data/lib/twilio-ruby/rest/pricing/v2/voice.rb +10 -7
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb +1 -1
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +343 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +209 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +507 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +43 -0
- data/lib/twilio-ruby/rest/verify.rb +10 -3
- data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/bulk_country_update.rb +1 -1
- data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/country/highrisk_special_prefix.rb +1 -1
- data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/country.rb +1 -1
- data/lib/twilio-ruby/rest/voice/v1/{voice_permission → dialing_permissions}/settings.rb +1 -1
- data/lib/twilio-ruby/rest/voice/v1/{voice_permission.rb → dialing_permissions.rb} +16 -16
- data/lib/twilio-ruby/rest/voice/v1.rb +4 -4
- data/lib/twilio-ruby/rest/voice.rb +3 -3
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +15 -2
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/queue/member_spec.rb +50 -9
- data/spec/integration/api/v2010/account/queue_spec.rb +16 -10
- data/spec/integration/lookups/v1/phone_number_spec.rb +263 -2
- data/spec/integration/messaging/v1/session/webhook_spec.rb +300 -0
- data/spec/integration/messaging/v1/session_spec.rb +8 -4
- data/spec/integration/messaging/v1/webhook_spec.rb +2 -0
- data/spec/integration/verify/v2/service/verification_check_spec.rb +54 -0
- data/spec/integration/verify/v2/service/verification_spec.rb +169 -0
- data/spec/integration/verify/v2/service_spec.rb +231 -0
- data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/bulk_country_update_spec.rb +2 -2
- data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/country/highrisk_special_prefix_spec.rb +3 -3
- data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/country_spec.rb +4 -4
- data/spec/integration/voice/v1/{voice_permission → dialing_permissions}/settings_spec.rb +4 -4
- data/spec/integration/voice/v1/{voice_permission_spec.rb → dialing_permissions_spec.rb} +1 -1
- data/spec/integration/wireless/v1/sim_spec.rb +3 -0
- metadata +31 -18
@@ -0,0 +1,209 @@
|
|
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 Verify < Domain
|
12
|
+
class V2 < Version
|
13
|
+
class ServiceContext < InstanceContext
|
14
|
+
##
|
15
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
16
|
+
class VerificationCheckList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the VerificationCheckList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] service_sid The unique SID identifier of the Service.
|
21
|
+
# @return [VerificationCheckList] VerificationCheckList
|
22
|
+
def initialize(version, service_sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {service_sid: service_sid}
|
27
|
+
@uri = "/Services/#{@solution[:service_sid]}/VerificationCheck"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Retrieve a single page of VerificationCheckInstance records from the API.
|
32
|
+
# Request is executed immediately.
|
33
|
+
# @param [String] code The 4-10 character string being verified
|
34
|
+
# @param [String] to The To phone number of the phone being verified
|
35
|
+
# @param [String] verification_sid A SID that uniquely identifies this
|
36
|
+
# Verification Check, either this parameter or the To phone number must be
|
37
|
+
# specified
|
38
|
+
# @param [String] amount Amount of the associated PSD2 compliant transaction.
|
39
|
+
# Requires the PSD2 Service flag enabled.
|
40
|
+
# @param [String] payee Payee of the associated PSD2 compliant transaction.
|
41
|
+
# Requires the PSD2 Service flag enabled.
|
42
|
+
# @return [VerificationCheckInstance] Newly created VerificationCheckInstance
|
43
|
+
def create(code: nil, to: :unset, verification_sid: :unset, amount: :unset, payee: :unset)
|
44
|
+
data = Twilio::Values.of({
|
45
|
+
'Code' => code,
|
46
|
+
'To' => to,
|
47
|
+
'VerificationSid' => verification_sid,
|
48
|
+
'Amount' => amount,
|
49
|
+
'Payee' => payee,
|
50
|
+
})
|
51
|
+
|
52
|
+
payload = @version.create(
|
53
|
+
'POST',
|
54
|
+
@uri,
|
55
|
+
data: data
|
56
|
+
)
|
57
|
+
|
58
|
+
VerificationCheckInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Provide a user friendly representation
|
63
|
+
def to_s
|
64
|
+
'#<Twilio.Verify.V2.VerificationCheckList>'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
70
|
+
class VerificationCheckPage < Page
|
71
|
+
##
|
72
|
+
# Initialize the VerificationCheckPage
|
73
|
+
# @param [Version] version Version that contains the resource
|
74
|
+
# @param [Response] response Response from the API
|
75
|
+
# @param [Hash] solution Path solution for the resource
|
76
|
+
# @return [VerificationCheckPage] VerificationCheckPage
|
77
|
+
def initialize(version, response, solution)
|
78
|
+
super(version, response)
|
79
|
+
|
80
|
+
# Path Solution
|
81
|
+
@solution = solution
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Build an instance of VerificationCheckInstance
|
86
|
+
# @param [Hash] payload Payload response from the API
|
87
|
+
# @return [VerificationCheckInstance] VerificationCheckInstance
|
88
|
+
def get_instance(payload)
|
89
|
+
VerificationCheckInstance.new(@version, payload, service_sid: @solution[:service_sid], )
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Provide a user friendly representation
|
94
|
+
def to_s
|
95
|
+
'<Twilio.Verify.V2.VerificationCheckPage>'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
101
|
+
class VerificationCheckInstance < InstanceResource
|
102
|
+
##
|
103
|
+
# Initialize the VerificationCheckInstance
|
104
|
+
# @param [Version] version Version that contains the resource
|
105
|
+
# @param [Hash] payload payload that contains response from Twilio
|
106
|
+
# @param [String] service_sid The unique SID identifier of the Service.
|
107
|
+
# @return [VerificationCheckInstance] VerificationCheckInstance
|
108
|
+
def initialize(version, payload, service_sid: nil)
|
109
|
+
super(version)
|
110
|
+
|
111
|
+
# Marshaled Properties
|
112
|
+
@properties = {
|
113
|
+
'sid' => payload['sid'],
|
114
|
+
'service_sid' => payload['service_sid'],
|
115
|
+
'account_sid' => payload['account_sid'],
|
116
|
+
'to' => payload['to'],
|
117
|
+
'channel' => payload['channel'],
|
118
|
+
'status' => payload['status'],
|
119
|
+
'valid' => payload['valid'],
|
120
|
+
'amount' => payload['amount'],
|
121
|
+
'payee' => payload['payee'],
|
122
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
123
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# @return [String] A string that uniquely identifies this Verification Check.
|
129
|
+
def sid
|
130
|
+
@properties['sid']
|
131
|
+
end
|
132
|
+
|
133
|
+
##
|
134
|
+
# @return [String] Service Sid.
|
135
|
+
def service_sid
|
136
|
+
@properties['service_sid']
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# @return [String] Account Sid.
|
141
|
+
def account_sid
|
142
|
+
@properties['account_sid']
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# @return [String] To phone number
|
147
|
+
def to
|
148
|
+
@properties['to']
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# @return [verification_check.Channel] sms or call
|
153
|
+
def channel
|
154
|
+
@properties['channel']
|
155
|
+
end
|
156
|
+
|
157
|
+
##
|
158
|
+
# @return [String] pending, approved, denied or expired
|
159
|
+
def status
|
160
|
+
@properties['status']
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# @return [Boolean] successful verification
|
165
|
+
def valid
|
166
|
+
@properties['valid']
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# @return [String] Amount of the associated PSD2 compliant transaction.
|
171
|
+
def amount
|
172
|
+
@properties['amount']
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# @return [String] Payee of the associated PSD2 compliant transaction.
|
177
|
+
def payee
|
178
|
+
@properties['payee']
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# @return [Time] The date this Verification Check was created
|
183
|
+
def date_created
|
184
|
+
@properties['date_created']
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# @return [Time] The date this Verification Check was updated
|
189
|
+
def date_updated
|
190
|
+
@properties['date_updated']
|
191
|
+
end
|
192
|
+
|
193
|
+
##
|
194
|
+
# Provide a user friendly representation
|
195
|
+
def to_s
|
196
|
+
"<Twilio.Verify.V2.VerificationCheckInstance>"
|
197
|
+
end
|
198
|
+
|
199
|
+
##
|
200
|
+
# Provide a detailed, user friendly representation
|
201
|
+
def inspect
|
202
|
+
"<Twilio.Verify.V2.VerificationCheckInstance>"
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
@@ -0,0 +1,507 @@
|
|
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 Verify < 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 ServiceList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the ServiceList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [ServiceList] ServiceList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Services"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
30
|
+
# Request is executed immediately.
|
31
|
+
# @param [String] friendly_name A 1-64 character string with friendly name of
|
32
|
+
# service
|
33
|
+
# @param [String] code_length The length of the verification code to be generated.
|
34
|
+
# Must be an integer value between 4-10
|
35
|
+
# @param [Boolean] lookup_enabled Boolean value that indicates if a lookup should
|
36
|
+
# be performed with each verification started and associated info returned
|
37
|
+
# @param [Boolean] skip_sms_to_landlines Boolean value that indicates whether or
|
38
|
+
# not to ignore SMS verifications for landlines, depends on lookup_enabled flag
|
39
|
+
# @param [Boolean] dtmf_input_required Boolean value that indicates whether or not
|
40
|
+
# to require a random number input to deliver the verify code via phone calls
|
41
|
+
# @param [String] tts_name Alternative to be used as Service friendly name in
|
42
|
+
# phone calls, only applies to TTS languages
|
43
|
+
# @param [Boolean] psd2_enabled Boolean value that enables to pass PSD2
|
44
|
+
# transaction parameters when starting a verification
|
45
|
+
# @return [ServiceInstance] Newly created ServiceInstance
|
46
|
+
def create(friendly_name: nil, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
|
47
|
+
data = Twilio::Values.of({
|
48
|
+
'FriendlyName' => friendly_name,
|
49
|
+
'CodeLength' => code_length,
|
50
|
+
'LookupEnabled' => lookup_enabled,
|
51
|
+
'SkipSmsToLandlines' => skip_sms_to_landlines,
|
52
|
+
'DtmfInputRequired' => dtmf_input_required,
|
53
|
+
'TtsName' => tts_name,
|
54
|
+
'Psd2Enabled' => psd2_enabled,
|
55
|
+
})
|
56
|
+
|
57
|
+
payload = @version.create(
|
58
|
+
'POST',
|
59
|
+
@uri,
|
60
|
+
data: data
|
61
|
+
)
|
62
|
+
|
63
|
+
ServiceInstance.new(@version, payload, )
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# Lists ServiceInstance records from the API as a list.
|
68
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
69
|
+
# memory before returning.
|
70
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
71
|
+
# guarantees to never return more than limit. Default is no limit
|
72
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
73
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
74
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
75
|
+
# efficient page size, i.e. min(limit, 1000)
|
76
|
+
# @return [Array] Array of up to limit results
|
77
|
+
def list(limit: nil, page_size: nil)
|
78
|
+
self.stream(limit: limit, page_size: page_size).entries
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Streams ServiceInstance records from the API as an Enumerable.
|
83
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
84
|
+
# is reached.
|
85
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
86
|
+
# guarantees to never return more than limit. Default is no limit.
|
87
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
88
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
89
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
90
|
+
# efficient page size, i.e. min(limit, 1000)
|
91
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
92
|
+
def stream(limit: nil, page_size: nil)
|
93
|
+
limits = @version.read_limits(limit, page_size)
|
94
|
+
|
95
|
+
page = self.page(page_size: limits[:page_size], )
|
96
|
+
|
97
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# When passed a block, yields ServiceInstance records from the API.
|
102
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
103
|
+
# is reached.
|
104
|
+
def each
|
105
|
+
limits = @version.read_limits
|
106
|
+
|
107
|
+
page = self.page(page_size: limits[:page_size], )
|
108
|
+
|
109
|
+
@version.stream(page,
|
110
|
+
limit: limits[:limit],
|
111
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
116
|
+
# Request is executed immediately.
|
117
|
+
# @param [String] page_token PageToken provided by the API
|
118
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
119
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
120
|
+
# @return [Page] Page of ServiceInstance
|
121
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
122
|
+
params = Twilio::Values.of({
|
123
|
+
'PageToken' => page_token,
|
124
|
+
'Page' => page_number,
|
125
|
+
'PageSize' => page_size,
|
126
|
+
})
|
127
|
+
response = @version.page(
|
128
|
+
'GET',
|
129
|
+
@uri,
|
130
|
+
params
|
131
|
+
)
|
132
|
+
ServicePage.new(@version, response, @solution)
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Retrieve a single page of ServiceInstance records from the API.
|
137
|
+
# Request is executed immediately.
|
138
|
+
# @param [String] target_url API-generated URL for the requested results page
|
139
|
+
# @return [Page] Page of ServiceInstance
|
140
|
+
def get_page(target_url)
|
141
|
+
response = @version.domain.request(
|
142
|
+
'GET',
|
143
|
+
target_url
|
144
|
+
)
|
145
|
+
ServicePage.new(@version, response, @solution)
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# Provide a user friendly representation
|
150
|
+
def to_s
|
151
|
+
'#<Twilio.Verify.V2.ServiceList>'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
157
|
+
class ServicePage < Page
|
158
|
+
##
|
159
|
+
# Initialize the ServicePage
|
160
|
+
# @param [Version] version Version that contains the resource
|
161
|
+
# @param [Response] response Response from the API
|
162
|
+
# @param [Hash] solution Path solution for the resource
|
163
|
+
# @return [ServicePage] ServicePage
|
164
|
+
def initialize(version, response, solution)
|
165
|
+
super(version, response)
|
166
|
+
|
167
|
+
# Path Solution
|
168
|
+
@solution = solution
|
169
|
+
end
|
170
|
+
|
171
|
+
##
|
172
|
+
# Build an instance of ServiceInstance
|
173
|
+
# @param [Hash] payload Payload response from the API
|
174
|
+
# @return [ServiceInstance] ServiceInstance
|
175
|
+
def get_instance(payload)
|
176
|
+
ServiceInstance.new(@version, payload, )
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# Provide a user friendly representation
|
181
|
+
def to_s
|
182
|
+
'<Twilio.Verify.V2.ServicePage>'
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
##
|
187
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
188
|
+
class ServiceContext < InstanceContext
|
189
|
+
##
|
190
|
+
# Initialize the ServiceContext
|
191
|
+
# @param [Version] version Version that contains the resource
|
192
|
+
# @param [String] sid The unique SID identifier of Verification Service Instance.
|
193
|
+
# @return [ServiceContext] ServiceContext
|
194
|
+
def initialize(version, sid)
|
195
|
+
super(version)
|
196
|
+
|
197
|
+
# Path Solution
|
198
|
+
@solution = {sid: sid, }
|
199
|
+
@uri = "/Services/#{@solution[:sid]}"
|
200
|
+
|
201
|
+
# Dependents
|
202
|
+
@verifications = nil
|
203
|
+
@verification_checks = nil
|
204
|
+
end
|
205
|
+
|
206
|
+
##
|
207
|
+
# Fetch a ServiceInstance
|
208
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
209
|
+
def fetch
|
210
|
+
params = Twilio::Values.of({})
|
211
|
+
|
212
|
+
payload = @version.fetch(
|
213
|
+
'GET',
|
214
|
+
@uri,
|
215
|
+
params,
|
216
|
+
)
|
217
|
+
|
218
|
+
ServiceInstance.new(@version, payload, sid: @solution[:sid], )
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# Deletes the ServiceInstance
|
223
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
224
|
+
def delete
|
225
|
+
@version.delete('delete', @uri)
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# Update the ServiceInstance
|
230
|
+
# @param [String] friendly_name A 1-64 character string with friendly name of
|
231
|
+
# service
|
232
|
+
# @param [String] code_length The length of the verification code to be generated.
|
233
|
+
# Must be an integer value between 4-10
|
234
|
+
# @param [Boolean] lookup_enabled Boolean value that indicates if a lookup should
|
235
|
+
# be performed with each verification started and associated info returned
|
236
|
+
# @param [Boolean] skip_sms_to_landlines Boolean value that indicates whether or
|
237
|
+
# not to ignore SMS verifications for landlines, depends on lookup_enabled flag
|
238
|
+
# @param [Boolean] dtmf_input_required Boolean value that indicates whether or not
|
239
|
+
# to require a random number input to deliver the verify code via phone calls
|
240
|
+
# @param [String] tts_name Alternative to be used as Service friendly name in
|
241
|
+
# phone calls, only applies to TTS languages
|
242
|
+
# @param [Boolean] psd2_enabled Boolean value that enables to pass PSD2
|
243
|
+
# transaction parameters when starting a verification
|
244
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
245
|
+
def update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
|
246
|
+
data = Twilio::Values.of({
|
247
|
+
'FriendlyName' => friendly_name,
|
248
|
+
'CodeLength' => code_length,
|
249
|
+
'LookupEnabled' => lookup_enabled,
|
250
|
+
'SkipSmsToLandlines' => skip_sms_to_landlines,
|
251
|
+
'DtmfInputRequired' => dtmf_input_required,
|
252
|
+
'TtsName' => tts_name,
|
253
|
+
'Psd2Enabled' => psd2_enabled,
|
254
|
+
})
|
255
|
+
|
256
|
+
payload = @version.update(
|
257
|
+
'POST',
|
258
|
+
@uri,
|
259
|
+
data: data,
|
260
|
+
)
|
261
|
+
|
262
|
+
ServiceInstance.new(@version, payload, sid: @solution[:sid], )
|
263
|
+
end
|
264
|
+
|
265
|
+
##
|
266
|
+
# Access the verifications
|
267
|
+
# @return [VerificationList]
|
268
|
+
# @return [VerificationContext] if sid was passed.
|
269
|
+
def verifications(sid=:unset)
|
270
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
271
|
+
|
272
|
+
if sid != :unset
|
273
|
+
return VerificationContext.new(@version, @solution[:sid], sid, )
|
274
|
+
end
|
275
|
+
|
276
|
+
unless @verifications
|
277
|
+
@verifications = VerificationList.new(@version, service_sid: @solution[:sid], )
|
278
|
+
end
|
279
|
+
|
280
|
+
@verifications
|
281
|
+
end
|
282
|
+
|
283
|
+
##
|
284
|
+
# Access the verification_checks
|
285
|
+
# @return [VerificationCheckList]
|
286
|
+
# @return [VerificationCheckContext]
|
287
|
+
def verification_checks
|
288
|
+
unless @verification_checks
|
289
|
+
@verification_checks = VerificationCheckList.new(@version, service_sid: @solution[:sid], )
|
290
|
+
end
|
291
|
+
|
292
|
+
@verification_checks
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# Provide a user friendly representation
|
297
|
+
def to_s
|
298
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
299
|
+
"#<Twilio.Verify.V2.ServiceContext #{context}>"
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# Provide a detailed, user friendly representation
|
304
|
+
def inspect
|
305
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
306
|
+
"#<Twilio.Verify.V2.ServiceContext #{context}>"
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
##
|
311
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
312
|
+
class ServiceInstance < InstanceResource
|
313
|
+
##
|
314
|
+
# Initialize the ServiceInstance
|
315
|
+
# @param [Version] version Version that contains the resource
|
316
|
+
# @param [Hash] payload payload that contains response from Twilio
|
317
|
+
# @param [String] sid The unique SID identifier of Verification Service Instance.
|
318
|
+
# @return [ServiceInstance] ServiceInstance
|
319
|
+
def initialize(version, payload, sid: nil)
|
320
|
+
super(version)
|
321
|
+
|
322
|
+
# Marshaled Properties
|
323
|
+
@properties = {
|
324
|
+
'sid' => payload['sid'],
|
325
|
+
'account_sid' => payload['account_sid'],
|
326
|
+
'friendly_name' => payload['friendly_name'],
|
327
|
+
'code_length' => payload['code_length'].to_i,
|
328
|
+
'lookup_enabled' => payload['lookup_enabled'],
|
329
|
+
'psd2_enabled' => payload['psd2_enabled'],
|
330
|
+
'skip_sms_to_landlines' => payload['skip_sms_to_landlines'],
|
331
|
+
'dtmf_input_required' => payload['dtmf_input_required'],
|
332
|
+
'tts_name' => payload['tts_name'],
|
333
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
334
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
335
|
+
'url' => payload['url'],
|
336
|
+
'links' => payload['links'],
|
337
|
+
}
|
338
|
+
|
339
|
+
# Context
|
340
|
+
@instance_context = nil
|
341
|
+
@params = {'sid' => sid || @properties['sid'], }
|
342
|
+
end
|
343
|
+
|
344
|
+
##
|
345
|
+
# Generate an instance context for the instance, the context is capable of
|
346
|
+
# performing various actions. All instance actions are proxied to the context
|
347
|
+
# @return [ServiceContext] ServiceContext for this ServiceInstance
|
348
|
+
def context
|
349
|
+
unless @instance_context
|
350
|
+
@instance_context = ServiceContext.new(@version, @params['sid'], )
|
351
|
+
end
|
352
|
+
@instance_context
|
353
|
+
end
|
354
|
+
|
355
|
+
##
|
356
|
+
# @return [String] A string that uniquely identifies this Service.
|
357
|
+
def sid
|
358
|
+
@properties['sid']
|
359
|
+
end
|
360
|
+
|
361
|
+
##
|
362
|
+
# @return [String] Account Sid.
|
363
|
+
def account_sid
|
364
|
+
@properties['account_sid']
|
365
|
+
end
|
366
|
+
|
367
|
+
##
|
368
|
+
# @return [String] Friendly name of the service
|
369
|
+
def friendly_name
|
370
|
+
@properties['friendly_name']
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# @return [String] Length of verification code. Valid values are 4-10
|
375
|
+
def code_length
|
376
|
+
@properties['code_length']
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# @return [Boolean] Indicates whether or not to perform a lookup with each verification started
|
381
|
+
def lookup_enabled
|
382
|
+
@properties['lookup_enabled']
|
383
|
+
end
|
384
|
+
|
385
|
+
##
|
386
|
+
# @return [Boolean] Indicates whether PSD2 parameters are enabled or not
|
387
|
+
def psd2_enabled
|
388
|
+
@properties['psd2_enabled']
|
389
|
+
end
|
390
|
+
|
391
|
+
##
|
392
|
+
# @return [Boolean] Indicates whether or not to ignore SMS verifications for landlines
|
393
|
+
def skip_sms_to_landlines
|
394
|
+
@properties['skip_sms_to_landlines']
|
395
|
+
end
|
396
|
+
|
397
|
+
##
|
398
|
+
# @return [Boolean] Indicates whether or not to require a random number input to deliver the verify code via phone calls
|
399
|
+
def dtmf_input_required
|
400
|
+
@properties['dtmf_input_required']
|
401
|
+
end
|
402
|
+
|
403
|
+
##
|
404
|
+
# @return [String] Alternative to be used as Service friendly name in phone calls
|
405
|
+
def tts_name
|
406
|
+
@properties['tts_name']
|
407
|
+
end
|
408
|
+
|
409
|
+
##
|
410
|
+
# @return [Time] The date this Service was created
|
411
|
+
def date_created
|
412
|
+
@properties['date_created']
|
413
|
+
end
|
414
|
+
|
415
|
+
##
|
416
|
+
# @return [Time] The date this Service was updated
|
417
|
+
def date_updated
|
418
|
+
@properties['date_updated']
|
419
|
+
end
|
420
|
+
|
421
|
+
##
|
422
|
+
# @return [String] The url
|
423
|
+
def url
|
424
|
+
@properties['url']
|
425
|
+
end
|
426
|
+
|
427
|
+
##
|
428
|
+
# @return [String] The links
|
429
|
+
def links
|
430
|
+
@properties['links']
|
431
|
+
end
|
432
|
+
|
433
|
+
##
|
434
|
+
# Fetch a ServiceInstance
|
435
|
+
# @return [ServiceInstance] Fetched ServiceInstance
|
436
|
+
def fetch
|
437
|
+
context.fetch
|
438
|
+
end
|
439
|
+
|
440
|
+
##
|
441
|
+
# Deletes the ServiceInstance
|
442
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
443
|
+
def delete
|
444
|
+
context.delete
|
445
|
+
end
|
446
|
+
|
447
|
+
##
|
448
|
+
# Update the ServiceInstance
|
449
|
+
# @param [String] friendly_name A 1-64 character string with friendly name of
|
450
|
+
# service
|
451
|
+
# @param [String] code_length The length of the verification code to be generated.
|
452
|
+
# Must be an integer value between 4-10
|
453
|
+
# @param [Boolean] lookup_enabled Boolean value that indicates if a lookup should
|
454
|
+
# be performed with each verification started and associated info returned
|
455
|
+
# @param [Boolean] skip_sms_to_landlines Boolean value that indicates whether or
|
456
|
+
# not to ignore SMS verifications for landlines, depends on lookup_enabled flag
|
457
|
+
# @param [Boolean] dtmf_input_required Boolean value that indicates whether or not
|
458
|
+
# to require a random number input to deliver the verify code via phone calls
|
459
|
+
# @param [String] tts_name Alternative to be used as Service friendly name in
|
460
|
+
# phone calls, only applies to TTS languages
|
461
|
+
# @param [Boolean] psd2_enabled Boolean value that enables to pass PSD2
|
462
|
+
# transaction parameters when starting a verification
|
463
|
+
# @return [ServiceInstance] Updated ServiceInstance
|
464
|
+
def update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
|
465
|
+
context.update(
|
466
|
+
friendly_name: friendly_name,
|
467
|
+
code_length: code_length,
|
468
|
+
lookup_enabled: lookup_enabled,
|
469
|
+
skip_sms_to_landlines: skip_sms_to_landlines,
|
470
|
+
dtmf_input_required: dtmf_input_required,
|
471
|
+
tts_name: tts_name,
|
472
|
+
psd2_enabled: psd2_enabled,
|
473
|
+
)
|
474
|
+
end
|
475
|
+
|
476
|
+
##
|
477
|
+
# Access the verifications
|
478
|
+
# @return [verifications] verifications
|
479
|
+
def verifications
|
480
|
+
context.verifications
|
481
|
+
end
|
482
|
+
|
483
|
+
##
|
484
|
+
# Access the verification_checks
|
485
|
+
# @return [verification_checks] verification_checks
|
486
|
+
def verification_checks
|
487
|
+
context.verification_checks
|
488
|
+
end
|
489
|
+
|
490
|
+
##
|
491
|
+
# Provide a user friendly representation
|
492
|
+
def to_s
|
493
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
494
|
+
"<Twilio.Verify.V2.ServiceInstance #{values}>"
|
495
|
+
end
|
496
|
+
|
497
|
+
##
|
498
|
+
# Provide a detailed, user friendly representation
|
499
|
+
def inspect
|
500
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
501
|
+
"<Twilio.Verify.V2.ServiceInstance #{values}>"
|
502
|
+
end
|
503
|
+
end
|
504
|
+
end
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|