twilio-ruby 5.54.0 → 5.57.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +7 -7
- data/.travis.yml +2 -2
- data/CHANGES.md +52 -0
- data/README.md +10 -2
- data/lib/twilio-ruby.rb +5 -15
- data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
- data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
- data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
- data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
- data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
- data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
- data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
- data/lib/twilio-ruby/http.rb +5 -0
- data/lib/twilio-ruby/http/http_client.rb +11 -1
- data/lib/twilio-ruby/rest.rb +13 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +8 -7
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
- data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
- data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
- data/lib/twilio-ruby/rest/frontline_api.rb +47 -0
- data/lib/twilio-ruby/rest/frontline_api/v1.rb +45 -0
- data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +233 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +7 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +29 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +15 -6
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +6 -7
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +17 -9
@@ -0,0 +1,47 @@
|
|
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 FrontlineApi < Domain
|
12
|
+
##
|
13
|
+
# Initialize the FrontlineApi Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://frontline-api.twilio.com'
|
18
|
+
@host = 'frontline-api.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v1 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v1 of frontline_api
|
27
|
+
def v1
|
28
|
+
@v1 ||= V1.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# @param [String] sid The unique string that we created to identify the User
|
33
|
+
# resource.
|
34
|
+
# @return [Twilio::REST::Frontline_api::V1::UserInstance] if sid was passed.
|
35
|
+
# @return [Twilio::REST::Frontline_api::V1::UserList]
|
36
|
+
def users(sid=:unset)
|
37
|
+
self.v1.users(sid)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Provide a user friendly representation
|
42
|
+
def to_s
|
43
|
+
'#<Twilio::REST::FrontlineApi>'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,45 @@
|
|
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 FrontlineApi
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of FrontlineApi
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@users = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
23
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
24
|
+
# @return [Twilio::REST::Frontline_api::V1::UserContext] if sid was passed.
|
25
|
+
# @return [Twilio::REST::Frontline_api::V1::UserList]
|
26
|
+
def users(sid=:unset)
|
27
|
+
if sid.nil?
|
28
|
+
raise ArgumentError, 'sid cannot be nil'
|
29
|
+
end
|
30
|
+
if sid == :unset
|
31
|
+
@users ||= UserList.new self
|
32
|
+
else
|
33
|
+
UserContext.new(self, sid)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Provide a user friendly representation
|
39
|
+
def to_s
|
40
|
+
'<Twilio::REST::FrontlineApi::V1>'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,233 @@
|
|
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 FrontlineApi < Domain
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
15
|
+
class UserList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the UserList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [UserList] UserList
|
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.FrontlineApi.V1.UserList>'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
36
|
+
class UserPage < Page
|
37
|
+
##
|
38
|
+
# Initialize the UserPage
|
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 [UserPage] UserPage
|
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 UserInstance
|
52
|
+
# @param [Hash] payload Payload response from the API
|
53
|
+
# @return [UserInstance] UserInstance
|
54
|
+
def get_instance(payload)
|
55
|
+
UserInstance.new(@version, payload, )
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Provide a user friendly representation
|
60
|
+
def to_s
|
61
|
+
'<Twilio.FrontlineApi.V1.UserPage>'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
67
|
+
class UserContext < InstanceContext
|
68
|
+
##
|
69
|
+
# Initialize the UserContext
|
70
|
+
# @param [Version] version Version that contains the resource
|
71
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
72
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
73
|
+
# @return [UserContext] UserContext
|
74
|
+
def initialize(version, sid)
|
75
|
+
super(version)
|
76
|
+
|
77
|
+
# Path Solution
|
78
|
+
@solution = {sid: sid, }
|
79
|
+
@uri = "/Users/#{@solution[:sid]}"
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Fetch the UserInstance
|
84
|
+
# @return [UserInstance] Fetched UserInstance
|
85
|
+
def fetch
|
86
|
+
payload = @version.fetch('GET', @uri)
|
87
|
+
|
88
|
+
UserInstance.new(@version, payload, sid: @solution[:sid], )
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# Update the UserInstance
|
93
|
+
# @param [String] friendly_name The string that you assigned to describe the User.
|
94
|
+
# @param [String] avatar The avatar URL which will be shown in Frontline
|
95
|
+
# application.
|
96
|
+
# @param [user.StateType] state Current state of this user. Can be either `active`
|
97
|
+
# or `deactivated` and defaults to `active`
|
98
|
+
# @return [UserInstance] Updated UserInstance
|
99
|
+
def update(friendly_name: :unset, avatar: :unset, state: :unset)
|
100
|
+
data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Avatar' => avatar, 'State' => state, })
|
101
|
+
|
102
|
+
payload = @version.update('POST', @uri, data: data)
|
103
|
+
|
104
|
+
UserInstance.new(@version, payload, sid: @solution[:sid], )
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Provide a user friendly representation
|
109
|
+
def to_s
|
110
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
111
|
+
"#<Twilio.FrontlineApi.V1.UserContext #{context}>"
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# Provide a detailed, user friendly representation
|
116
|
+
def inspect
|
117
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
118
|
+
"#<Twilio.FrontlineApi.V1.UserContext #{context}>"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
124
|
+
class UserInstance < InstanceResource
|
125
|
+
##
|
126
|
+
# Initialize the UserInstance
|
127
|
+
# @param [Version] version Version that contains the resource
|
128
|
+
# @param [Hash] payload payload that contains response from Twilio
|
129
|
+
# @param [String] sid The SID of the User resource to fetch. This value can be
|
130
|
+
# either the `sid` or the `identity` of the User resource to fetch.
|
131
|
+
# @return [UserInstance] UserInstance
|
132
|
+
def initialize(version, payload, sid: nil)
|
133
|
+
super(version)
|
134
|
+
|
135
|
+
# Marshaled Properties
|
136
|
+
@properties = {
|
137
|
+
'sid' => payload['sid'],
|
138
|
+
'identity' => payload['identity'],
|
139
|
+
'friendly_name' => payload['friendly_name'],
|
140
|
+
'avatar' => payload['avatar'],
|
141
|
+
'state' => payload['state'],
|
142
|
+
'url' => payload['url'],
|
143
|
+
}
|
144
|
+
|
145
|
+
# Context
|
146
|
+
@instance_context = nil
|
147
|
+
@params = {'sid' => sid || @properties['sid'], }
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# Generate an instance context for the instance, the context is capable of
|
152
|
+
# performing various actions. All instance actions are proxied to the context
|
153
|
+
# @return [UserContext] UserContext for this UserInstance
|
154
|
+
def context
|
155
|
+
unless @instance_context
|
156
|
+
@instance_context = UserContext.new(@version, @params['sid'], )
|
157
|
+
end
|
158
|
+
@instance_context
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# @return [String] The unique string that identifies the resource
|
163
|
+
def sid
|
164
|
+
@properties['sid']
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# @return [String] The string that identifies the resource's User
|
169
|
+
def identity
|
170
|
+
@properties['identity']
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# @return [String] The string that you assigned to describe the User
|
175
|
+
def friendly_name
|
176
|
+
@properties['friendly_name']
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# @return [String] The avatar URL which will be shown in Frontline application
|
181
|
+
def avatar
|
182
|
+
@properties['avatar']
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# @return [user.StateType] Current state of this user
|
187
|
+
def state
|
188
|
+
@properties['state']
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# @return [String] An absolute URL for this user.
|
193
|
+
def url
|
194
|
+
@properties['url']
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Fetch the UserInstance
|
199
|
+
# @return [UserInstance] Fetched UserInstance
|
200
|
+
def fetch
|
201
|
+
context.fetch
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# Update the UserInstance
|
206
|
+
# @param [String] friendly_name The string that you assigned to describe the User.
|
207
|
+
# @param [String] avatar The avatar URL which will be shown in Frontline
|
208
|
+
# application.
|
209
|
+
# @param [user.StateType] state Current state of this user. Can be either `active`
|
210
|
+
# or `deactivated` and defaults to `active`
|
211
|
+
# @return [UserInstance] Updated UserInstance
|
212
|
+
def update(friendly_name: :unset, avatar: :unset, state: :unset)
|
213
|
+
context.update(friendly_name: friendly_name, avatar: avatar, state: state, )
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Provide a user friendly representation
|
218
|
+
def to_s
|
219
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
220
|
+
"<Twilio.FrontlineApi.V1.UserInstance #{values}>"
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Provide a detailed, user friendly representation
|
225
|
+
def inspect
|
226
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
227
|
+
"<Twilio.FrontlineApi.V1.UserInstance #{values}>"
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -223,6 +223,7 @@ module Twilio
|
|
223
223
|
'tcr_id' => payload['tcr_id'],
|
224
224
|
'failure_reason' => payload['failure_reason'],
|
225
225
|
'url' => payload['url'],
|
226
|
+
'brand_score' => payload['brand_score'] == nil ? payload['brand_score'] : payload['brand_score'].to_i,
|
226
227
|
}
|
227
228
|
|
228
229
|
# Context
|
@@ -301,6 +302,12 @@ module Twilio
|
|
301
302
|
@properties['url']
|
302
303
|
end
|
303
304
|
|
305
|
+
##
|
306
|
+
# @return [String] Brand score
|
307
|
+
def brand_score
|
308
|
+
@properties['brand_score']
|
309
|
+
end
|
310
|
+
|
304
311
|
##
|
305
312
|
# Fetch the BrandRegistrationInstance
|
306
313
|
# @return [BrandRegistrationInstance] Fetched BrandRegistrationInstance
|
@@ -200,6 +200,9 @@ module Twilio
|
|
200
200
|
# Path Solution
|
201
201
|
@solution = {sid: sid, }
|
202
202
|
@uri = "/Sims/#{@solution[:sid]}"
|
203
|
+
|
204
|
+
# Dependents
|
205
|
+
@billing_periods = nil
|
203
206
|
end
|
204
207
|
|
205
208
|
##
|
@@ -246,6 +249,18 @@ module Twilio
|
|
246
249
|
SimInstance.new(@version, payload, sid: @solution[:sid], )
|
247
250
|
end
|
248
251
|
|
252
|
+
##
|
253
|
+
# Access the billing_periods
|
254
|
+
# @return [BillingPeriodList]
|
255
|
+
# @return [BillingPeriodContext]
|
256
|
+
def billing_periods
|
257
|
+
unless @billing_periods
|
258
|
+
@billing_periods = BillingPeriodList.new(@version, sim_sid: @solution[:sid], )
|
259
|
+
end
|
260
|
+
|
261
|
+
@billing_periods
|
262
|
+
end
|
263
|
+
|
249
264
|
##
|
250
265
|
# Provide a user friendly representation
|
251
266
|
def to_s
|
@@ -284,6 +299,7 @@ module Twilio
|
|
284
299
|
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
285
300
|
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
286
301
|
'url' => payload['url'],
|
302
|
+
'links' => payload['links'],
|
287
303
|
}
|
288
304
|
|
289
305
|
# Context
|
@@ -356,6 +372,12 @@ module Twilio
|
|
356
372
|
@properties['url']
|
357
373
|
end
|
358
374
|
|
375
|
+
##
|
376
|
+
# @return [String] The links
|
377
|
+
def links
|
378
|
+
@properties['links']
|
379
|
+
end
|
380
|
+
|
359
381
|
##
|
360
382
|
# Fetch the SimInstance
|
361
383
|
# @return [SimInstance] Fetched SimInstance
|
@@ -394,6 +416,13 @@ module Twilio
|
|
394
416
|
)
|
395
417
|
end
|
396
418
|
|
419
|
+
##
|
420
|
+
# Access the billing_periods
|
421
|
+
# @return [billing_periods] billing_periods
|
422
|
+
def billing_periods
|
423
|
+
context.billing_periods
|
424
|
+
end
|
425
|
+
|
397
426
|
##
|
398
427
|
# Provide a user friendly representation
|
399
428
|
def to_s
|
@@ -0,0 +1,231 @@
|
|
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 Supersim < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class SimContext < InstanceContext
|
14
|
+
class BillingPeriodList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the BillingPeriodList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] sim_sid The SID of the Super SIM the Billing Period belongs to.
|
19
|
+
# @return [BillingPeriodList] BillingPeriodList
|
20
|
+
def initialize(version, sim_sid: nil)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {sim_sid: sim_sid}
|
25
|
+
@uri = "/Sims/#{@solution[:sim_sid]}/BillingPeriods"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists BillingPeriodInstance records from the API as a list.
|
30
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
31
|
+
# memory before returning.
|
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
|
35
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
36
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
37
|
+
# efficient page size, i.e. min(limit, 1000)
|
38
|
+
# @return [Array] Array of up to limit results
|
39
|
+
def list(limit: nil, page_size: nil)
|
40
|
+
self.stream(limit: limit, page_size: page_size).entries
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Streams BillingPeriodInstance records from the API as an Enumerable.
|
45
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
46
|
+
# is reached.
|
47
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
48
|
+
# guarantees to never return more than limit. Default is no limit.
|
49
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
50
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
51
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
52
|
+
# efficient page size, i.e. min(limit, 1000)
|
53
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
54
|
+
def stream(limit: nil, page_size: nil)
|
55
|
+
limits = @version.read_limits(limit, page_size)
|
56
|
+
|
57
|
+
page = self.page(page_size: limits[:page_size], )
|
58
|
+
|
59
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# When passed a block, yields BillingPeriodInstance records from the API.
|
64
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
65
|
+
# is reached.
|
66
|
+
def each
|
67
|
+
limits = @version.read_limits
|
68
|
+
|
69
|
+
page = self.page(page_size: limits[:page_size], )
|
70
|
+
|
71
|
+
@version.stream(page,
|
72
|
+
limit: limits[:limit],
|
73
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Retrieve a single page of BillingPeriodInstance records from the API.
|
78
|
+
# Request is executed immediately.
|
79
|
+
# @param [String] page_token PageToken provided by the API
|
80
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
81
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
82
|
+
# @return [Page] Page of BillingPeriodInstance
|
83
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
84
|
+
params = Twilio::Values.of({
|
85
|
+
'PageToken' => page_token,
|
86
|
+
'Page' => page_number,
|
87
|
+
'PageSize' => page_size,
|
88
|
+
})
|
89
|
+
|
90
|
+
response = @version.page('GET', @uri, params: params)
|
91
|
+
|
92
|
+
BillingPeriodPage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of BillingPeriodInstance records from the API.
|
97
|
+
# Request is executed immediately.
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
99
|
+
# @return [Page] Page of BillingPeriodInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
BillingPeriodPage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Provide a user friendly representation
|
110
|
+
def to_s
|
111
|
+
'#<Twilio.Supersim.V1.BillingPeriodList>'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class BillingPeriodPage < Page
|
116
|
+
##
|
117
|
+
# Initialize the BillingPeriodPage
|
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 [BillingPeriodPage] BillingPeriodPage
|
122
|
+
def initialize(version, response, solution)
|
123
|
+
super(version, response)
|
124
|
+
|
125
|
+
# Path Solution
|
126
|
+
@solution = solution
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Build an instance of BillingPeriodInstance
|
131
|
+
# @param [Hash] payload Payload response from the API
|
132
|
+
# @return [BillingPeriodInstance] BillingPeriodInstance
|
133
|
+
def get_instance(payload)
|
134
|
+
BillingPeriodInstance.new(@version, payload, sim_sid: @solution[:sim_sid], )
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# Provide a user friendly representation
|
139
|
+
def to_s
|
140
|
+
'<Twilio.Supersim.V1.BillingPeriodPage>'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class BillingPeriodInstance < InstanceResource
|
145
|
+
##
|
146
|
+
# Initialize the BillingPeriodInstance
|
147
|
+
# @param [Version] version Version that contains the resource
|
148
|
+
# @param [Hash] payload payload that contains response from Twilio
|
149
|
+
# @param [String] sim_sid The SID of the Super SIM the Billing Period belongs to.
|
150
|
+
# @return [BillingPeriodInstance] BillingPeriodInstance
|
151
|
+
def initialize(version, payload, sim_sid: nil)
|
152
|
+
super(version)
|
153
|
+
|
154
|
+
# Marshaled Properties
|
155
|
+
@properties = {
|
156
|
+
'sid' => payload['sid'],
|
157
|
+
'account_sid' => payload['account_sid'],
|
158
|
+
'sim_sid' => payload['sim_sid'],
|
159
|
+
'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
|
160
|
+
'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
|
161
|
+
'period_type' => payload['period_type'],
|
162
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
163
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
164
|
+
}
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# @return [String] The SID of the Billing Period
|
169
|
+
def sid
|
170
|
+
@properties['sid']
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# @return [String] The SID of the Account the Super SIM belongs to
|
175
|
+
def account_sid
|
176
|
+
@properties['account_sid']
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# @return [String] The SID of the Super SIM the Billing Period belongs to
|
181
|
+
def sim_sid
|
182
|
+
@properties['sim_sid']
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# @return [Time] The start time of the Billing Period
|
187
|
+
def start_time
|
188
|
+
@properties['start_time']
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# @return [Time] The end time of the Billing Period
|
193
|
+
def end_time
|
194
|
+
@properties['end_time']
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# @return [billing_period.BpType] The type of the Billing Period
|
199
|
+
def period_type
|
200
|
+
@properties['period_type']
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
205
|
+
def date_created
|
206
|
+
@properties['date_created']
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
|
211
|
+
def date_updated
|
212
|
+
@properties['date_updated']
|
213
|
+
end
|
214
|
+
|
215
|
+
##
|
216
|
+
# Provide a user friendly representation
|
217
|
+
def to_s
|
218
|
+
"<Twilio.Supersim.V1.BillingPeriodInstance>"
|
219
|
+
end
|
220
|
+
|
221
|
+
##
|
222
|
+
# Provide a detailed, user friendly representation
|
223
|
+
def inspect
|
224
|
+
"<Twilio.Supersim.V1.BillingPeriodInstance>"
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|