twilio-ruby 5.22.3 → 5.23.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 +27 -0
- data/README.md +2 -4
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1.rb +4 -2
- data/lib/twilio-ruby/rest/chat/v1/credential.rb +68 -47
- data/lib/twilio-ruby/rest/chat/v1/service.rb +311 -320
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +59 -41
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +52 -40
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +71 -64
- data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +58 -40
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +39 -29
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +51 -48
- data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +16 -12
- data/lib/twilio-ruby/rest/insights/v1/summary.rb +13 -4
- data/lib/twilio-ruby/rest/ip_messaging/v1.rb +4 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +68 -47
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +311 -320
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +59 -41
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +52 -40
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +71 -64
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +58 -40
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +39 -29
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +51 -48
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +16 -12
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +1 -1
- data/lib/twilio-ruby/rest/preview.rb +25 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +49 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +217 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +146 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +169 -0
- data/lib/twilio-ruby/rest/serverless/v1.rb +2 -1
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +4 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +30 -9
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +1 -1
- data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +39 -6
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +191 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribed_track.rb +133 -99
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +3 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference_spec.rb +86 -2
- data/spec/integration/api/v2010/account/connect_app_spec.rb +28 -6
- data/spec/integration/api/v2010/account/queue/member_spec.rb +4 -4
- data/spec/integration/insights/v1/summary_spec.rb +1 -0
- data/spec/integration/preview/trusted_comms/current_call_spec.rb +46 -0
- data/spec/integration/preview/trusted_comms/device_spec.rb +45 -0
- data/spec/integration/preview/trusted_comms/phone_call_spec.rb +48 -0
- data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +6 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribe_rule_spec.rb +92 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribed_track_spec.rb +31 -68
- data/spec/integration/video/v1/room/room_participant_spec.rb +6 -3
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
- metadata +15 -2
@@ -16,8 +16,10 @@ module Twilio
|
|
16
16
|
##
|
17
17
|
# Initialize the UserChannelList
|
18
18
|
# @param [Version] version Version that contains the resource
|
19
|
-
# @param [String] service_sid The
|
20
|
-
#
|
19
|
+
# @param [String] service_sid The SID of the
|
20
|
+
# [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is
|
21
|
+
# associated with.
|
22
|
+
# @param [String] user_sid The unique string that we created to identify the User
|
21
23
|
# resource.
|
22
24
|
# @return [UserChannelList] UserChannelList
|
23
25
|
def initialize(version, service_sid: nil, user_sid: nil)
|
@@ -156,8 +158,10 @@ module Twilio
|
|
156
158
|
# Initialize the UserChannelInstance
|
157
159
|
# @param [Version] version Version that contains the resource
|
158
160
|
# @param [Hash] payload payload that contains response from Twilio
|
159
|
-
# @param [String] service_sid The
|
160
|
-
#
|
161
|
+
# @param [String] service_sid The SID of the
|
162
|
+
# [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is
|
163
|
+
# associated with.
|
164
|
+
# @param [String] user_sid The unique string that we created to identify the User
|
161
165
|
# resource.
|
162
166
|
# @return [UserChannelInstance] UserChannelInstance
|
163
167
|
def initialize(version, payload, service_sid: nil, user_sid: nil)
|
@@ -177,49 +181,49 @@ module Twilio
|
|
177
181
|
end
|
178
182
|
|
179
183
|
##
|
180
|
-
# @return [String] The
|
184
|
+
# @return [String] The SID of the Account that created the resource
|
181
185
|
def account_sid
|
182
186
|
@properties['account_sid']
|
183
187
|
end
|
184
188
|
|
185
189
|
##
|
186
|
-
# @return [String] The
|
190
|
+
# @return [String] The SID of the Service that the resource is associated with
|
187
191
|
def service_sid
|
188
192
|
@properties['service_sid']
|
189
193
|
end
|
190
194
|
|
191
195
|
##
|
192
|
-
# @return [String] The
|
196
|
+
# @return [String] The SID of the Channel the resource belongs to
|
193
197
|
def channel_sid
|
194
198
|
@properties['channel_sid']
|
195
199
|
end
|
196
200
|
|
197
201
|
##
|
198
|
-
# @return [String] The
|
202
|
+
# @return [String] The SID of the User as a Member in the Channel
|
199
203
|
def member_sid
|
200
204
|
@properties['member_sid']
|
201
205
|
end
|
202
206
|
|
203
207
|
##
|
204
|
-
# @return [user_channel.ChannelStatus] The status
|
208
|
+
# @return [user_channel.ChannelStatus] The status of the User on the Channel
|
205
209
|
def status
|
206
210
|
@properties['status']
|
207
211
|
end
|
208
212
|
|
209
213
|
##
|
210
|
-
# @return [String] The
|
214
|
+
# @return [String] The index of the last Message in the Channel the Member has read
|
211
215
|
def last_consumed_message_index
|
212
216
|
@properties['last_consumed_message_index']
|
213
217
|
end
|
214
218
|
|
215
219
|
##
|
216
|
-
# @return [String] The
|
220
|
+
# @return [String] The number of unread Messages in the Channel for the User
|
217
221
|
def unread_messages_count
|
218
222
|
@properties['unread_messages_count']
|
219
223
|
end
|
220
224
|
|
221
225
|
##
|
222
|
-
# @return [String]
|
226
|
+
# @return [String] Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel
|
223
227
|
def links
|
224
228
|
@properties['links']
|
225
229
|
end
|
@@ -34,7 +34,7 @@ module Twilio
|
|
34
34
|
# Request is executed immediately.
|
35
35
|
# @param [String] body The notification text. For FCM and GCM, translates to
|
36
36
|
# `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates
|
37
|
-
# to `body`. SMS requires either this `body` value, or
|
37
|
+
# to `body`. SMS requires either this `body` value, or `media_urls` attribute
|
38
38
|
# defined in the `sms` parameter of the notification.
|
39
39
|
# @param [notification.Priority] priority The priority of the notification. Can
|
40
40
|
# be: `low` or `high` and the default is `high`. A value of `low` optimizes the
|
@@ -27,6 +27,7 @@ module Twilio
|
|
27
27
|
@sync = nil
|
28
28
|
@understand = nil
|
29
29
|
@wireless = nil
|
30
|
+
@trusted_comms = nil
|
30
31
|
end
|
31
32
|
|
32
33
|
##
|
@@ -77,6 +78,12 @@ module Twilio
|
|
77
78
|
@wireless ||= Wireless.new self
|
78
79
|
end
|
79
80
|
|
81
|
+
##
|
82
|
+
# Version trusted_comms of preview
|
83
|
+
def trusted_comms
|
84
|
+
@trusted_comms ||= TrustedComms.new self
|
85
|
+
end
|
86
|
+
|
80
87
|
##
|
81
88
|
# @param [String] resource_type The resource_type
|
82
89
|
# @return [Twilio::REST::Preview::BulkExports::ExportInstance] if resource_type was passed.
|
@@ -179,6 +186,24 @@ module Twilio
|
|
179
186
|
self.wireless.sims(sid)
|
180
187
|
end
|
181
188
|
|
189
|
+
##
|
190
|
+
# @return [Twilio::REST::Preview::TrustedComms::DeviceInstance]
|
191
|
+
def devices
|
192
|
+
self.trusted_comms.devices()
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# @return [Twilio::REST::Preview::TrustedComms::PhoneCallInstance]
|
197
|
+
def phone_calls
|
198
|
+
self.trusted_comms.phone_calls()
|
199
|
+
end
|
200
|
+
|
201
|
+
##
|
202
|
+
# @return [Twilio::REST::Preview::TrustedComms::CurrentCallInstance]
|
203
|
+
def current_calls
|
204
|
+
self.trusted_comms.current_calls()
|
205
|
+
end
|
206
|
+
|
182
207
|
##
|
183
208
|
# Provide a user friendly representation
|
184
209
|
def to_s
|
@@ -0,0 +1,49 @@
|
|
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 Preview
|
12
|
+
class TrustedComms < Version
|
13
|
+
##
|
14
|
+
# Initialize the TrustedComms version of Preview
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'TrustedComms'
|
18
|
+
@devices = nil
|
19
|
+
@phone_calls = nil
|
20
|
+
@current_calls = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# @return [Twilio::REST::Preview::TrustedComms::DeviceContext]
|
25
|
+
def devices
|
26
|
+
@devices ||= DeviceList.new self
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# @return [Twilio::REST::Preview::TrustedComms::PhoneCallContext]
|
31
|
+
def phone_calls
|
32
|
+
@phone_calls ||= PhoneCallList.new self
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# @return [Twilio::REST::Preview::TrustedComms::CurrentCallContext]
|
37
|
+
def current_calls
|
38
|
+
@current_calls ||= CurrentCallContext.new self
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Provide a user friendly representation
|
43
|
+
def to_s
|
44
|
+
'<Twilio::REST::Preview::TrustedComms>'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,217 @@
|
|
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 Preview < Domain
|
12
|
+
class TrustedComms < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
15
|
+
class CurrentCallList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the CurrentCallList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [CurrentCallList] CurrentCallList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Provide a user friendly representation
|
29
|
+
def to_s
|
30
|
+
'#<Twilio.Preview.TrustedComms.CurrentCallList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
36
|
+
class CurrentCallPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the CurrentCallPage
|
39
|
+
# @param [Version] version Version that contains the resource
|
40
|
+
# @param [Response] response Response from the API
|
41
|
+
# @param [Hash] solution Path solution for the resource
|
42
|
+
# @return [CurrentCallPage] CurrentCallPage
|
43
|
+
def initialize(version, response, solution)
|
44
|
+
super(version, response)
|
45
|
+
|
46
|
+
# Path Solution
|
47
|
+
@solution = solution
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Build an instance of CurrentCallInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [CurrentCallInstance] CurrentCallInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
CurrentCallInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.Preview.TrustedComms.CurrentCallPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
67
|
+
class CurrentCallContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the CurrentCallContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @return [CurrentCallContext] CurrentCallContext
|
72
|
+
def initialize(version)
|
73
|
+
super(version)
|
74
|
+
|
75
|
+
# Path Solution
|
76
|
+
@solution = {}
|
77
|
+
@uri = "/CurrentCall"
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Fetch a CurrentCallInstance
|
82
|
+
# @param [String] from The originating Phone Number, given in E.164 format
|
83
|
+
# (https://en.wikipedia.org/wiki/E.164). This phone number should be a Twilio
|
84
|
+
# number, otherwise it will return an error with HTTP Status Code 400.
|
85
|
+
# @param [String] to The terminating Phone Number, given in E.164 format
|
86
|
+
# (https://en.wikipedia.org/wiki/E.164).
|
87
|
+
# @return [CurrentCallInstance] Fetched CurrentCallInstance
|
88
|
+
def fetch(from: :unset, to: :unset)
|
89
|
+
params = Twilio::Values.of({'From' => from, 'To' => to, })
|
90
|
+
|
91
|
+
payload = @version.fetch(
|
92
|
+
'GET',
|
93
|
+
@uri,
|
94
|
+
params,
|
95
|
+
)
|
96
|
+
|
97
|
+
CurrentCallInstance.new(@version, payload, )
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Provide a user friendly representation
|
102
|
+
def to_s
|
103
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
104
|
+
"#<Twilio.Preview.TrustedComms.CurrentCallContext #{context}>"
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Provide a detailed, user friendly representation
|
109
|
+
def inspect
|
110
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
111
|
+
"#<Twilio.Preview.TrustedComms.CurrentCallContext #{context}>"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
117
|
+
class CurrentCallInstance < InstanceResource
|
118
|
+
##
|
119
|
+
# Initialize the CurrentCallInstance
|
120
|
+
# @param [Version] version Version that contains the resource
|
121
|
+
# @param [Hash] payload payload that contains response from Twilio
|
122
|
+
# @return [CurrentCallInstance] CurrentCallInstance
|
123
|
+
def initialize(version, payload)
|
124
|
+
super(version)
|
125
|
+
|
126
|
+
# Marshaled Properties
|
127
|
+
@properties = {
|
128
|
+
'sid' => payload['sid'],
|
129
|
+
'from' => payload['from'],
|
130
|
+
'to' => payload['to'],
|
131
|
+
'reason' => payload['reason'],
|
132
|
+
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
133
|
+
'url' => payload['url'],
|
134
|
+
}
|
135
|
+
|
136
|
+
# Context
|
137
|
+
@instance_context = nil
|
138
|
+
@params = {}
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Generate an instance context for the instance, the context is capable of
|
143
|
+
# performing various actions. All instance actions are proxied to the context
|
144
|
+
# @return [CurrentCallContext] CurrentCallContext for this CurrentCallInstance
|
145
|
+
def context
|
146
|
+
unless @instance_context
|
147
|
+
@instance_context = CurrentCallContext.new(@version, )
|
148
|
+
end
|
149
|
+
@instance_context
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# @return [String] A string that uniquely identifies this Current Call.
|
154
|
+
def sid
|
155
|
+
@properties['sid']
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# @return [String] The originating Phone Number
|
160
|
+
def from
|
161
|
+
@properties['from']
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# @return [String] The terminating Phone Number
|
166
|
+
def to
|
167
|
+
@properties['to']
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# @return [String] The business reason for this phone call
|
172
|
+
def reason
|
173
|
+
@properties['reason']
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# @return [Time] The date this Current Call was created
|
178
|
+
def created_at
|
179
|
+
@properties['created_at']
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# @return [String] The URL of this resource.
|
184
|
+
def url
|
185
|
+
@properties['url']
|
186
|
+
end
|
187
|
+
|
188
|
+
##
|
189
|
+
# Fetch a CurrentCallInstance
|
190
|
+
# @param [String] from The originating Phone Number, given in E.164 format
|
191
|
+
# (https://en.wikipedia.org/wiki/E.164). This phone number should be a Twilio
|
192
|
+
# number, otherwise it will return an error with HTTP Status Code 400.
|
193
|
+
# @param [String] to The terminating Phone Number, given in E.164 format
|
194
|
+
# (https://en.wikipedia.org/wiki/E.164).
|
195
|
+
# @return [CurrentCallInstance] Fetched CurrentCallInstance
|
196
|
+
def fetch(from: :unset, to: :unset)
|
197
|
+
context.fetch(from: from, to: to, )
|
198
|
+
end
|
199
|
+
|
200
|
+
##
|
201
|
+
# Provide a user friendly representation
|
202
|
+
def to_s
|
203
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
204
|
+
"<Twilio.Preview.TrustedComms.CurrentCallInstance #{values}>"
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Provide a detailed, user friendly representation
|
209
|
+
def inspect
|
210
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
211
|
+
"<Twilio.Preview.TrustedComms.CurrentCallInstance #{values}>"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,146 @@
|
|
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 Preview < Domain
|
12
|
+
class TrustedComms < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
15
|
+
class DeviceList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the DeviceList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [DeviceList] DeviceList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Devices"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Retrieve a single page of DeviceInstance records from the API.
|
30
|
+
# Request is executed immediately.
|
31
|
+
# @param [String] phone_number The end user Phone Number linked to the device,
|
32
|
+
# given in E.164 format (https://en.wikipedia.org/wiki/E.164). The SDK or partner
|
33
|
+
# app is responsible of verifying this phone number veracity.
|
34
|
+
# @param [String] push_token The Push Token for this Phone Number, linked to the
|
35
|
+
# correct SDK's application, certificate and keys.
|
36
|
+
# @return [DeviceInstance] Newly created DeviceInstance
|
37
|
+
def create(phone_number: nil, push_token: nil)
|
38
|
+
data = Twilio::Values.of({'PhoneNumber' => phone_number, 'PushToken' => push_token, })
|
39
|
+
|
40
|
+
payload = @version.create(
|
41
|
+
'POST',
|
42
|
+
@uri,
|
43
|
+
data: data
|
44
|
+
)
|
45
|
+
|
46
|
+
DeviceInstance.new(@version, payload, )
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Provide a user friendly representation
|
51
|
+
def to_s
|
52
|
+
'#<Twilio.Preview.TrustedComms.DeviceList>'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
58
|
+
class DevicePage < Page
|
59
|
+
##
|
60
|
+
# Initialize the DevicePage
|
61
|
+
# @param [Version] version Version that contains the resource
|
62
|
+
# @param [Response] response Response from the API
|
63
|
+
# @param [Hash] solution Path solution for the resource
|
64
|
+
# @return [DevicePage] DevicePage
|
65
|
+
def initialize(version, response, solution)
|
66
|
+
super(version, response)
|
67
|
+
|
68
|
+
# Path Solution
|
69
|
+
@solution = solution
|
70
|
+
end
|
71
|
+
|
72
|
+
##
|
73
|
+
# Build an instance of DeviceInstance
|
74
|
+
# @param [Hash] payload Payload response from the API
|
75
|
+
# @return [DeviceInstance] DeviceInstance
|
76
|
+
def get_instance(payload)
|
77
|
+
DeviceInstance.new(@version, payload, )
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Provide a user friendly representation
|
82
|
+
def to_s
|
83
|
+
'<Twilio.Preview.TrustedComms.DevicePage>'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
89
|
+
class DeviceInstance < InstanceResource
|
90
|
+
##
|
91
|
+
# Initialize the DeviceInstance
|
92
|
+
# @param [Version] version Version that contains the resource
|
93
|
+
# @param [Hash] payload payload that contains response from Twilio
|
94
|
+
# @return [DeviceInstance] DeviceInstance
|
95
|
+
def initialize(version, payload)
|
96
|
+
super(version)
|
97
|
+
|
98
|
+
# Marshaled Properties
|
99
|
+
@properties = {
|
100
|
+
'sid' => payload['sid'],
|
101
|
+
'phone_number' => payload['phone_number'],
|
102
|
+
'binding_sid' => payload['binding_sid'],
|
103
|
+
'url' => payload['url'],
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# @return [String] A string that uniquely identifies this Device.
|
109
|
+
def sid
|
110
|
+
@properties['sid']
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# @return [String] The end user Phone Number
|
115
|
+
def phone_number
|
116
|
+
@properties['phone_number']
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# @return [String] Binding Sid.
|
121
|
+
def binding_sid
|
122
|
+
@properties['binding_sid']
|
123
|
+
end
|
124
|
+
|
125
|
+
##
|
126
|
+
# @return [String] The URL of this resource.
|
127
|
+
def url
|
128
|
+
@properties['url']
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Provide a user friendly representation
|
133
|
+
def to_s
|
134
|
+
"<Twilio.Preview.TrustedComms.DeviceInstance>"
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# Provide a detailed, user friendly representation
|
139
|
+
def inspect
|
140
|
+
"<Twilio.Preview.TrustedComms.DeviceInstance>"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|