twilio-ruby 5.12.1 → 5.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +12 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +1 -1
- data/lib/twilio-ruby/rest/preview.rb +8 -8
- data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
- data/lib/twilio-ruby/rest/preview/understand/assistant.rb +47 -19
- data/lib/twilio-ruby/rest/preview/understand/assistant/assistant_fallback_actions.rb +215 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/assistant_initiation_actions.rb +215 -0
- data/lib/twilio-ruby/rest/preview/understand/assistant/intent.rb +33 -6
- data/lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb +246 -0
- data/lib/twilio-ruby/rest/pricing.rb +9 -2
- data/lib/twilio-ruby/rest/pricing/v2.rb +35 -0
- data/lib/twilio-ruby/rest/pricing/v2/voice.rb +126 -0
- data/lib/twilio-ruby/rest/pricing/v2/voice/country.rb +281 -0
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +3 -3
- data/lib/twilio-ruby/rest/video.rb +9 -9
- data/lib/twilio-ruby/rest/video/v1.rb +16 -16
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/preview/understand/assistant/assistant_fallback_actions_spec.rb +81 -0
- data/spec/integration/preview/understand/assistant/assistant_initiation_actions_spec.rb +81 -0
- data/spec/integration/preview/understand/assistant/intent/intent_actions_spec.rb +87 -0
- data/spec/integration/preview/understand/assistant/intent_spec.rb +4 -0
- data/spec/integration/preview/understand/assistant_spec.rb +12 -8
- data/spec/integration/pricing/v2/voice/country_spec.rb +181 -0
- data/spec/integration/pricing/v2/voice_spec.rb +12 -0
- metadata +19 -3
@@ -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 pricing
|
34
|
+
def v2
|
35
|
+
@v2 ||= V2.new self
|
36
|
+
end
|
37
|
+
|
31
38
|
##
|
32
39
|
# @return [Twilio::REST::Pricing::V1::MessagingInstance]
|
33
40
|
def messaging
|
@@ -41,9 +48,9 @@ module Twilio
|
|
41
48
|
end
|
42
49
|
|
43
50
|
##
|
44
|
-
# @return [Twilio::REST::Pricing::
|
51
|
+
# @return [Twilio::REST::Pricing::V2::VoiceInstance]
|
45
52
|
def voice
|
46
|
-
self.
|
53
|
+
self.v2.voice()
|
47
54
|
end
|
48
55
|
|
49
56
|
##
|
@@ -0,0 +1,35 @@
|
|
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 Pricing
|
12
|
+
class V2 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V2 version of Pricing
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v2'
|
18
|
+
@voice = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @return [Twilio::REST::Pricing::V2::VoiceContext]
|
23
|
+
def voice
|
24
|
+
@voice ||= VoiceList.new self
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'<Twilio::REST::Pricing::V2>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,126 @@
|
|
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 Pricing < Domain
|
12
|
+
class V2 < Version
|
13
|
+
class VoiceList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the VoiceList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [VoiceList] VoiceList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
|
24
|
+
# Components
|
25
|
+
@countries = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Access the countries
|
30
|
+
# @param [String] iso_country This fetches the origin-based voice pricing
|
31
|
+
# information for a specific country
|
32
|
+
# @return [CountryList]
|
33
|
+
# @return [CountryContext] if iso_country was passed.
|
34
|
+
def countries(iso_country=:unset)
|
35
|
+
raise ArgumentError, 'iso_country cannot be nil' if iso_country.nil?
|
36
|
+
|
37
|
+
if iso_country != :unset
|
38
|
+
return CountryContext.new(@version, iso_country, )
|
39
|
+
end
|
40
|
+
|
41
|
+
@countries ||= CountryList.new(@version, )
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Provide a user friendly representation
|
46
|
+
def to_s
|
47
|
+
'#<Twilio.Pricing.V2.VoiceList>'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class VoicePage < Page
|
52
|
+
##
|
53
|
+
# Initialize the VoicePage
|
54
|
+
# @param [Version] version Version that contains the resource
|
55
|
+
# @param [Response] response Response from the API
|
56
|
+
# @param [Hash] solution Path solution for the resource
|
57
|
+
# @return [VoicePage] VoicePage
|
58
|
+
def initialize(version, response, solution)
|
59
|
+
super(version, response)
|
60
|
+
|
61
|
+
# Path Solution
|
62
|
+
@solution = solution
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Build an instance of VoiceInstance
|
67
|
+
# @param [Hash] payload Payload response from the API
|
68
|
+
# @return [VoiceInstance] VoiceInstance
|
69
|
+
def get_instance(payload)
|
70
|
+
VoiceInstance.new(@version, payload, )
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Provide a user friendly representation
|
75
|
+
def to_s
|
76
|
+
'<Twilio.Pricing.V2.VoicePage>'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class VoiceInstance < InstanceResource
|
81
|
+
##
|
82
|
+
# Initialize the VoiceInstance
|
83
|
+
# @param [Version] version Version that contains the resource
|
84
|
+
# @param [Hash] payload payload that contains response from Twilio
|
85
|
+
# @return [VoiceInstance] VoiceInstance
|
86
|
+
def initialize(version, payload)
|
87
|
+
super(version)
|
88
|
+
|
89
|
+
# Marshaled Properties
|
90
|
+
@properties = {'name' => payload['name'], 'url' => payload['url'], 'links' => payload['links'], }
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# @return [String] The name
|
95
|
+
def name
|
96
|
+
@properties['name']
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# @return [String] The url
|
101
|
+
def url
|
102
|
+
@properties['url']
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# @return [String] The links
|
107
|
+
def links
|
108
|
+
@properties['links']
|
109
|
+
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# Provide a user friendly representation
|
113
|
+
def to_s
|
114
|
+
"<Twilio.Pricing.V2.VoiceInstance>"
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Provide a detailed, user friendly representation
|
119
|
+
def inspect
|
120
|
+
"<Twilio.Pricing.V2.VoiceInstance>"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,281 @@
|
|
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 Pricing < Domain
|
12
|
+
class V2 < Version
|
13
|
+
class VoiceList < ListResource
|
14
|
+
class CountryList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the CountryList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @return [CountryList] CountryList
|
19
|
+
def initialize(version)
|
20
|
+
super(version)
|
21
|
+
|
22
|
+
# Path Solution
|
23
|
+
@solution = {}
|
24
|
+
@uri = "/Voice/Countries"
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Lists CountryInstance records from the API as a list.
|
29
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
30
|
+
# memory before returning.
|
31
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
32
|
+
# guarantees to never return more than limit. Default is no limit
|
33
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
34
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
35
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
36
|
+
# efficient page size, i.e. min(limit, 1000)
|
37
|
+
# @return [Array] Array of up to limit results
|
38
|
+
def list(limit: nil, page_size: nil)
|
39
|
+
self.stream(limit: limit, page_size: page_size).entries
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Streams CountryInstance records from the API as an Enumerable.
|
44
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
45
|
+
# is reached.
|
46
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
47
|
+
# guarantees to never return more than limit. Default is no limit.
|
48
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
49
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
50
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
51
|
+
# efficient page size, i.e. min(limit, 1000)
|
52
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
53
|
+
def stream(limit: nil, page_size: nil)
|
54
|
+
limits = @version.read_limits(limit, page_size)
|
55
|
+
|
56
|
+
page = self.page(page_size: limits[:page_size], )
|
57
|
+
|
58
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# When passed a block, yields CountryInstance records from the API.
|
63
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
64
|
+
# is reached.
|
65
|
+
def each
|
66
|
+
limits = @version.read_limits
|
67
|
+
|
68
|
+
page = self.page(page_size: limits[:page_size], )
|
69
|
+
|
70
|
+
@version.stream(page,
|
71
|
+
limit: limits[:limit],
|
72
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Retrieve a single page of CountryInstance records from the API.
|
77
|
+
# Request is executed immediately.
|
78
|
+
# @param [String] page_token PageToken provided by the API
|
79
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
80
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
81
|
+
# @return [Page] Page of CountryInstance
|
82
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
83
|
+
params = Twilio::Values.of({
|
84
|
+
'PageToken' => page_token,
|
85
|
+
'Page' => page_number,
|
86
|
+
'PageSize' => page_size,
|
87
|
+
})
|
88
|
+
response = @version.page(
|
89
|
+
'GET',
|
90
|
+
@uri,
|
91
|
+
params
|
92
|
+
)
|
93
|
+
CountryPage.new(@version, response, @solution)
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# Retrieve a single page of CountryInstance records from the API.
|
98
|
+
# Request is executed immediately.
|
99
|
+
# @param [String] target_url API-generated URL for the requested results page
|
100
|
+
# @return [Page] Page of CountryInstance
|
101
|
+
def get_page(target_url)
|
102
|
+
response = @version.domain.request(
|
103
|
+
'GET',
|
104
|
+
target_url
|
105
|
+
)
|
106
|
+
CountryPage.new(@version, response, @solution)
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Provide a user friendly representation
|
111
|
+
def to_s
|
112
|
+
'#<Twilio.Pricing.V2.CountryList>'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
class CountryPage < Page
|
117
|
+
##
|
118
|
+
# Initialize the CountryPage
|
119
|
+
# @param [Version] version Version that contains the resource
|
120
|
+
# @param [Response] response Response from the API
|
121
|
+
# @param [Hash] solution Path solution for the resource
|
122
|
+
# @return [CountryPage] CountryPage
|
123
|
+
def initialize(version, response, solution)
|
124
|
+
super(version, response)
|
125
|
+
|
126
|
+
# Path Solution
|
127
|
+
@solution = solution
|
128
|
+
end
|
129
|
+
|
130
|
+
##
|
131
|
+
# Build an instance of CountryInstance
|
132
|
+
# @param [Hash] payload Payload response from the API
|
133
|
+
# @return [CountryInstance] CountryInstance
|
134
|
+
def get_instance(payload)
|
135
|
+
CountryInstance.new(@version, payload, )
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# Provide a user friendly representation
|
140
|
+
def to_s
|
141
|
+
'<Twilio.Pricing.V2.CountryPage>'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class CountryContext < InstanceContext
|
146
|
+
##
|
147
|
+
# Initialize the CountryContext
|
148
|
+
# @param [Version] version Version that contains the resource
|
149
|
+
# @param [String] iso_country This fetches the origin-based voice pricing
|
150
|
+
# information for a specific country
|
151
|
+
# @return [CountryContext] CountryContext
|
152
|
+
def initialize(version, iso_country)
|
153
|
+
super(version)
|
154
|
+
|
155
|
+
# Path Solution
|
156
|
+
@solution = {iso_country: iso_country, }
|
157
|
+
@uri = "/Voice/Countries/#{@solution[:iso_country]}"
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Fetch a CountryInstance
|
162
|
+
# @return [CountryInstance] Fetched CountryInstance
|
163
|
+
def fetch
|
164
|
+
params = Twilio::Values.of({})
|
165
|
+
|
166
|
+
payload = @version.fetch(
|
167
|
+
'GET',
|
168
|
+
@uri,
|
169
|
+
params,
|
170
|
+
)
|
171
|
+
|
172
|
+
CountryInstance.new(@version, payload, iso_country: @solution[:iso_country], )
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# Provide a user friendly representation
|
177
|
+
def to_s
|
178
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
179
|
+
"#<Twilio.Pricing.V2.CountryContext #{context}>"
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
class CountryInstance < InstanceResource
|
184
|
+
##
|
185
|
+
# Initialize the CountryInstance
|
186
|
+
# @param [Version] version Version that contains the resource
|
187
|
+
# @param [Hash] payload payload that contains response from Twilio
|
188
|
+
# @param [String] iso_country This fetches the origin-based voice pricing
|
189
|
+
# information for a specific country
|
190
|
+
# @return [CountryInstance] CountryInstance
|
191
|
+
def initialize(version, payload, iso_country: nil)
|
192
|
+
super(version)
|
193
|
+
|
194
|
+
# Marshaled Properties
|
195
|
+
@properties = {
|
196
|
+
'country' => payload['country'],
|
197
|
+
'iso_country' => payload['iso_country'],
|
198
|
+
'url' => payload['url'],
|
199
|
+
'outbound_prefix_prices' => payload['outbound_prefix_prices'],
|
200
|
+
'inbound_call_prices' => payload['inbound_call_prices'],
|
201
|
+
'price_unit' => payload['price_unit'],
|
202
|
+
}
|
203
|
+
|
204
|
+
# Context
|
205
|
+
@instance_context = nil
|
206
|
+
@params = {'iso_country' => iso_country || @properties['iso_country'], }
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Generate an instance context for the instance, the context is capable of
|
211
|
+
# performing various actions. All instance actions are proxied to the context
|
212
|
+
# @return [CountryContext] CountryContext for this CountryInstance
|
213
|
+
def context
|
214
|
+
unless @instance_context
|
215
|
+
@instance_context = CountryContext.new(@version, @params['iso_country'], )
|
216
|
+
end
|
217
|
+
@instance_context
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# @return [String] Name of the country
|
222
|
+
def country
|
223
|
+
@properties['country']
|
224
|
+
end
|
225
|
+
|
226
|
+
##
|
227
|
+
# @return [String] The ISO country code
|
228
|
+
def iso_country
|
229
|
+
@properties['iso_country']
|
230
|
+
end
|
231
|
+
|
232
|
+
##
|
233
|
+
# @return [String] List of OutboundPrefixPriceWithOrigin records
|
234
|
+
def outbound_prefix_prices
|
235
|
+
@properties['outbound_prefix_prices']
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# @return [String] List of InboundCallPrice records
|
240
|
+
def inbound_call_prices
|
241
|
+
@properties['inbound_call_prices']
|
242
|
+
end
|
243
|
+
|
244
|
+
##
|
245
|
+
# @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy).
|
246
|
+
def price_unit
|
247
|
+
@properties['price_unit']
|
248
|
+
end
|
249
|
+
|
250
|
+
##
|
251
|
+
# @return [String] The URL of this resource.
|
252
|
+
def url
|
253
|
+
@properties['url']
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# Fetch a CountryInstance
|
258
|
+
# @return [CountryInstance] Fetched CountryInstance
|
259
|
+
def fetch
|
260
|
+
context.fetch
|
261
|
+
end
|
262
|
+
|
263
|
+
##
|
264
|
+
# Provide a user friendly representation
|
265
|
+
def to_s
|
266
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
267
|
+
"<Twilio.Pricing.V2.CountryInstance #{values}>"
|
268
|
+
end
|
269
|
+
|
270
|
+
##
|
271
|
+
# Provide a detailed, user friendly representation
|
272
|
+
def inspect
|
273
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
274
|
+
"<Twilio.Pricing.V2.CountryInstance #{values}>"
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|