twilio-ruby 5.0.0.rc16 → 5.0.0.rc17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS.md +1 -0
- data/CHANGES.md +1 -1
- data/README.md +2 -2
- data/lib/twilio-ruby/jwt/access_token.rb +23 -1
- data/lib/twilio-ruby/rest/api.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account.rb +19 -11
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +29 -5
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +5 -5
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +25 -0
- data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +406 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +2 -6
- data/lib/twilio-ruby/rest/{notifications.rb → chat.rb} +6 -6
- data/lib/twilio-ruby/rest/{notifications → chat}/v1.rb +3 -3
- data/lib/twilio-ruby/rest/{notifications → chat}/v1/credential.rb +5 -5
- data/lib/twilio-ruby/rest/chat/v1/service.rb +501 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +468 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +351 -0
- data/lib/twilio-ruby/rest/{api/v2010/account/sms/sms_message.rb → chat/v1/service/channel/message.rb} +120 -168
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +373 -0
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +378 -0
- data/lib/twilio-ruby/rest/client.rb +19 -8
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +3 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -6
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +5 -1
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -0
- data/lib/twilio-ruby/rest/notify.rb +44 -0
- data/lib/twilio-ruby/rest/notify/v1.rb +44 -0
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +375 -0
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service.rb +5 -5
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/binding.rb +5 -5
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/notification.rb +4 -4
- data/lib/twilio-ruby/rest/preview.rb +11 -0
- data/lib/twilio-ruby/rest/preview/sync.rb +35 -0
- data/lib/twilio-ruby/rest/preview/sync/service.rb +458 -0
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +376 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +375 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +409 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +375 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +411 -0
- data/lib/twilio-ruby/rest/preview/wireless/device.rb +6 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +55 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +29 -6
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +294 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +32 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +374 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +6 -6
- data/spec/integration/api/v2010/account/recording_spec.rb +10 -1
- data/spec/integration/api/v2010/account/{sms/short_code_spec.rb → short_code_spec.rb} +0 -7
- data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +3 -7
- data/spec/integration/chat/v1/credential_spec.rb +223 -0
- data/spec/integration/chat/v1/service/channel/member_spec.rb +213 -0
- data/spec/integration/chat/v1/service/channel/message_spec.rb +100 -0
- data/spec/integration/chat/v1/service/channel_spec.rb +259 -0
- data/spec/integration/chat/v1/service/role_spec.rb +263 -0
- data/spec/integration/chat/v1/service/user_spec.rb +242 -0
- data/spec/integration/chat/v1/service_spec.rb +263 -0
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +2 -3
- data/spec/integration/ip_messaging/v1/service/user_spec.rb +2 -3
- data/spec/integration/lookups/v1/phone_number_spec.rb +5 -0
- data/spec/integration/{notifications → notify}/v1/credential_spec.rb +24 -24
- data/spec/integration/{notifications → notify}/v1/service/binding_spec.rb +29 -29
- data/spec/integration/{notifications → notify}/v1/service/notification_spec.rb +5 -5
- data/spec/integration/{notifications → notify}/v1/service_spec.rb +32 -32
- data/spec/integration/preview/sync/service/document_spec.rb +92 -0
- data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +100 -0
- data/spec/integration/preview/sync/service/sync_list_spec.rb +73 -0
- data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +101 -0
- data/spec/integration/preview/sync/service/sync_map_spec.rb +73 -0
- data/spec/integration/preview/sync/service_spec.rb +84 -0
- data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +127 -0
- data/spec/integration/taskrouter/v1/workspace/task_spec.rb +8 -0
- data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +201 -0
- data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +2 -3
- data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
- data/spec/jwt/access_token_spec.rb +27 -0
- metadata +84 -42
- data/lib/twilio-ruby/rest/api/v2010/account/sms.rb +0 -134
- data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -408
- data/spec/integration/api/v2010/account/sms/sms_message_spec.rb +0 -275
- data/spec/integration/api/v2010/account/sms_spec.rb +0 -10
@@ -1,408 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# \ / _ _ _| _ _
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
-
# / /
|
6
|
-
|
7
|
-
module Twilio
|
8
|
-
module REST
|
9
|
-
class Api < Domain
|
10
|
-
class V2010 < Version
|
11
|
-
class AccountContext < InstanceContext
|
12
|
-
class SmsList < ListResource
|
13
|
-
class ShortCodeList < ListResource
|
14
|
-
##
|
15
|
-
# Initialize the ShortCodeList
|
16
|
-
# @param [Version] version Version that contains the resource
|
17
|
-
# @param [String] account_sid A 34 character string that uniquely identifies this
|
18
|
-
# resource.
|
19
|
-
# @return [ShortCodeList] ShortCodeList
|
20
|
-
def initialize(version, account_sid: nil)
|
21
|
-
super(version)
|
22
|
-
|
23
|
-
# Path Solution
|
24
|
-
@solution = {
|
25
|
-
account_sid: account_sid
|
26
|
-
}
|
27
|
-
@uri = "/Accounts/#{@solution[:account_sid]}/SMS/ShortCodes.json"
|
28
|
-
end
|
29
|
-
|
30
|
-
##
|
31
|
-
# Lists ShortCodeInstance records from the API as a list.
|
32
|
-
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
|
-
# memory before returning.
|
34
|
-
# @param [String] friendly_name Only show the ShortCode resources with friendly
|
35
|
-
# names that exactly match this name
|
36
|
-
# @param [String] short_code Only show the ShortCode resources that match this
|
37
|
-
# pattern. You can specify partial numbers and use '*' as a wildcard for any digit
|
38
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
39
|
-
# guarantees to never return more than limit. Default is no limit
|
40
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
41
|
-
# the default value of 50 records. If no page_size is defined
|
42
|
-
# but a limit is defined, stream() will attempt to read the
|
43
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
44
|
-
# @return [Array] Array of up to limit results
|
45
|
-
def list(friendly_name: nil, short_code: nil, limit: nil, page_size: nil)
|
46
|
-
self.stream(
|
47
|
-
friendly_name: friendly_name,
|
48
|
-
short_code: short_code,
|
49
|
-
limit: limit,
|
50
|
-
page_size: page_size
|
51
|
-
).entries
|
52
|
-
end
|
53
|
-
|
54
|
-
##
|
55
|
-
# Streams ShortCodeInstance records from the API as an Enumerable.
|
56
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
57
|
-
# is reached.
|
58
|
-
# @param [String] friendly_name Only show the ShortCode resources with friendly
|
59
|
-
# names that exactly match this name
|
60
|
-
# @param [String] short_code Only show the ShortCode resources that match this
|
61
|
-
# pattern. You can specify partial numbers and use '*' as a wildcard for any digit
|
62
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
63
|
-
# guarantees to never return more than limit. Default is no limit
|
64
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
65
|
-
# the default value of 50 records. If no page_size is defined
|
66
|
-
# but a limit is defined, stream() will attempt to read the
|
67
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
68
|
-
# @return [Enumerable] Enumerable that will yield up to limit results
|
69
|
-
def stream(friendly_name: nil, short_code: nil, limit: nil, page_size: nil)
|
70
|
-
limits = @version.read_limits(limit, page_size)
|
71
|
-
|
72
|
-
page = self.page(
|
73
|
-
friendly_name: friendly_name,
|
74
|
-
short_code: short_code,
|
75
|
-
page_size: limits[:page_size],
|
76
|
-
)
|
77
|
-
|
78
|
-
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
79
|
-
end
|
80
|
-
|
81
|
-
##
|
82
|
-
# When passed a block, yields ShortCodeInstance records from the API.
|
83
|
-
# This operation lazily loads records as efficiently as possible until the limit
|
84
|
-
# is reached.
|
85
|
-
# @param [String] friendly_name Only show the ShortCode resources with friendly
|
86
|
-
# names that exactly match this name
|
87
|
-
# @param [String] short_code Only show the ShortCode resources that match this
|
88
|
-
# pattern. You can specify partial numbers and use '*' as a wildcard for any digit
|
89
|
-
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
90
|
-
# guarantees to never return more than limit. Default is no limit
|
91
|
-
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
92
|
-
# the default value of 50 records. If no page_size is defined
|
93
|
-
# but a limit is defined, stream() will attempt to read the
|
94
|
-
# limit with the most efficient page size, i.e. min(limit, 1000)
|
95
|
-
def each
|
96
|
-
limits = @version.read_limits
|
97
|
-
|
98
|
-
page = self.page(
|
99
|
-
page_size: limits[:page_size],
|
100
|
-
)
|
101
|
-
|
102
|
-
@version.stream(page,
|
103
|
-
limit: limits[:limit],
|
104
|
-
page_limit: limits[:page_limit]).each {|x| yield x}
|
105
|
-
end
|
106
|
-
|
107
|
-
##
|
108
|
-
# Retrieve a single page of ShortCodeInstance records from the API.
|
109
|
-
# Request is executed immediately.
|
110
|
-
# @param [String] friendly_name Only show the ShortCode resources with friendly
|
111
|
-
# names that exactly match this name
|
112
|
-
# @param [String] short_code Only show the ShortCode resources that match this
|
113
|
-
# pattern. You can specify partial numbers and use '*' as a wildcard for any digit
|
114
|
-
# @param [String] page_token PageToken provided by the API
|
115
|
-
# @param [Integer] page_number Page Number, this value is simply for client state
|
116
|
-
# @param [Integer] page_size Number of records to return, defaults to 50
|
117
|
-
# @return [Page] Page of ShortCodeInstance
|
118
|
-
def page(friendly_name: nil, short_code: nil, page_token: nil, page_number: nil, page_size: nil)
|
119
|
-
params = {
|
120
|
-
'FriendlyName' => friendly_name,
|
121
|
-
'ShortCode' => short_code,
|
122
|
-
'PageToken' => page_token,
|
123
|
-
'Page' => page_number,
|
124
|
-
'PageSize' => page_size,
|
125
|
-
}
|
126
|
-
response = @version.page(
|
127
|
-
'GET',
|
128
|
-
@uri,
|
129
|
-
params
|
130
|
-
)
|
131
|
-
return ShortCodePage.new(@version, response, @solution)
|
132
|
-
end
|
133
|
-
|
134
|
-
##
|
135
|
-
# Provide a user friendly representation
|
136
|
-
def to_s
|
137
|
-
'#<Twilio.Api.V2010.ShortCodeList>'
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
class ShortCodePage < Page
|
142
|
-
##
|
143
|
-
# Initialize the ShortCodePage
|
144
|
-
# @param [Version] version Version that contains the resource
|
145
|
-
# @param [Response] response Response from the API
|
146
|
-
# @param [Hash] solution Path solution for the resource
|
147
|
-
# @param [String] account_sid A 34 character string that uniquely identifies this
|
148
|
-
# resource.
|
149
|
-
# @return [ShortCodePage] ShortCodePage
|
150
|
-
def initialize(version, response, solution)
|
151
|
-
super(version, response)
|
152
|
-
|
153
|
-
# Path Solution
|
154
|
-
@solution = solution
|
155
|
-
end
|
156
|
-
|
157
|
-
##
|
158
|
-
# Build an instance of ShortCodeInstance
|
159
|
-
# @param [Hash] payload Payload response from the API
|
160
|
-
# @return [ShortCodeInstance] ShortCodeInstance
|
161
|
-
def get_instance(payload)
|
162
|
-
return ShortCodeInstance.new(
|
163
|
-
@version,
|
164
|
-
payload,
|
165
|
-
account_sid: @solution[:account_sid],
|
166
|
-
)
|
167
|
-
end
|
168
|
-
|
169
|
-
##
|
170
|
-
# Provide a user friendly representation
|
171
|
-
def to_s
|
172
|
-
'<Twilio.Api.V2010.ShortCodePage>'
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
class ShortCodeContext < InstanceContext
|
177
|
-
##
|
178
|
-
# Initialize the ShortCodeContext
|
179
|
-
# @param [Version] version Version that contains the resource
|
180
|
-
# @param [String] account_sid The account_sid
|
181
|
-
# @param [String] sid The short-code Sid that uniquely identifies this resource
|
182
|
-
# @return [ShortCodeContext] ShortCodeContext
|
183
|
-
def initialize(version, account_sid, sid)
|
184
|
-
super(version)
|
185
|
-
|
186
|
-
# Path Solution
|
187
|
-
@solution = {
|
188
|
-
account_sid: account_sid,
|
189
|
-
sid: sid,
|
190
|
-
}
|
191
|
-
@uri = "/Accounts/#{@solution[:account_sid]}/SMS/ShortCodes/#{@solution[:sid]}.json"
|
192
|
-
end
|
193
|
-
|
194
|
-
##
|
195
|
-
# Fetch a ShortCodeInstance
|
196
|
-
# @return [ShortCodeInstance] Fetched ShortCodeInstance
|
197
|
-
def fetch
|
198
|
-
params = {}
|
199
|
-
|
200
|
-
payload = @version.fetch(
|
201
|
-
'GET',
|
202
|
-
@uri,
|
203
|
-
params,
|
204
|
-
)
|
205
|
-
|
206
|
-
return ShortCodeInstance.new(
|
207
|
-
@version,
|
208
|
-
payload,
|
209
|
-
account_sid: @solution[:account_sid],
|
210
|
-
sid: @solution[:sid],
|
211
|
-
)
|
212
|
-
end
|
213
|
-
|
214
|
-
##
|
215
|
-
# Update the ShortCodeInstance
|
216
|
-
# @param [String] friendly_name A human readable descriptive text for this
|
217
|
-
# resource, up to 64 characters long. By default, the `FriendlyName` is just the
|
218
|
-
# short code.
|
219
|
-
# @param [String] api_version SMSs to this short code will start a new TwiML
|
220
|
-
# session with this API version.
|
221
|
-
# @param [String] sms_url The URL Twilio will request when receiving an incoming
|
222
|
-
# SMS message to this short code.
|
223
|
-
# @param [String] sms_method The HTTP method Twilio will use when making requests
|
224
|
-
# to the `SmsUrl`. Either `GET` or `POST`.
|
225
|
-
# @param [String] sms_fallback_url The URL that Twilio will request if an error
|
226
|
-
# occurs retrieving or executing the TwiML from `SmsUrl`.
|
227
|
-
# @param [String] sms_fallback_method The HTTP method Twilio will use when
|
228
|
-
# requesting the above URL. Either `GET` or `POST`.
|
229
|
-
# @return [ShortCodeInstance] Updated ShortCodeInstance
|
230
|
-
def update(friendly_name: nil, api_version: nil, sms_url: nil, sms_method: nil, sms_fallback_url: nil, sms_fallback_method: nil)
|
231
|
-
data = {
|
232
|
-
'FriendlyName' => friendly_name,
|
233
|
-
'ApiVersion' => api_version,
|
234
|
-
'SmsUrl' => sms_url,
|
235
|
-
'SmsMethod' => sms_method,
|
236
|
-
'SmsFallbackUrl' => sms_fallback_url,
|
237
|
-
'SmsFallbackMethod' => sms_fallback_method,
|
238
|
-
}
|
239
|
-
|
240
|
-
payload = @version.update(
|
241
|
-
'POST',
|
242
|
-
@uri,
|
243
|
-
data: data,
|
244
|
-
)
|
245
|
-
|
246
|
-
return ShortCodeInstance.new(
|
247
|
-
@version,
|
248
|
-
payload,
|
249
|
-
account_sid: @solution[:account_sid],
|
250
|
-
sid: @solution[:sid],
|
251
|
-
)
|
252
|
-
end
|
253
|
-
|
254
|
-
##
|
255
|
-
# Provide a user friendly representation
|
256
|
-
def to_s
|
257
|
-
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
258
|
-
"#<Twilio.Api.V2010.ShortCodeContext #{context}>"
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
class ShortCodeInstance < InstanceResource
|
263
|
-
##
|
264
|
-
# Initialize the ShortCodeInstance
|
265
|
-
# @param [Version] version Version that contains the resource
|
266
|
-
# @param [Hash] payload payload that contains response from Twilio
|
267
|
-
# @param [String] account_sid A 34 character string that uniquely identifies this
|
268
|
-
# resource.
|
269
|
-
# @param [String] sid The short-code Sid that uniquely identifies this resource
|
270
|
-
# @return [ShortCodeInstance] ShortCodeInstance
|
271
|
-
def initialize(version, payload, account_sid: nil, sid: nil)
|
272
|
-
super(version)
|
273
|
-
|
274
|
-
# Marshaled Properties
|
275
|
-
@properties = {
|
276
|
-
'account_sid' => payload['account_sid'],
|
277
|
-
'api_version' => payload['api_version'],
|
278
|
-
'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
|
279
|
-
'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
|
280
|
-
'friendly_name' => payload['friendly_name'],
|
281
|
-
'short_code' => payload['short_code'],
|
282
|
-
'sid' => payload['sid'],
|
283
|
-
'sms_fallback_method' => payload['sms_fallback_method'],
|
284
|
-
'sms_fallback_url' => payload['sms_fallback_url'],
|
285
|
-
'sms_method' => payload['sms_method'],
|
286
|
-
'sms_url' => payload['sms_url'],
|
287
|
-
'uri' => payload['uri'],
|
288
|
-
}
|
289
|
-
|
290
|
-
# Context
|
291
|
-
@instance_context = nil
|
292
|
-
@params = {
|
293
|
-
'account_sid' => account_sid,
|
294
|
-
'sid' => sid || @properties['sid'],
|
295
|
-
}
|
296
|
-
end
|
297
|
-
|
298
|
-
##
|
299
|
-
# Generate an instance context for the instance, the context is capable of
|
300
|
-
# performing various actions. All instance actions are proxied to the context
|
301
|
-
# @param [Version] version Version that contains the resource
|
302
|
-
# @return [ShortCodeContext] ShortCodeContext for this ShortCodeInstance
|
303
|
-
def context
|
304
|
-
unless @instance_context
|
305
|
-
@instance_context = ShortCodeContext.new(
|
306
|
-
@version,
|
307
|
-
@params['account_sid'],
|
308
|
-
@params['sid'],
|
309
|
-
)
|
310
|
-
end
|
311
|
-
@instance_context
|
312
|
-
end
|
313
|
-
|
314
|
-
def account_sid
|
315
|
-
@properties['account_sid']
|
316
|
-
end
|
317
|
-
|
318
|
-
def api_version
|
319
|
-
@properties['api_version']
|
320
|
-
end
|
321
|
-
|
322
|
-
def date_created
|
323
|
-
@properties['date_created']
|
324
|
-
end
|
325
|
-
|
326
|
-
def date_updated
|
327
|
-
@properties['date_updated']
|
328
|
-
end
|
329
|
-
|
330
|
-
def friendly_name
|
331
|
-
@properties['friendly_name']
|
332
|
-
end
|
333
|
-
|
334
|
-
def short_code
|
335
|
-
@properties['short_code']
|
336
|
-
end
|
337
|
-
|
338
|
-
def sid
|
339
|
-
@properties['sid']
|
340
|
-
end
|
341
|
-
|
342
|
-
def sms_fallback_method
|
343
|
-
@properties['sms_fallback_method']
|
344
|
-
end
|
345
|
-
|
346
|
-
def sms_fallback_url
|
347
|
-
@properties['sms_fallback_url']
|
348
|
-
end
|
349
|
-
|
350
|
-
def sms_method
|
351
|
-
@properties['sms_method']
|
352
|
-
end
|
353
|
-
|
354
|
-
def sms_url
|
355
|
-
@properties['sms_url']
|
356
|
-
end
|
357
|
-
|
358
|
-
def uri
|
359
|
-
@properties['uri']
|
360
|
-
end
|
361
|
-
|
362
|
-
##
|
363
|
-
# Fetch a ShortCodeInstance
|
364
|
-
# @return [ShortCodeInstance] Fetched ShortCodeInstance
|
365
|
-
def fetch
|
366
|
-
context.fetch
|
367
|
-
end
|
368
|
-
|
369
|
-
##
|
370
|
-
# Update the ShortCodeInstance
|
371
|
-
# @param [String] friendly_name A human readable descriptive text for this
|
372
|
-
# resource, up to 64 characters long. By default, the `FriendlyName` is just the
|
373
|
-
# short code.
|
374
|
-
# @param [String] api_version SMSs to this short code will start a new TwiML
|
375
|
-
# session with this API version.
|
376
|
-
# @param [String] sms_url The URL Twilio will request when receiving an incoming
|
377
|
-
# SMS message to this short code.
|
378
|
-
# @param [String] sms_method The HTTP method Twilio will use when making requests
|
379
|
-
# to the `SmsUrl`. Either `GET` or `POST`.
|
380
|
-
# @param [String] sms_fallback_url The URL that Twilio will request if an error
|
381
|
-
# occurs retrieving or executing the TwiML from `SmsUrl`.
|
382
|
-
# @param [String] sms_fallback_method The HTTP method Twilio will use when
|
383
|
-
# requesting the above URL. Either `GET` or `POST`.
|
384
|
-
# @return [ShortCodeInstance] Updated ShortCodeInstance
|
385
|
-
def update(friendly_name: nil, api_version: nil, sms_url: nil, sms_method: nil, sms_fallback_url: nil, sms_fallback_method: nil)
|
386
|
-
context.update(
|
387
|
-
friendly_name: friendly_name,
|
388
|
-
api_version: api_version,
|
389
|
-
sms_url: sms_url,
|
390
|
-
sms_method: sms_method,
|
391
|
-
sms_fallback_url: sms_fallback_url,
|
392
|
-
sms_fallback_method: sms_fallback_method,
|
393
|
-
)
|
394
|
-
end
|
395
|
-
|
396
|
-
##
|
397
|
-
# Provide a user friendly representation
|
398
|
-
def to_s
|
399
|
-
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
400
|
-
"<Twilio.Api.V2010.ShortCodeInstance #{values}>"
|
401
|
-
end
|
402
|
-
end
|
403
|
-
end
|
404
|
-
end
|
405
|
-
end
|
406
|
-
end
|
407
|
-
end
|
408
|
-
end
|
@@ -1,275 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This code was generated by
|
3
|
-
# \ / _ _ _| _ _
|
4
|
-
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
-
# / /
|
6
|
-
|
7
|
-
require 'spec_helper.rb'
|
8
|
-
|
9
|
-
describe 'SmsMessage' do
|
10
|
-
it "can create" do
|
11
|
-
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
-
|
13
|
-
expect {
|
14
|
-
@client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
-
.sms \
|
16
|
-
.messages.create(to: "+123456789", from: "+987654321")
|
17
|
-
}.to raise_exception(Twilio::REST::TwilioException)
|
18
|
-
|
19
|
-
values = {
|
20
|
-
'To' => "+123456789",
|
21
|
-
'From' => "+987654321",
|
22
|
-
}
|
23
|
-
expect(
|
24
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
25
|
-
method: 'post',
|
26
|
-
url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json',
|
27
|
-
data: values,
|
28
|
-
))).to eq(true)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "receives create responses" do
|
32
|
-
@holodeck.mock(Twilio::TwilioResponse.new(
|
33
|
-
200,
|
34
|
-
%q[
|
35
|
-
{
|
36
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
37
|
-
"api_version": "2008-08-01",
|
38
|
-
"body": "n",
|
39
|
-
"date_created": "Mon, 26 Jul 2010 21:46:42 +0000",
|
40
|
-
"date_sent": "Mon, 26 Jul 2010 21:46:44 +0000",
|
41
|
-
"date_updated": "Mon, 26 Jul 2010 21:46:44 +0000",
|
42
|
-
"direction": "outbound-api",
|
43
|
-
"from": "+141586753093",
|
44
|
-
"price": "-0.03000",
|
45
|
-
"price_unit": "USD",
|
46
|
-
"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
47
|
-
"status": "sent",
|
48
|
-
"to": "+141586753096",
|
49
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
|
50
|
-
}
|
51
|
-
]
|
52
|
-
))
|
53
|
-
|
54
|
-
actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
55
|
-
.sms \
|
56
|
-
.messages.create(to: "+123456789", from: "+987654321")
|
57
|
-
|
58
|
-
expect(actual).to_not eq(nil)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "can delete" do
|
62
|
-
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
63
|
-
|
64
|
-
expect {
|
65
|
-
@client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
66
|
-
.sms \
|
67
|
-
.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
68
|
-
}.to raise_exception(Twilio::REST::TwilioException)
|
69
|
-
|
70
|
-
values = {}
|
71
|
-
expect(
|
72
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
73
|
-
method: 'delete',
|
74
|
-
url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json',
|
75
|
-
))).to eq(true)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "receives delete responses" do
|
79
|
-
@holodeck.mock(Twilio::TwilioResponse.new(
|
80
|
-
204,
|
81
|
-
nil,
|
82
|
-
))
|
83
|
-
|
84
|
-
actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
85
|
-
.sms \
|
86
|
-
.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
|
87
|
-
|
88
|
-
expect(actual).to eq(true)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "can fetch" do
|
92
|
-
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
93
|
-
|
94
|
-
expect {
|
95
|
-
@client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
96
|
-
.sms \
|
97
|
-
.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
98
|
-
}.to raise_exception(Twilio::REST::TwilioException)
|
99
|
-
|
100
|
-
values = {}
|
101
|
-
expect(
|
102
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
103
|
-
method: 'get',
|
104
|
-
url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json',
|
105
|
-
))).to eq(true)
|
106
|
-
end
|
107
|
-
|
108
|
-
it "receives fetch responses" do
|
109
|
-
@holodeck.mock(Twilio::TwilioResponse.new(
|
110
|
-
200,
|
111
|
-
%q[
|
112
|
-
{
|
113
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
114
|
-
"api_version": "2008-08-01",
|
115
|
-
"body": "n",
|
116
|
-
"date_created": "Mon, 26 Jul 2010 21:46:42 +0000",
|
117
|
-
"date_sent": "Mon, 26 Jul 2010 21:46:44 +0000",
|
118
|
-
"date_updated": "Mon, 26 Jul 2010 21:46:44 +0000",
|
119
|
-
"direction": "outbound-api",
|
120
|
-
"from": "+141586753093",
|
121
|
-
"price": "-0.03000",
|
122
|
-
"price_unit": "USD",
|
123
|
-
"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
124
|
-
"status": "sent",
|
125
|
-
"to": "+141586753096",
|
126
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
|
127
|
-
}
|
128
|
-
]
|
129
|
-
))
|
130
|
-
|
131
|
-
actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
132
|
-
.sms \
|
133
|
-
.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
134
|
-
|
135
|
-
expect(actual).to_not eq(nil)
|
136
|
-
end
|
137
|
-
|
138
|
-
it "can read" do
|
139
|
-
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
140
|
-
|
141
|
-
expect {
|
142
|
-
@client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
143
|
-
.sms \
|
144
|
-
.messages.list()
|
145
|
-
}.to raise_exception(Twilio::REST::TwilioException)
|
146
|
-
|
147
|
-
values = {}
|
148
|
-
expect(
|
149
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
150
|
-
method: 'get',
|
151
|
-
url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json',
|
152
|
-
))).to eq(true)
|
153
|
-
end
|
154
|
-
|
155
|
-
it "receives read_full responses" do
|
156
|
-
@holodeck.mock(Twilio::TwilioResponse.new(
|
157
|
-
200,
|
158
|
-
%q[
|
159
|
-
{
|
160
|
-
"end": 0,
|
161
|
-
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json?PageSize=1&Page=0",
|
162
|
-
"last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json?PageSize=1&Page=119771",
|
163
|
-
"next_page_uri": null,
|
164
|
-
"num_pages": 119772,
|
165
|
-
"page": 0,
|
166
|
-
"page_size": 1,
|
167
|
-
"previous_page_uri": null,
|
168
|
-
"sms_messages": [
|
169
|
-
{
|
170
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
171
|
-
"api_version": "2010-04-01",
|
172
|
-
"body": "O Slash: \u00d8, PoP: \ud83d\udca9",
|
173
|
-
"date_created": "Fri, 04 Sep 2015 22:54:39 +0000",
|
174
|
-
"date_sent": "Fri, 04 Sep 2015 22:54:41 +0000",
|
175
|
-
"date_updated": "Fri, 04 Sep 2015 22:54:41 +0000",
|
176
|
-
"direction": "outbound-api",
|
177
|
-
"from": "+14155552345",
|
178
|
-
"num_segments": "1",
|
179
|
-
"price": "-0.00750",
|
180
|
-
"price_unit": "USD",
|
181
|
-
"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
182
|
-
"status": "sent",
|
183
|
-
"to": "+14155552345",
|
184
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
|
185
|
-
}
|
186
|
-
],
|
187
|
-
"start": 0,
|
188
|
-
"total": 119772,
|
189
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json?PageSize=1&Page=0"
|
190
|
-
}
|
191
|
-
]
|
192
|
-
))
|
193
|
-
|
194
|
-
actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
195
|
-
.sms \
|
196
|
-
.messages.list()
|
197
|
-
|
198
|
-
expect(actual).to_not eq(nil)
|
199
|
-
end
|
200
|
-
|
201
|
-
it "receives read_empty responses" do
|
202
|
-
@holodeck.mock(Twilio::TwilioResponse.new(
|
203
|
-
200,
|
204
|
-
%q[
|
205
|
-
{
|
206
|
-
"end": 0,
|
207
|
-
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json?PageSize=1&Page=0",
|
208
|
-
"last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json?PageSize=1&Page=119771",
|
209
|
-
"next_page_uri": null,
|
210
|
-
"num_pages": 119772,
|
211
|
-
"page": 0,
|
212
|
-
"page_size": 1,
|
213
|
-
"previous_page_uri": null,
|
214
|
-
"sms_messages": [],
|
215
|
-
"start": 0,
|
216
|
-
"total": 119772,
|
217
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages.json?PageSize=1&Page=0"
|
218
|
-
}
|
219
|
-
]
|
220
|
-
))
|
221
|
-
|
222
|
-
actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
223
|
-
.sms \
|
224
|
-
.messages.list()
|
225
|
-
|
226
|
-
expect(actual).to_not eq(nil)
|
227
|
-
end
|
228
|
-
|
229
|
-
it "can update" do
|
230
|
-
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
231
|
-
|
232
|
-
expect {
|
233
|
-
@client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
234
|
-
.sms \
|
235
|
-
.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
236
|
-
}.to raise_exception(Twilio::REST::TwilioException)
|
237
|
-
|
238
|
-
values = {}
|
239
|
-
expect(
|
240
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
241
|
-
method: 'post',
|
242
|
-
url: 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json',
|
243
|
-
))).to eq(true)
|
244
|
-
end
|
245
|
-
|
246
|
-
it "receives update responses" do
|
247
|
-
@holodeck.mock(Twilio::TwilioResponse.new(
|
248
|
-
200,
|
249
|
-
%q[
|
250
|
-
{
|
251
|
-
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
252
|
-
"api_version": "2008-08-01",
|
253
|
-
"body": "n",
|
254
|
-
"date_created": "Mon, 26 Jul 2010 21:46:42 +0000",
|
255
|
-
"date_sent": "Mon, 26 Jul 2010 21:46:44 +0000",
|
256
|
-
"date_updated": "Mon, 26 Jul 2010 21:46:44 +0000",
|
257
|
-
"direction": "outbound-api",
|
258
|
-
"from": "+141586753093",
|
259
|
-
"price": "-0.03000",
|
260
|
-
"price_unit": "USD",
|
261
|
-
"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
262
|
-
"status": "sent",
|
263
|
-
"to": "+141586753096",
|
264
|
-
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
|
265
|
-
}
|
266
|
-
]
|
267
|
-
))
|
268
|
-
|
269
|
-
actual = @client.api.v2010.accounts("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
270
|
-
.sms \
|
271
|
-
.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
272
|
-
|
273
|
-
expect(actual).to_not eq(nil)
|
274
|
-
end
|
275
|
-
end
|