twilio-ruby 5.0.0.rc4 → 5.0.0.rc5
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 +8 -1
- data/Makefile +3 -0
- data/lib/twilio-ruby.rb +0 -1
- data/lib/twilio-ruby/framework/version.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/address.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/application.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +0 -11
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sandbox.rb +0 -10
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sms/sms_message.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +0 -13
- data/lib/twilio-ruby/rest/client.rb +7 -7
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +0 -12
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +0 -12
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +0 -13
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +0 -14
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +0 -14
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +0 -13
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +0 -18
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +0 -12
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +0 -12
- data/lib/twilio-ruby/rest/monitor/v1/event.rb +0 -12
- data/lib/twilio-ruby/rest/notifications.rb +4 -0
- data/lib/twilio-ruby/rest/notifications/v1.rb +9 -0
- data/lib/twilio-ruby/rest/notifications/v1/credential.rb +390 -0
- data/lib/twilio-ruby/rest/notifications/v1/service.rb +0 -12
- data/lib/twilio-ruby/rest/notifications/v1/service/binding.rb +0 -13
- data/lib/twilio-ruby/rest/preview.rb +47 -0
- data/lib/twilio-ruby/rest/preview/wireless.rb +53 -0
- data/lib/twilio-ruby/rest/preview/wireless/command.rb +345 -0
- data/lib/twilio-ruby/rest/preview/wireless/device.rb +456 -0
- data/lib/twilio-ruby/rest/preview/wireless/device/usage.rb +227 -0
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +325 -0
- data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +0 -12
- data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +0 -12
- data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +0 -12
- data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +0 -12
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +0 -12
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +0 -14
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +0 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +0 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +0 -10
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +0 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +0 -10
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +0 -12
- data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +0 -13
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +0 -13
- data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +0 -13
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +0 -13
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/usage/trigger_spec.rb +3 -3
- data/spec/integration/ip_messaging/v1/credential_spec.rb +1 -1
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +1 -1
- data/spec/integration/notifications/v1/credential_spec.rb +228 -0
- data/spec/integration/notifications/v1/service/binding_spec.rb +2 -2
- data/spec/integration/preview/wireless/command_spec.rb +58 -0
- data/spec/integration/preview/wireless/device/usage_spec.rb +25 -0
- data/spec/integration/preview/wireless/device_spec.rb +72 -0
- data/spec/integration/preview/wireless/rate_plan_spec.rb +39 -0
- metadata +19 -16
- data/lib/twilio-ruby/rest/conversations.rb +0 -40
- data/lib/twilio-ruby/rest/conversations/v1.rb +0 -35
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +0 -270
- data/lib/twilio-ruby/rest/conversations/v1/conversation/completed.rb +0 -217
- data/lib/twilio-ruby/rest/conversations/v1/conversation/in_progress.rb +0 -217
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +0 -352
- data/spec/integration/conversations/v1/conversation/completed_spec.rb +0 -89
- data/spec/integration/conversations/v1/conversation/in_progress_spec.rb +0 -89
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +0 -174
- data/spec/integration/conversations/v1/conversation_spec.rb +0 -49
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Preview < Domain
|
|
10
|
+
class Wireless < Version
|
|
11
|
+
class DeviceList < ListResource
|
|
12
|
+
##
|
|
13
|
+
# Initialize the DeviceList
|
|
14
|
+
# @param [Version] version Version that contains the resource
|
|
15
|
+
|
|
16
|
+
# @return [DeviceList] DeviceList
|
|
17
|
+
def initialize(version)
|
|
18
|
+
super(version)
|
|
19
|
+
|
|
20
|
+
# Path Solution
|
|
21
|
+
@solution = {}
|
|
22
|
+
@uri = "/Devices"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Lists DeviceInstance records from the API as a list.
|
|
27
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
28
|
+
# memory before returning.
|
|
29
|
+
# @param [String] status The status
|
|
30
|
+
# @param [String] sim_identifier The sim_identifier
|
|
31
|
+
# @param [String] rate_plan The rate_plan
|
|
32
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
33
|
+
# guarantees to never return more than limit. Default is no limit
|
|
34
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
35
|
+
# the default value of 50 records. If no page_size is defined
|
|
36
|
+
# but a limit is defined, stream() will attempt to read the
|
|
37
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
38
|
+
|
|
39
|
+
# @return [Array] Array of up to limit results
|
|
40
|
+
def list(status: nil, sim_identifier: nil, rate_plan: nil, limit: nil, page_size: nil)
|
|
41
|
+
self.stream(
|
|
42
|
+
status: status,
|
|
43
|
+
sim_identifier: sim_identifier,
|
|
44
|
+
rate_plan: rate_plan,
|
|
45
|
+
limit: limit,
|
|
46
|
+
page_size: page_size
|
|
47
|
+
).entries
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# Streams DeviceInstance records from the API as an Enumerable.
|
|
52
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
53
|
+
# is reached.
|
|
54
|
+
# @param [String] status The status
|
|
55
|
+
# @param [String] sim_identifier The sim_identifier
|
|
56
|
+
# @param [String] rate_plan The rate_plan
|
|
57
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
58
|
+
# guarantees to never return more than limit. Default is no limit
|
|
59
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
60
|
+
# the default value of 50 records. If no page_size is defined
|
|
61
|
+
# but a limit is defined, stream() will attempt to read the
|
|
62
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
63
|
+
|
|
64
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
65
|
+
def stream(status: nil, sim_identifier: nil, rate_plan: nil, limit: nil, page_size: nil)
|
|
66
|
+
limits = @version.read_limits(limit, page_size)
|
|
67
|
+
|
|
68
|
+
page = self.page(
|
|
69
|
+
status: status,
|
|
70
|
+
sim_identifier: sim_identifier,
|
|
71
|
+
rate_plan: rate_plan,
|
|
72
|
+
page_size: limits['page_size'],
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
@version.stream(page, limit: limits['limit'], page_limit: limits['page_limit'])
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
# When passed a block, yields DeviceInstance records from the API.
|
|
80
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
81
|
+
# is reached.
|
|
82
|
+
# @param [String] status The status
|
|
83
|
+
# @param [String] sim_identifier The sim_identifier
|
|
84
|
+
# @param [String] rate_plan The rate_plan
|
|
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 not set will use
|
|
88
|
+
# the default value of 50 records. If no page_size is defined
|
|
89
|
+
# but a limit is defined, stream() will attempt to read the
|
|
90
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
91
|
+
def each
|
|
92
|
+
limits = @version.read_limits
|
|
93
|
+
|
|
94
|
+
page = self.page(
|
|
95
|
+
page_size: limits['page_size'],
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
@version.stream(page,
|
|
99
|
+
limit: limits['limit'],
|
|
100
|
+
page_limit: limits['page_limit']).each {|x| yield x}
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
##
|
|
104
|
+
# Retrieve a single page of DeviceInstance records from the API.
|
|
105
|
+
# Request is executed immediately.
|
|
106
|
+
# @param [String] status The status
|
|
107
|
+
# @param [String] sim_identifier The sim_identifier
|
|
108
|
+
# @param [String] rate_plan The rate_plan
|
|
109
|
+
# @param [String] page_token PageToken provided by the API
|
|
110
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
111
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
112
|
+
|
|
113
|
+
# @return [Page] Page of DeviceInstance
|
|
114
|
+
def page(status: nil, sim_identifier: nil, rate_plan: nil, page_token: nil, page_number: nil, page_size: nil)
|
|
115
|
+
params = {
|
|
116
|
+
'Status' => status,
|
|
117
|
+
'SimIdentifier' => sim_identifier,
|
|
118
|
+
'RatePlan' => rate_plan,
|
|
119
|
+
'PageToken' => page_token,
|
|
120
|
+
'Page' => page_number,
|
|
121
|
+
'PageSize' => page_size,
|
|
122
|
+
}
|
|
123
|
+
response = @version.page(
|
|
124
|
+
'GET',
|
|
125
|
+
@uri,
|
|
126
|
+
params
|
|
127
|
+
)
|
|
128
|
+
return DevicePage.new(@version, response, @solution)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
##
|
|
132
|
+
# Retrieve a single page of DeviceInstance records from the API.
|
|
133
|
+
# Request is executed immediately.
|
|
134
|
+
# @param [String] rate_plan The rate_plan
|
|
135
|
+
# @param [String] alias_ The alias
|
|
136
|
+
# @param [String] callback_method The callback_method
|
|
137
|
+
# @param [String] callback_url The callback_url
|
|
138
|
+
# @param [String] friendly_name The friendly_name
|
|
139
|
+
# @param [String] sim_identifier The sim_identifier
|
|
140
|
+
# @param [String] status The status
|
|
141
|
+
# @param [String] commands_callback_method The commands_callback_method
|
|
142
|
+
# @param [String] commands_callback_url The commands_callback_url
|
|
143
|
+
|
|
144
|
+
# @return [DeviceInstance] Newly created DeviceInstance
|
|
145
|
+
def create(rate_plan: nil, alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
|
|
146
|
+
data = {
|
|
147
|
+
'RatePlan' => rate_plan,
|
|
148
|
+
'Alias' => alias_,
|
|
149
|
+
'CallbackMethod' => callback_method,
|
|
150
|
+
'CallbackUrl' => callback_url,
|
|
151
|
+
'FriendlyName' => friendly_name,
|
|
152
|
+
'SimIdentifier' => sim_identifier,
|
|
153
|
+
'Status' => status,
|
|
154
|
+
'CommandsCallbackMethod' => commands_callback_method,
|
|
155
|
+
'CommandsCallbackUrl' => commands_callback_url,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
payload = @version.create(
|
|
159
|
+
'POST',
|
|
160
|
+
@uri,
|
|
161
|
+
data: data
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
return DeviceInstance.new(
|
|
165
|
+
@version,
|
|
166
|
+
payload,
|
|
167
|
+
)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
##
|
|
171
|
+
# Provide a user friendly representation
|
|
172
|
+
def to_s
|
|
173
|
+
'#<Twilio.Preview.Wireless.DeviceList>'
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
class DevicePage < Page
|
|
178
|
+
##
|
|
179
|
+
# Initialize the DevicePage
|
|
180
|
+
# @param [Version] version Version that contains the resource
|
|
181
|
+
# @param [Response] response Response from the API
|
|
182
|
+
# @param [Hash] solution Path solution for the resource
|
|
183
|
+
|
|
184
|
+
# @return [DevicePage] DevicePage
|
|
185
|
+
def initialize(version, response, solution)
|
|
186
|
+
super(version, response)
|
|
187
|
+
|
|
188
|
+
# Path Solution
|
|
189
|
+
@solution = solution
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
##
|
|
193
|
+
# Build an instance of DeviceInstance
|
|
194
|
+
# @param [Hash] payload Payload response from the API
|
|
195
|
+
|
|
196
|
+
# @return [DeviceInstance] DeviceInstance
|
|
197
|
+
def get_instance(payload)
|
|
198
|
+
return DeviceInstance.new(
|
|
199
|
+
@version,
|
|
200
|
+
payload,
|
|
201
|
+
)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
##
|
|
205
|
+
# Provide a user friendly representation
|
|
206
|
+
def to_s
|
|
207
|
+
'<Twilio.Preview.Wireless.DevicePage>'
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
class DeviceContext < InstanceContext
|
|
212
|
+
##
|
|
213
|
+
# Initialize the DeviceContext
|
|
214
|
+
# @param [Version] version Version that contains the resource
|
|
215
|
+
# @param [String] sid The sid
|
|
216
|
+
|
|
217
|
+
# @return [DeviceContext] DeviceContext
|
|
218
|
+
def initialize(version, sid)
|
|
219
|
+
super(version)
|
|
220
|
+
|
|
221
|
+
# Path Solution
|
|
222
|
+
@solution = {
|
|
223
|
+
sid: sid,
|
|
224
|
+
}
|
|
225
|
+
@uri = "/Devices/#{@solution[:sid]}"
|
|
226
|
+
|
|
227
|
+
# Dependents
|
|
228
|
+
@usage = nil
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
# Fetch a DeviceInstance
|
|
233
|
+
# @return [DeviceInstance] Fetched DeviceInstance
|
|
234
|
+
def fetch
|
|
235
|
+
params = {}
|
|
236
|
+
|
|
237
|
+
payload = @version.fetch(
|
|
238
|
+
'GET',
|
|
239
|
+
@uri,
|
|
240
|
+
params,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
return DeviceInstance.new(
|
|
244
|
+
@version,
|
|
245
|
+
payload,
|
|
246
|
+
sid: @solution['sid'],
|
|
247
|
+
)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
##
|
|
251
|
+
# Update the DeviceInstance
|
|
252
|
+
# @param [String] alias_ The alias
|
|
253
|
+
# @param [String] callback_method The callback_method
|
|
254
|
+
# @param [String] callback_url The callback_url
|
|
255
|
+
# @param [String] friendly_name The friendly_name
|
|
256
|
+
# @param [String] sim_identifier The sim_identifier
|
|
257
|
+
# @param [String] status The status
|
|
258
|
+
# @param [String] commands_callback_method The commands_callback_method
|
|
259
|
+
# @param [String] commands_callback_url The commands_callback_url
|
|
260
|
+
|
|
261
|
+
# @return [DeviceInstance] Updated DeviceInstance
|
|
262
|
+
def update(alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
|
|
263
|
+
data = {
|
|
264
|
+
'Alias' => alias_,
|
|
265
|
+
'CallbackMethod' => callback_method,
|
|
266
|
+
'CallbackUrl' => callback_url,
|
|
267
|
+
'FriendlyName' => friendly_name,
|
|
268
|
+
'SimIdentifier' => sim_identifier,
|
|
269
|
+
'Status' => status,
|
|
270
|
+
'CommandsCallbackMethod' => commands_callback_method,
|
|
271
|
+
'CommandsCallbackUrl' => commands_callback_url,
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
payload = @version.update(
|
|
275
|
+
'POST',
|
|
276
|
+
@uri,
|
|
277
|
+
data: data,
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
return DeviceInstance.new(
|
|
281
|
+
@version,
|
|
282
|
+
payload,
|
|
283
|
+
sid: @solution['sid'],
|
|
284
|
+
)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
##
|
|
288
|
+
# Access the usage
|
|
289
|
+
# @return [UsageList] UsageList
|
|
290
|
+
def usage
|
|
291
|
+
return UsageContext.new(
|
|
292
|
+
@version,
|
|
293
|
+
@solution[:sid],
|
|
294
|
+
)
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
##
|
|
298
|
+
# Provide a user friendly representation
|
|
299
|
+
def to_s
|
|
300
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
301
|
+
"#<Twilio.Preview.Wireless.DeviceContext #{context}>"
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
class DeviceInstance < InstanceResource
|
|
306
|
+
##
|
|
307
|
+
# Initialize the DeviceInstance
|
|
308
|
+
# @param [Version] version Version that contains the resource
|
|
309
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
310
|
+
# @param [String] sid The sid
|
|
311
|
+
|
|
312
|
+
# @return [DeviceInstance] DeviceInstance
|
|
313
|
+
def initialize(version, payload, sid: nil)
|
|
314
|
+
super(version)
|
|
315
|
+
|
|
316
|
+
# Marshaled Properties
|
|
317
|
+
@properties = {
|
|
318
|
+
'sid' => payload['sid'],
|
|
319
|
+
'alias_' => payload['alias'],
|
|
320
|
+
'account_sid' => payload['account_sid'],
|
|
321
|
+
'rate_plan_sid' => payload['rate_plan_sid'],
|
|
322
|
+
'friendly_name' => payload['friendly_name'],
|
|
323
|
+
'sim_identifier' => payload['sim_identifier'],
|
|
324
|
+
'status' => payload['status'],
|
|
325
|
+
'commands_callback_url' => payload['commands_callback_url'],
|
|
326
|
+
'commands_callback_method' => payload['commands_callback_method'],
|
|
327
|
+
'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
|
|
328
|
+
'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
|
|
329
|
+
'url' => payload['url'],
|
|
330
|
+
'links' => payload['links'],
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
# Context
|
|
334
|
+
@instance_context = nil
|
|
335
|
+
@params = {
|
|
336
|
+
'sid' => sid || @properties['sid'],
|
|
337
|
+
}
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
##
|
|
341
|
+
# Generate an instance context for the instance, the context is capable of
|
|
342
|
+
# performing various actions. All instance actions are proxied to the context
|
|
343
|
+
# @param [Version] version Version that contains the resource
|
|
344
|
+
|
|
345
|
+
# @return [DeviceContext] DeviceContext for this DeviceInstance
|
|
346
|
+
def context
|
|
347
|
+
unless @instance_context
|
|
348
|
+
@instance_context = DeviceContext.new(
|
|
349
|
+
@version,
|
|
350
|
+
@params['sid'],
|
|
351
|
+
)
|
|
352
|
+
end
|
|
353
|
+
@instance_context
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def sid
|
|
357
|
+
@properties['sid']
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def alias_
|
|
361
|
+
@properties['alias_']
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
def account_sid
|
|
365
|
+
@properties['account_sid']
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def rate_plan_sid
|
|
369
|
+
@properties['rate_plan_sid']
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
def friendly_name
|
|
373
|
+
@properties['friendly_name']
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
def sim_identifier
|
|
377
|
+
@properties['sim_identifier']
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def status
|
|
381
|
+
@properties['status']
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
def commands_callback_url
|
|
385
|
+
@properties['commands_callback_url']
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
def commands_callback_method
|
|
389
|
+
@properties['commands_callback_method']
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
def date_created
|
|
393
|
+
@properties['date_created']
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
def date_updated
|
|
397
|
+
@properties['date_updated']
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
def url
|
|
401
|
+
@properties['url']
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def links
|
|
405
|
+
@properties['links']
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
##
|
|
409
|
+
# Fetch a DeviceInstance
|
|
410
|
+
# @return [DeviceInstance] Fetched DeviceInstance
|
|
411
|
+
def fetch
|
|
412
|
+
@context.fetch()
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
##
|
|
416
|
+
# Update the DeviceInstance
|
|
417
|
+
# @param [String] alias_ The alias
|
|
418
|
+
# @param [String] callback_method The callback_method
|
|
419
|
+
# @param [String] callback_url The callback_url
|
|
420
|
+
# @param [String] friendly_name The friendly_name
|
|
421
|
+
# @param [String] sim_identifier The sim_identifier
|
|
422
|
+
# @param [String] status The status
|
|
423
|
+
# @param [String] commands_callback_method The commands_callback_method
|
|
424
|
+
# @param [String] commands_callback_url The commands_callback_url
|
|
425
|
+
|
|
426
|
+
# @return [DeviceInstance] Updated DeviceInstance
|
|
427
|
+
def update(alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
|
|
428
|
+
@context.update(
|
|
429
|
+
callback_method: callback_method,
|
|
430
|
+
callback_url: callback_url,
|
|
431
|
+
friendly_name: friendly_name,
|
|
432
|
+
sim_identifier: sim_identifier,
|
|
433
|
+
status: status,
|
|
434
|
+
commands_callback_method: commands_callback_method,
|
|
435
|
+
commands_callback_url: commands_callback_url,
|
|
436
|
+
)
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
##
|
|
440
|
+
# Access the usage
|
|
441
|
+
# @return [usage] usage
|
|
442
|
+
def usage
|
|
443
|
+
@context.usage
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
##
|
|
447
|
+
# Provide a user friendly representation
|
|
448
|
+
def to_s
|
|
449
|
+
context = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
450
|
+
"<Twilio.Preview.Wireless.DeviceInstance #{context}>"
|
|
451
|
+
end
|
|
452
|
+
end
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
end
|
|
456
|
+
end
|