twilio-ruby 7.10.3 → 7.10.5
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 +147 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/transcription.rb +6 -0
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +6 -0
- data/lib/twilio-ruby/rest/flex_api/v1.rb +0 -6
- data/lib/twilio-ruby/rest/iam/v1/role_permission.rb +319 -0
- data/lib/twilio-ruby/rest/iam/v1.rb +6 -0
- data/lib/twilio-ruby/rest/insights/v2/inbound.rb +570 -0
- data/lib/twilio-ruby/rest/insights/v2/outbound.rb +641 -0
- data/lib/twilio-ruby/rest/insights/v2/report.rb +940 -0
- data/lib/twilio-ruby/rest/insights/v2.rb +79 -0
- data/lib/twilio-ruby/rest/insights_base.rb +6 -1
- data/lib/twilio-ruby/rest/messaging/v3/typing_indicator.rb +247 -0
- data/lib/twilio-ruby/rest/messaging/v3.rb +40 -0
- data/lib/twilio-ruby/rest/messaging_base.rb +5 -0
- data/lib/twilio-ruby/rest/numbers/v1/embedded_session.rb +251 -0
- data/lib/twilio-ruby/rest/numbers/v1/sender_id_registration.rb +333 -0
- data/lib/twilio-ruby/rest/numbers/v1.rb +12 -0
- data/lib/twilio-ruby/rest/numbers/v2/application.rb +153 -8
- data/lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb +197 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +33 -4
- data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +7 -0
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +7 -0
- data/lib/twilio-ruby/rest/verify/v2/service/approve_challenge.rb +7 -7
- data/lib/twilio-ruby/rest/verify/v2/service/new_challenge.rb +7 -7
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +4 -4
- data/lib/twilio-ruby/twiml/voice_response.rb +8 -3
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +11 -3
- data/lib/twilio-ruby/rest/flex_api/v1/create_flex_instance.rb +0 -382
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Sample/reference Twilio API.
|
|
8
|
+
# This is the reference API for the rest-proxy server.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
module Twilio
|
|
16
|
+
module REST
|
|
17
|
+
class Insights
|
|
18
|
+
class V2 < Version
|
|
19
|
+
##
|
|
20
|
+
# Initialize the V2 version of Insights
|
|
21
|
+
def initialize(domain)
|
|
22
|
+
super
|
|
23
|
+
@version = 'v2'
|
|
24
|
+
@inbound = nil
|
|
25
|
+
@outbound = nil
|
|
26
|
+
@reports = nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# @param [String] report_id A unique Report Id.
|
|
31
|
+
# @return [Twilio::REST::Insights::V2::InboundContext] if reportId was passed.
|
|
32
|
+
# @return [Twilio::REST::Insights::V2::InboundList]
|
|
33
|
+
def inbound(report_id=:unset)
|
|
34
|
+
if report_id.nil?
|
|
35
|
+
raise ArgumentError, 'report_id cannot be nil'
|
|
36
|
+
end
|
|
37
|
+
if report_id == :unset
|
|
38
|
+
@inbound ||= InboundList.new self
|
|
39
|
+
else
|
|
40
|
+
InboundContext.new(self, report_id)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
##
|
|
44
|
+
# @param [String] report_id A unique Report Id.
|
|
45
|
+
# @return [Twilio::REST::Insights::V2::OutboundContext] if reportId was passed.
|
|
46
|
+
# @return [Twilio::REST::Insights::V2::OutboundList]
|
|
47
|
+
def outbound(report_id=:unset)
|
|
48
|
+
if report_id.nil?
|
|
49
|
+
raise ArgumentError, 'report_id cannot be nil'
|
|
50
|
+
end
|
|
51
|
+
if report_id == :unset
|
|
52
|
+
@outbound ||= OutboundList.new self
|
|
53
|
+
else
|
|
54
|
+
OutboundContext.new(self, report_id)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
##
|
|
58
|
+
# @param [String] report_id A unique request id.
|
|
59
|
+
# @return [Twilio::REST::Insights::V2::ReportContext] if reportId was passed.
|
|
60
|
+
# @return [Twilio::REST::Insights::V2::ReportList]
|
|
61
|
+
def reports(report_id=:unset)
|
|
62
|
+
if report_id.nil?
|
|
63
|
+
raise ArgumentError, 'report_id cannot be nil'
|
|
64
|
+
end
|
|
65
|
+
if report_id == :unset
|
|
66
|
+
@reports ||= ReportList.new self
|
|
67
|
+
else
|
|
68
|
+
ReportContext.new(self, report_id)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
##
|
|
72
|
+
# Provide a user friendly representation
|
|
73
|
+
def to_s
|
|
74
|
+
'<Twilio::REST::Insights::V2>';
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -22,16 +22,21 @@ module Twilio
|
|
|
22
22
|
@host = "insights.twilio.com"
|
|
23
23
|
@port = 443
|
|
24
24
|
@v1 = nil
|
|
25
|
+
@v2 = nil
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def v1
|
|
28
29
|
@v1 ||= Insights::V1.new self
|
|
29
30
|
end
|
|
30
31
|
|
|
32
|
+
def v2
|
|
33
|
+
@v2 ||= Insights::V2.new self
|
|
34
|
+
end
|
|
35
|
+
|
|
31
36
|
##
|
|
32
37
|
# Provide a user friendly representation
|
|
33
38
|
def to_s
|
|
34
|
-
'<Twilio::REST::Insights
|
|
39
|
+
'<Twilio::REST::Insights>';
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
end
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Messaging
|
|
8
|
+
# This is the public Twilio REST API.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Messaging < MessagingBase
|
|
19
|
+
class V3 < Version
|
|
20
|
+
class TypingIndicatorList < ListResource
|
|
21
|
+
|
|
22
|
+
class TypingIndicatorRequest
|
|
23
|
+
# @param [channel]: [String] The messaging channel. Must be \"APPLE\".
|
|
24
|
+
# @param [message_id]: [String] The SID of a recent inbound message from the recipient. Must be an SM or MM SID format.
|
|
25
|
+
# @param [from]: [String] The Apple Messages for Business identifier of the sender (business).
|
|
26
|
+
# @param [to]: [String] The Apple Messages for Business identifier of the recipient (customer).
|
|
27
|
+
# @param [event]: [String] The type of typing event. \"START\" indicates the agent began typing, \"END\" indicates the agent stopped typing. Defaults to \"START\".
|
|
28
|
+
attr_accessor :channel, :message_id, :from, :to, :event
|
|
29
|
+
def initialize(payload)
|
|
30
|
+
@channel = payload["channel"]
|
|
31
|
+
@message_id = payload["message_id"]
|
|
32
|
+
@from = payload["from"]
|
|
33
|
+
@to = payload["to"]
|
|
34
|
+
@event = payload["event"]
|
|
35
|
+
end
|
|
36
|
+
def to_json(options = {})
|
|
37
|
+
{
|
|
38
|
+
"channel": @channel,
|
|
39
|
+
"messageId": @message_id,
|
|
40
|
+
"from": @from,
|
|
41
|
+
"to": @to,
|
|
42
|
+
"event": @event,
|
|
43
|
+
}.to_json(options)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# Initialize the TypingIndicatorList
|
|
50
|
+
# @param [Version] version Version that contains the resource
|
|
51
|
+
# @return [TypingIndicatorList] TypingIndicatorList
|
|
52
|
+
def initialize(version)
|
|
53
|
+
super(version)
|
|
54
|
+
|
|
55
|
+
# Path Solution
|
|
56
|
+
@solution = { }
|
|
57
|
+
@uri = "/Indicators/Typing.json"
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
##
|
|
61
|
+
# Create the TypingIndicatorInstance
|
|
62
|
+
# @param [TypingIndicatorRequest] typing_indicator_request
|
|
63
|
+
# @return [TypingIndicatorInstance] Created TypingIndicatorInstance
|
|
64
|
+
def create(typing_indicator_request: nil
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
68
|
+
headers['Content-Type'] = 'application/json'
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
payload = @version.create('POST', @uri, headers: headers, data: typing_indicator_request.to_json)
|
|
74
|
+
TypingIndicatorInstance.new(
|
|
75
|
+
@version,
|
|
76
|
+
payload,
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Create the TypingIndicatorInstanceMetadata
|
|
82
|
+
# @param [TypingIndicatorRequest] typing_indicator_request
|
|
83
|
+
# @return [TypingIndicatorInstance] Created TypingIndicatorInstance
|
|
84
|
+
def create_with_metadata(typing_indicator_request: nil
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
88
|
+
headers['Content-Type'] = 'application/json'
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: typing_indicator_request.to_json)
|
|
94
|
+
typing_indicator_instance = TypingIndicatorInstance.new(
|
|
95
|
+
@version,
|
|
96
|
+
response.body,
|
|
97
|
+
)
|
|
98
|
+
TypingIndicatorInstanceMetadata.new(
|
|
99
|
+
@version,
|
|
100
|
+
typing_indicator_instance,
|
|
101
|
+
response.headers,
|
|
102
|
+
response.status_code
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# Provide a user friendly representation
|
|
110
|
+
def to_s
|
|
111
|
+
'#<Twilio.Messaging.V3.TypingIndicatorList>'
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
class TypingIndicatorPage < Page
|
|
116
|
+
##
|
|
117
|
+
# Initialize the TypingIndicatorPage
|
|
118
|
+
# @param [Version] version Version that contains the resource
|
|
119
|
+
# @param [Response] response Response from the API
|
|
120
|
+
# @param [Hash] solution Path solution for the resource
|
|
121
|
+
# @return [TypingIndicatorPage] TypingIndicatorPage
|
|
122
|
+
def initialize(version, response, solution)
|
|
123
|
+
super(version, response)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# Path Solution
|
|
127
|
+
@solution = solution
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
##
|
|
131
|
+
# Build an instance of TypingIndicatorInstance
|
|
132
|
+
# @param [Hash] payload Payload response from the API
|
|
133
|
+
# @return [TypingIndicatorInstance] TypingIndicatorInstance
|
|
134
|
+
def get_instance(payload)
|
|
135
|
+
TypingIndicatorInstance.new(@version, payload)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
##
|
|
139
|
+
# Provide a user friendly representation
|
|
140
|
+
def to_s
|
|
141
|
+
'<Twilio.Messaging.V3.TypingIndicatorPage>'
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
class TypingIndicatorPageMetadata < PageMetadata
|
|
146
|
+
attr_reader :typing_indicator_page
|
|
147
|
+
|
|
148
|
+
def initialize(version, response, solution, limit)
|
|
149
|
+
super(version, response)
|
|
150
|
+
@typing_indicator_page = []
|
|
151
|
+
@limit = limit
|
|
152
|
+
key = get_key(response.body)
|
|
153
|
+
records = 0
|
|
154
|
+
while( limit != :unset && records < limit )
|
|
155
|
+
@typing_indicator_page << TypingIndicatorListResponse.new(version, @payload, key, limit - records)
|
|
156
|
+
@payload = self.next_page
|
|
157
|
+
break unless @payload
|
|
158
|
+
records += @payload.body[key].size
|
|
159
|
+
end
|
|
160
|
+
# Path Solution
|
|
161
|
+
@solution = solution
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def each
|
|
165
|
+
@typing_indicator_page.each do |record|
|
|
166
|
+
yield record
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def to_s
|
|
171
|
+
'<Twilio::REST::Messaging::V3PageMetadata>';
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
class TypingIndicatorListResponse < InstanceListResource
|
|
175
|
+
|
|
176
|
+
# @param [Array<TypingIndicatorInstance>] instance
|
|
177
|
+
# @param [Hash{String => Object}] headers
|
|
178
|
+
# @param [Integer] status_code
|
|
179
|
+
def initialize(version, payload, key, limit = :unset)
|
|
180
|
+
data_list = payload.body[key]
|
|
181
|
+
if limit != :unset
|
|
182
|
+
data_list = data_list[0, limit]
|
|
183
|
+
end
|
|
184
|
+
@typing_indicator = data_list.map do |data|
|
|
185
|
+
TypingIndicatorInstance.new(version, data)
|
|
186
|
+
end
|
|
187
|
+
@headers = payload.headers
|
|
188
|
+
@status_code = payload.status_code
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def typing_indicator
|
|
192
|
+
@typing_indicator
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def headers
|
|
196
|
+
@headers
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def status_code
|
|
200
|
+
@status_code
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
class TypingIndicatorInstance < InstanceResource
|
|
205
|
+
##
|
|
206
|
+
# Initialize the TypingIndicatorInstance
|
|
207
|
+
# @param [Version] version Version that contains the resource
|
|
208
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
209
|
+
# @param [String] account_sid The SID of the
|
|
210
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this TypingIndicator
|
|
211
|
+
# resource.
|
|
212
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
213
|
+
# @return [TypingIndicatorInstance] TypingIndicatorInstance
|
|
214
|
+
def initialize(version, payload )
|
|
215
|
+
super(version)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
# Marshaled Properties
|
|
219
|
+
@properties = {
|
|
220
|
+
'success' => payload['success'],
|
|
221
|
+
}
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
##
|
|
226
|
+
# @return [Boolean] Indicates if the typing indicator was sent successfully.
|
|
227
|
+
def success
|
|
228
|
+
@properties['success']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
# Provide a user friendly representation
|
|
233
|
+
def to_s
|
|
234
|
+
"<Twilio.Messaging.V3.TypingIndicatorInstance>"
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
##
|
|
238
|
+
# Provide a detailed, user friendly representation
|
|
239
|
+
def inspect
|
|
240
|
+
"<Twilio.Messaging.V3.TypingIndicatorInstance>"
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Messaging
|
|
8
|
+
# This is the public Twilio REST API.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
module Twilio
|
|
16
|
+
module REST
|
|
17
|
+
class Messaging
|
|
18
|
+
class V3 < Version
|
|
19
|
+
##
|
|
20
|
+
# Initialize the V3 version of Messaging
|
|
21
|
+
def initialize(domain)
|
|
22
|
+
super
|
|
23
|
+
@version = 'v3'
|
|
24
|
+
@typing_indicator = nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# @return [Twilio::REST::Messaging::V3::TypingIndicatorList]
|
|
29
|
+
def typing_indicator
|
|
30
|
+
@typing_indicator ||= TypingIndicatorList.new self
|
|
31
|
+
end
|
|
32
|
+
##
|
|
33
|
+
# Provide a user friendly representation
|
|
34
|
+
def to_s
|
|
35
|
+
'<Twilio::REST::Messaging::V3>';
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -23,6 +23,7 @@ module Twilio
|
|
|
23
23
|
@port = 443
|
|
24
24
|
@v1 = nil
|
|
25
25
|
@v2 = nil
|
|
26
|
+
@v3 = nil
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def v1
|
|
@@ -33,6 +34,10 @@ module Twilio
|
|
|
33
34
|
@v2 ||= Messaging::V2.new self
|
|
34
35
|
end
|
|
35
36
|
|
|
37
|
+
def v3
|
|
38
|
+
@v3 ||= Messaging::V3.new self
|
|
39
|
+
end
|
|
40
|
+
|
|
36
41
|
##
|
|
37
42
|
# Provide a user friendly representation
|
|
38
43
|
def to_s
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Numbers
|
|
8
|
+
# This is the public Twilio REST API.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Numbers < NumbersBase
|
|
19
|
+
class V1 < Version
|
|
20
|
+
class EmbeddedSessionList < ListResource
|
|
21
|
+
|
|
22
|
+
class NumbersV1CreateEmbeddedSessionRequest
|
|
23
|
+
# @param [theme_set_id]: [String] Theme ID for the Compliance Embeddable UI. Overrides the theme set during registration creation.
|
|
24
|
+
attr_accessor :theme_set_id
|
|
25
|
+
def initialize(payload)
|
|
26
|
+
@theme_set_id = payload["theme_set_id"]
|
|
27
|
+
end
|
|
28
|
+
def to_json(options = {})
|
|
29
|
+
{
|
|
30
|
+
"themeSetId": @theme_set_id,
|
|
31
|
+
}.to_json(options)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# Initialize the EmbeddedSessionList
|
|
38
|
+
# @param [Version] version Version that contains the resource
|
|
39
|
+
# @return [EmbeddedSessionList] EmbeddedSessionList
|
|
40
|
+
def initialize(version, bundle_sid: nil)
|
|
41
|
+
super(version)
|
|
42
|
+
|
|
43
|
+
# Path Solution
|
|
44
|
+
@solution = { bundle_sid: bundle_sid }
|
|
45
|
+
@uri = "/SenderIdRegistrations/#{@solution[:bundle_sid]}/EmbeddedSessions"
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
##
|
|
49
|
+
# Create the EmbeddedSessionInstance
|
|
50
|
+
# @param [NumbersV1CreateEmbeddedSessionRequest] numbers_v1_create_embedded_session_request
|
|
51
|
+
# @return [EmbeddedSessionInstance] Created EmbeddedSessionInstance
|
|
52
|
+
def create(numbers_v1_create_embedded_session_request: nil
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
56
|
+
headers['Content-Type'] = 'application/json'
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
payload = @version.create('POST', @uri, headers: headers, data: numbers_v1_create_embedded_session_request.to_json)
|
|
62
|
+
EmbeddedSessionInstance.new(
|
|
63
|
+
@version,
|
|
64
|
+
payload,
|
|
65
|
+
bundle_sid: @solution[:bundle_sid],
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
##
|
|
70
|
+
# Create the EmbeddedSessionInstanceMetadata
|
|
71
|
+
# @param [NumbersV1CreateEmbeddedSessionRequest] numbers_v1_create_embedded_session_request
|
|
72
|
+
# @return [EmbeddedSessionInstance] Created EmbeddedSessionInstance
|
|
73
|
+
def create_with_metadata(numbers_v1_create_embedded_session_request: nil
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
77
|
+
headers['Content-Type'] = 'application/json'
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: numbers_v1_create_embedded_session_request.to_json)
|
|
83
|
+
embedded_session_instance = EmbeddedSessionInstance.new(
|
|
84
|
+
@version,
|
|
85
|
+
response.body,
|
|
86
|
+
bundle_sid: @solution[:bundle_sid],
|
|
87
|
+
)
|
|
88
|
+
EmbeddedSessionInstanceMetadata.new(
|
|
89
|
+
@version,
|
|
90
|
+
embedded_session_instance,
|
|
91
|
+
response.headers,
|
|
92
|
+
response.status_code
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# Provide a user friendly representation
|
|
100
|
+
def to_s
|
|
101
|
+
'#<Twilio.Numbers.V1.EmbeddedSessionList>'
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class EmbeddedSessionPage < Page
|
|
106
|
+
##
|
|
107
|
+
# Initialize the EmbeddedSessionPage
|
|
108
|
+
# @param [Version] version Version that contains the resource
|
|
109
|
+
# @param [Response] response Response from the API
|
|
110
|
+
# @param [Hash] solution Path solution for the resource
|
|
111
|
+
# @return [EmbeddedSessionPage] EmbeddedSessionPage
|
|
112
|
+
def initialize(version, response, solution)
|
|
113
|
+
super(version, response)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# Path Solution
|
|
117
|
+
@solution = solution
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
##
|
|
121
|
+
# Build an instance of EmbeddedSessionInstance
|
|
122
|
+
# @param [Hash] payload Payload response from the API
|
|
123
|
+
# @return [EmbeddedSessionInstance] EmbeddedSessionInstance
|
|
124
|
+
def get_instance(payload)
|
|
125
|
+
EmbeddedSessionInstance.new(@version, payload, bundle_sid: @solution[:bundle_sid])
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
##
|
|
129
|
+
# Provide a user friendly representation
|
|
130
|
+
def to_s
|
|
131
|
+
'<Twilio.Numbers.V1.EmbeddedSessionPage>'
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
class EmbeddedSessionPageMetadata < PageMetadata
|
|
136
|
+
attr_reader :embedded_session_page
|
|
137
|
+
|
|
138
|
+
def initialize(version, response, solution, limit)
|
|
139
|
+
super(version, response)
|
|
140
|
+
@embedded_session_page = []
|
|
141
|
+
@limit = limit
|
|
142
|
+
key = get_key(response.body)
|
|
143
|
+
records = 0
|
|
144
|
+
while( limit != :unset && records < limit )
|
|
145
|
+
@embedded_session_page << EmbeddedSessionListResponse.new(version, @payload, key, limit - records)
|
|
146
|
+
@payload = self.next_page
|
|
147
|
+
break unless @payload
|
|
148
|
+
records += @payload.body[key].size
|
|
149
|
+
end
|
|
150
|
+
# Path Solution
|
|
151
|
+
@solution = solution
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def each
|
|
155
|
+
@embedded_session_page.each do |record|
|
|
156
|
+
yield record
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def to_s
|
|
161
|
+
'<Twilio::REST::Numbers::V1PageMetadata>';
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
class EmbeddedSessionListResponse < InstanceListResource
|
|
165
|
+
|
|
166
|
+
# @param [Array<EmbeddedSessionInstance>] instance
|
|
167
|
+
# @param [Hash{String => Object}] headers
|
|
168
|
+
# @param [Integer] status_code
|
|
169
|
+
def initialize(version, payload, key, limit = :unset)
|
|
170
|
+
data_list = payload.body[key]
|
|
171
|
+
if limit != :unset
|
|
172
|
+
data_list = data_list[0, limit]
|
|
173
|
+
end
|
|
174
|
+
@embedded_session = data_list.map do |data|
|
|
175
|
+
EmbeddedSessionInstance.new(version, data)
|
|
176
|
+
end
|
|
177
|
+
@headers = payload.headers
|
|
178
|
+
@status_code = payload.status_code
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def embedded_session
|
|
182
|
+
@embedded_session
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def headers
|
|
186
|
+
@headers
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def status_code
|
|
190
|
+
@status_code
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
class EmbeddedSessionInstance < InstanceResource
|
|
195
|
+
##
|
|
196
|
+
# Initialize the EmbeddedSessionInstance
|
|
197
|
+
# @param [Version] version Version that contains the resource
|
|
198
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
199
|
+
# @param [String] account_sid The SID of the
|
|
200
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this EmbeddedSession
|
|
201
|
+
# resource.
|
|
202
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
203
|
+
# @return [EmbeddedSessionInstance] EmbeddedSessionInstance
|
|
204
|
+
def initialize(version, payload , bundle_sid: nil)
|
|
205
|
+
super(version)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
# Marshaled Properties
|
|
209
|
+
@properties = {
|
|
210
|
+
'id' => payload['id'],
|
|
211
|
+
'session_id' => payload['session_id'],
|
|
212
|
+
'session_token' => payload['session_token'],
|
|
213
|
+
}
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
##
|
|
218
|
+
# @return [String] Registration identifier (BU-prefixed).
|
|
219
|
+
def id
|
|
220
|
+
@properties['id']
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
##
|
|
224
|
+
# @return [String] Session ID for the compliance embeddable.
|
|
225
|
+
def session_id
|
|
226
|
+
@properties['session_id']
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
##
|
|
230
|
+
# @return [String] Ephemeral session token for the compliance embeddable.
|
|
231
|
+
def session_token
|
|
232
|
+
@properties['session_token']
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
##
|
|
236
|
+
# Provide a user friendly representation
|
|
237
|
+
def to_s
|
|
238
|
+
"<Twilio.Numbers.V1.EmbeddedSessionInstance>"
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
##
|
|
242
|
+
# Provide a detailed, user friendly representation
|
|
243
|
+
def inspect
|
|
244
|
+
"<Twilio.Numbers.V1.EmbeddedSessionInstance>"
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|