twilio-ruby 5.31.5 → 5.31.6
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/.rubocop.yml +1 -0
- data/CHANGES.md +31 -0
- data/Gemfile +0 -9
- data/Makefile +5 -14
- data/README.md +2 -2
- data/Rakefile +0 -54
- data/githooks/pre-commit +0 -0
- data/lib/twilio-ruby/rest/authy/v1/service.rb +12 -2
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +0 -7
- data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +0 -7
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +1 -1
- data/lib/twilio-ruby/rest/preview.rb +0 -6
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +8 -2
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +113 -8
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -7
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +23 -4
- data/lib/twilio-ruby/rest/supersim.rb +70 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +80 -0
- data/lib/twilio-ruby/rest/supersim/v1/command.rb +381 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +390 -0
- data/lib/twilio-ruby/rest/supersim/v1/sim.rb +380 -0
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +274 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +4 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call/payment_spec.rb +3 -3
- data/spec/integration/api/v2010/account/message_spec.rb +1 -1
- data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +0 -5
- data/spec/integration/authy/v1/service/entity/factor_spec.rb +0 -4
- data/spec/integration/authy/v1/service_spec.rb +4 -0
- data/spec/integration/messaging/v1/service/alpha_sender_spec.rb +9 -3
- data/spec/integration/preview/bulk_exports/export/day_spec.rb +67 -8
- data/spec/integration/serverless/v1/service_spec.rb +3 -0
- data/spec/integration/supersim/v1/command_spec.rb +186 -0
- data/spec/integration/supersim/v1/fleet_spec.rb +208 -0
- data/spec/integration/supersim/v1/sim_spec.rb +231 -0
- data/spec/integration/supersim/v1/usage_record_spec.rb +203 -0
- data/spec/integration/verify/v2/service/verification_spec.rb +42 -30
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribe_rule_spec.rb +1 -1
- data/spec/integration/voice/v1/dialing_permissions/settings_spec.rb +1 -1
- data/twilio-ruby.gemspec +5 -0
- metadata +86 -5
- data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +0 -146
- data/spec/integration/preview/trusted_comms/device_spec.rb +0 -45
@@ -19,7 +19,6 @@ module Twilio
|
|
19
19
|
@businesses = nil
|
20
20
|
@cps = nil
|
21
21
|
@current_calls = nil
|
22
|
-
@devices = nil
|
23
22
|
@phone_calls = nil
|
24
23
|
end
|
25
24
|
|
@@ -56,12 +55,6 @@ module Twilio
|
|
56
55
|
@current_calls ||= CurrentCallContext.new self
|
57
56
|
end
|
58
57
|
|
59
|
-
##
|
60
|
-
# @return [Twilio::REST::Preview::TrustedComms::DeviceContext]
|
61
|
-
def devices
|
62
|
-
@devices ||= DeviceList.new self
|
63
|
-
end
|
64
|
-
|
65
58
|
##
|
66
59
|
# @return [Twilio::REST::Preview::TrustedComms::PhoneCallContext]
|
67
60
|
def phone_calls
|
@@ -118,12 +118,15 @@ module Twilio
|
|
118
118
|
# the Service resource. It can be up to 255 characters long.
|
119
119
|
# @param [Boolean] include_credentials Whether to inject Account credentials into
|
120
120
|
# a function invocation context. The default value is `false`.
|
121
|
+
# @param [Boolean] ui_editable Whether the Service's properties and subresources
|
122
|
+
# can be edited via the UI. The default value is `false`.
|
121
123
|
# @return [ServiceInstance] Newly created ServiceInstance
|
122
|
-
def create(unique_name: nil, friendly_name: nil, include_credentials: :unset)
|
124
|
+
def create(unique_name: nil, friendly_name: nil, include_credentials: :unset, ui_editable: :unset)
|
123
125
|
data = Twilio::Values.of({
|
124
126
|
'UniqueName' => unique_name,
|
125
127
|
'FriendlyName' => friendly_name,
|
126
128
|
'IncludeCredentials' => include_credentials,
|
129
|
+
'UiEditable' => ui_editable,
|
127
130
|
})
|
128
131
|
|
129
132
|
payload = @version.create(
|
@@ -223,11 +226,14 @@ module Twilio
|
|
223
226
|
# a function invocation context.
|
224
227
|
# @param [String] friendly_name A descriptive string that you create to describe
|
225
228
|
# the Service resource. It can be up to 255 characters long.
|
229
|
+
# @param [Boolean] ui_editable Whether the Service's properties and subresources
|
230
|
+
# can be edited via the UI. The default value is `false`.
|
226
231
|
# @return [ServiceInstance] Updated ServiceInstance
|
227
|
-
def update(include_credentials: :unset, friendly_name: :unset)
|
232
|
+
def update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset)
|
228
233
|
data = Twilio::Values.of({
|
229
234
|
'IncludeCredentials' => include_credentials,
|
230
235
|
'FriendlyName' => friendly_name,
|
236
|
+
'UiEditable' => ui_editable,
|
231
237
|
})
|
232
238
|
|
233
239
|
payload = @version.update(
|
@@ -345,6 +351,7 @@ module Twilio
|
|
345
351
|
'friendly_name' => payload['friendly_name'],
|
346
352
|
'unique_name' => payload['unique_name'],
|
347
353
|
'include_credentials' => payload['include_credentials'],
|
354
|
+
'ui_editable' => payload['ui_editable'],
|
348
355
|
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
349
356
|
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
350
357
|
'url' => payload['url'],
|
@@ -397,6 +404,12 @@ module Twilio
|
|
397
404
|
@properties['include_credentials']
|
398
405
|
end
|
399
406
|
|
407
|
+
##
|
408
|
+
# @return [Boolean] Whether the Service's properties and subresources can be edited via the UI
|
409
|
+
def ui_editable
|
410
|
+
@properties['ui_editable']
|
411
|
+
end
|
412
|
+
|
400
413
|
##
|
401
414
|
# @return [Time] The ISO 8601 date and time in GMT when the Service resource was created
|
402
415
|
def date_created
|
@@ -441,9 +454,15 @@ module Twilio
|
|
441
454
|
# a function invocation context.
|
442
455
|
# @param [String] friendly_name A descriptive string that you create to describe
|
443
456
|
# the Service resource. It can be up to 255 characters long.
|
457
|
+
# @param [Boolean] ui_editable Whether the Service's properties and subresources
|
458
|
+
# can be edited via the UI. The default value is `false`.
|
444
459
|
# @return [ServiceInstance] Updated ServiceInstance
|
445
|
-
def update(include_credentials: :unset, friendly_name: :unset)
|
446
|
-
context.update(
|
460
|
+
def update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset)
|
461
|
+
context.update(
|
462
|
+
include_credentials: include_credentials,
|
463
|
+
friendly_name: friendly_name,
|
464
|
+
ui_editable: ui_editable,
|
465
|
+
)
|
447
466
|
end
|
448
467
|
|
449
468
|
##
|
@@ -0,0 +1,70 @@
|
|
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
|
+
##
|
13
|
+
# Initialize the Supersim Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://supersim.twilio.com'
|
18
|
+
@host = 'supersim.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v1 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v1 of supersim
|
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 Command
|
33
|
+
# resource.
|
34
|
+
# @return [Twilio::REST::Supersim::V1::CommandInstance] if sid was passed.
|
35
|
+
# @return [Twilio::REST::Supersim::V1::CommandList]
|
36
|
+
def commands(sid=:unset)
|
37
|
+
self.v1.commands(sid)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# @param [String] sid The unique string that we created to identify the Fleet
|
42
|
+
# resource.
|
43
|
+
# @return [Twilio::REST::Supersim::V1::FleetInstance] if sid was passed.
|
44
|
+
# @return [Twilio::REST::Supersim::V1::FleetList]
|
45
|
+
def fleets(sid=:unset)
|
46
|
+
self.v1.fleets(sid)
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# @param [String] sid The unique string that identifies the Sim resource.
|
51
|
+
# @return [Twilio::REST::Supersim::V1::SimInstance] if sid was passed.
|
52
|
+
# @return [Twilio::REST::Supersim::V1::SimList]
|
53
|
+
def sims(sid=:unset)
|
54
|
+
self.v1.sims(sid)
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# @return [Twilio::REST::Supersim::V1::UsageRecordInstance]
|
59
|
+
def usage_records
|
60
|
+
self.v1.usage_records()
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Provide a user friendly representation
|
65
|
+
def to_s
|
66
|
+
'#<Twilio::REST::Supersim>'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,80 @@
|
|
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
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of Supersim
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@commands = nil
|
19
|
+
@fleets = nil
|
20
|
+
@sims = nil
|
21
|
+
@usage_records = nil
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# @param [String] sid The SID of the Command resource to fetch.
|
26
|
+
# @return [Twilio::REST::Supersim::V1::CommandContext] if sid was passed.
|
27
|
+
# @return [Twilio::REST::Supersim::V1::CommandList]
|
28
|
+
def commands(sid=:unset)
|
29
|
+
if sid.nil?
|
30
|
+
raise ArgumentError, 'sid cannot be nil'
|
31
|
+
elsif sid == :unset
|
32
|
+
@commands ||= CommandList.new self
|
33
|
+
else
|
34
|
+
CommandContext.new(self, sid)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# @param [String] sid The SID of the Fleet resource to fetch.
|
40
|
+
# @return [Twilio::REST::Supersim::V1::FleetContext] if sid was passed.
|
41
|
+
# @return [Twilio::REST::Supersim::V1::FleetList]
|
42
|
+
def fleets(sid=:unset)
|
43
|
+
if sid.nil?
|
44
|
+
raise ArgumentError, 'sid cannot be nil'
|
45
|
+
elsif sid == :unset
|
46
|
+
@fleets ||= FleetList.new self
|
47
|
+
else
|
48
|
+
FleetContext.new(self, sid)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# @param [String] sid The SID of the Sim resource to fetch.
|
54
|
+
# @return [Twilio::REST::Supersim::V1::SimContext] if sid was passed.
|
55
|
+
# @return [Twilio::REST::Supersim::V1::SimList]
|
56
|
+
def sims(sid=:unset)
|
57
|
+
if sid.nil?
|
58
|
+
raise ArgumentError, 'sid cannot be nil'
|
59
|
+
elsif sid == :unset
|
60
|
+
@sims ||= SimList.new self
|
61
|
+
else
|
62
|
+
SimContext.new(self, sid)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# @return [Twilio::REST::Supersim::V1::UsageRecordContext]
|
68
|
+
def usage_records
|
69
|
+
@usage_records ||= UsageRecordList.new self
|
70
|
+
end
|
71
|
+
|
72
|
+
##
|
73
|
+
# Provide a user friendly representation
|
74
|
+
def to_s
|
75
|
+
'<Twilio::REST::Supersim::V1>'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,381 @@
|
|
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
|
+
##
|
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 CommandList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the CommandList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [CommandList] CommandList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Commands"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Retrieve a single page of CommandInstance records from the API.
|
30
|
+
# Request is executed immediately.
|
31
|
+
# @param [String] sim The `sid` or `unique_name` of the
|
32
|
+
# [SIM](https://www.twilio.com/docs/wireless/api/sim-resource) to send the Command
|
33
|
+
# to.
|
34
|
+
# @param [String] command The message body of the command.
|
35
|
+
# @param [String] callback_method The HTTP method we should use to call
|
36
|
+
# `callback_url`. Can be: `GET` or `POST` and the default is POST.
|
37
|
+
# @param [String] callback_url The URL we should call using the `callback_method`
|
38
|
+
# after we have sent the command.
|
39
|
+
# @return [CommandInstance] Newly created CommandInstance
|
40
|
+
def create(sim: nil, command: nil, callback_method: :unset, callback_url: :unset)
|
41
|
+
data = Twilio::Values.of({
|
42
|
+
'Sim' => sim,
|
43
|
+
'Command' => command,
|
44
|
+
'CallbackMethod' => callback_method,
|
45
|
+
'CallbackUrl' => callback_url,
|
46
|
+
})
|
47
|
+
|
48
|
+
payload = @version.create(
|
49
|
+
'POST',
|
50
|
+
@uri,
|
51
|
+
data: data
|
52
|
+
)
|
53
|
+
|
54
|
+
CommandInstance.new(@version, payload, )
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Lists CommandInstance records from the API as a list.
|
59
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
60
|
+
# memory before returning.
|
61
|
+
# @param [String] sim The SID or unique name of the Sim that Command was sent to
|
62
|
+
# or from.
|
63
|
+
# @param [command.Status] status The status of the Command. Can be: `queued`,
|
64
|
+
# `sent`, `delivered`, `received` or `failed`. See the [Command Status
|
65
|
+
# Values](https://www.twilio.com/docs/wireless/api/command-resource#status-values)
|
66
|
+
# for a description of each.
|
67
|
+
# @param [command.Direction] direction The direction of the Command. Can be
|
68
|
+
# `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
|
69
|
+
# `mobile terminated`, and `from_sim` is synonymous with the term `mobile
|
70
|
+
# originated`.
|
71
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
72
|
+
# guarantees to never return more than limit. Default is no limit
|
73
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
74
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
75
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
76
|
+
# efficient page size, i.e. min(limit, 1000)
|
77
|
+
# @return [Array] Array of up to limit results
|
78
|
+
def list(sim: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil)
|
79
|
+
self.stream(
|
80
|
+
sim: sim,
|
81
|
+
status: status,
|
82
|
+
direction: direction,
|
83
|
+
limit: limit,
|
84
|
+
page_size: page_size
|
85
|
+
).entries
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Streams CommandInstance records from the API as an Enumerable.
|
90
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
91
|
+
# is reached.
|
92
|
+
# @param [String] sim The SID or unique name of the Sim that Command was sent to
|
93
|
+
# or from.
|
94
|
+
# @param [command.Status] status The status of the Command. Can be: `queued`,
|
95
|
+
# `sent`, `delivered`, `received` or `failed`. See the [Command Status
|
96
|
+
# Values](https://www.twilio.com/docs/wireless/api/command-resource#status-values)
|
97
|
+
# for a description of each.
|
98
|
+
# @param [command.Direction] direction The direction of the Command. Can be
|
99
|
+
# `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
|
100
|
+
# `mobile terminated`, and `from_sim` is synonymous with the term `mobile
|
101
|
+
# originated`.
|
102
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
103
|
+
# guarantees to never return more than limit. Default is no limit.
|
104
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
105
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
106
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
107
|
+
# efficient page size, i.e. min(limit, 1000)
|
108
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
109
|
+
def stream(sim: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil)
|
110
|
+
limits = @version.read_limits(limit, page_size)
|
111
|
+
|
112
|
+
page = self.page(sim: sim, status: status, direction: direction, page_size: limits[:page_size], )
|
113
|
+
|
114
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# When passed a block, yields CommandInstance records from the API.
|
119
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
120
|
+
# is reached.
|
121
|
+
def each
|
122
|
+
limits = @version.read_limits
|
123
|
+
|
124
|
+
page = self.page(page_size: limits[:page_size], )
|
125
|
+
|
126
|
+
@version.stream(page,
|
127
|
+
limit: limits[:limit],
|
128
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Retrieve a single page of CommandInstance records from the API.
|
133
|
+
# Request is executed immediately.
|
134
|
+
# @param [String] sim The SID or unique name of the Sim that Command was sent to
|
135
|
+
# or from.
|
136
|
+
# @param [command.Status] status The status of the Command. Can be: `queued`,
|
137
|
+
# `sent`, `delivered`, `received` or `failed`. See the [Command Status
|
138
|
+
# Values](https://www.twilio.com/docs/wireless/api/command-resource#status-values)
|
139
|
+
# for a description of each.
|
140
|
+
# @param [command.Direction] direction The direction of the Command. Can be
|
141
|
+
# `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
|
142
|
+
# `mobile terminated`, and `from_sim` is synonymous with the term `mobile
|
143
|
+
# originated`.
|
144
|
+
# @param [String] page_token PageToken provided by the API
|
145
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
146
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
147
|
+
# @return [Page] Page of CommandInstance
|
148
|
+
def page(sim: :unset, status: :unset, direction: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
149
|
+
params = Twilio::Values.of({
|
150
|
+
'Sim' => sim,
|
151
|
+
'Status' => status,
|
152
|
+
'Direction' => direction,
|
153
|
+
'PageToken' => page_token,
|
154
|
+
'Page' => page_number,
|
155
|
+
'PageSize' => page_size,
|
156
|
+
})
|
157
|
+
response = @version.page(
|
158
|
+
'GET',
|
159
|
+
@uri,
|
160
|
+
params
|
161
|
+
)
|
162
|
+
CommandPage.new(@version, response, @solution)
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Retrieve a single page of CommandInstance records from the API.
|
167
|
+
# Request is executed immediately.
|
168
|
+
# @param [String] target_url API-generated URL for the requested results page
|
169
|
+
# @return [Page] Page of CommandInstance
|
170
|
+
def get_page(target_url)
|
171
|
+
response = @version.domain.request(
|
172
|
+
'GET',
|
173
|
+
target_url
|
174
|
+
)
|
175
|
+
CommandPage.new(@version, response, @solution)
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Provide a user friendly representation
|
180
|
+
def to_s
|
181
|
+
'#<Twilio.Supersim.V1.CommandList>'
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# 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.
|
187
|
+
class CommandPage < Page
|
188
|
+
##
|
189
|
+
# Initialize the CommandPage
|
190
|
+
# @param [Version] version Version that contains the resource
|
191
|
+
# @param [Response] response Response from the API
|
192
|
+
# @param [Hash] solution Path solution for the resource
|
193
|
+
# @return [CommandPage] CommandPage
|
194
|
+
def initialize(version, response, solution)
|
195
|
+
super(version, response)
|
196
|
+
|
197
|
+
# Path Solution
|
198
|
+
@solution = solution
|
199
|
+
end
|
200
|
+
|
201
|
+
##
|
202
|
+
# Build an instance of CommandInstance
|
203
|
+
# @param [Hash] payload Payload response from the API
|
204
|
+
# @return [CommandInstance] CommandInstance
|
205
|
+
def get_instance(payload)
|
206
|
+
CommandInstance.new(@version, payload, )
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Provide a user friendly representation
|
211
|
+
def to_s
|
212
|
+
'<Twilio.Supersim.V1.CommandPage>'
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# 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.
|
218
|
+
class CommandContext < InstanceContext
|
219
|
+
##
|
220
|
+
# Initialize the CommandContext
|
221
|
+
# @param [Version] version Version that contains the resource
|
222
|
+
# @param [String] sid The SID of the Command resource to fetch.
|
223
|
+
# @return [CommandContext] CommandContext
|
224
|
+
def initialize(version, sid)
|
225
|
+
super(version)
|
226
|
+
|
227
|
+
# Path Solution
|
228
|
+
@solution = {sid: sid, }
|
229
|
+
@uri = "/Commands/#{@solution[:sid]}"
|
230
|
+
end
|
231
|
+
|
232
|
+
##
|
233
|
+
# Fetch a CommandInstance
|
234
|
+
# @return [CommandInstance] Fetched CommandInstance
|
235
|
+
def fetch
|
236
|
+
params = Twilio::Values.of({})
|
237
|
+
|
238
|
+
payload = @version.fetch(
|
239
|
+
'GET',
|
240
|
+
@uri,
|
241
|
+
params,
|
242
|
+
)
|
243
|
+
|
244
|
+
CommandInstance.new(@version, payload, sid: @solution[:sid], )
|
245
|
+
end
|
246
|
+
|
247
|
+
##
|
248
|
+
# Provide a user friendly representation
|
249
|
+
def to_s
|
250
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
251
|
+
"#<Twilio.Supersim.V1.CommandContext #{context}>"
|
252
|
+
end
|
253
|
+
|
254
|
+
##
|
255
|
+
# Provide a detailed, user friendly representation
|
256
|
+
def inspect
|
257
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
258
|
+
"#<Twilio.Supersim.V1.CommandContext #{context}>"
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# 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.
|
264
|
+
class CommandInstance < InstanceResource
|
265
|
+
##
|
266
|
+
# Initialize the CommandInstance
|
267
|
+
# @param [Version] version Version that contains the resource
|
268
|
+
# @param [Hash] payload payload that contains response from Twilio
|
269
|
+
# @param [String] sid The SID of the Command resource to fetch.
|
270
|
+
# @return [CommandInstance] CommandInstance
|
271
|
+
def initialize(version, payload, sid: nil)
|
272
|
+
super(version)
|
273
|
+
|
274
|
+
# Marshaled Properties
|
275
|
+
@properties = {
|
276
|
+
'sid' => payload['sid'],
|
277
|
+
'account_sid' => payload['account_sid'],
|
278
|
+
'sim_sid' => payload['sim_sid'],
|
279
|
+
'command' => payload['command'],
|
280
|
+
'status' => payload['status'],
|
281
|
+
'direction' => payload['direction'],
|
282
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
283
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
284
|
+
'url' => payload['url'],
|
285
|
+
}
|
286
|
+
|
287
|
+
# Context
|
288
|
+
@instance_context = nil
|
289
|
+
@params = {'sid' => sid || @properties['sid'], }
|
290
|
+
end
|
291
|
+
|
292
|
+
##
|
293
|
+
# Generate an instance context for the instance, the context is capable of
|
294
|
+
# performing various actions. All instance actions are proxied to the context
|
295
|
+
# @return [CommandContext] CommandContext for this CommandInstance
|
296
|
+
def context
|
297
|
+
unless @instance_context
|
298
|
+
@instance_context = CommandContext.new(@version, @params['sid'], )
|
299
|
+
end
|
300
|
+
@instance_context
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# @return [String] The unique string that identifies the resource
|
305
|
+
def sid
|
306
|
+
@properties['sid']
|
307
|
+
end
|
308
|
+
|
309
|
+
##
|
310
|
+
# @return [String] The SID of the Account that created the resource
|
311
|
+
def account_sid
|
312
|
+
@properties['account_sid']
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# @return [String] The SID of the SIM that this Command was sent to or from
|
317
|
+
def sim_sid
|
318
|
+
@properties['sim_sid']
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# @return [String] The message body of the command sent to or from the SIM
|
323
|
+
def command
|
324
|
+
@properties['command']
|
325
|
+
end
|
326
|
+
|
327
|
+
##
|
328
|
+
# @return [command.Status] The status of the Command
|
329
|
+
def status
|
330
|
+
@properties['status']
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# @return [command.Direction] The direction of the Command
|
335
|
+
def direction
|
336
|
+
@properties['direction']
|
337
|
+
end
|
338
|
+
|
339
|
+
##
|
340
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
341
|
+
def date_created
|
342
|
+
@properties['date_created']
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
|
347
|
+
def date_updated
|
348
|
+
@properties['date_updated']
|
349
|
+
end
|
350
|
+
|
351
|
+
##
|
352
|
+
# @return [String] The absolute URL of the Command resource
|
353
|
+
def url
|
354
|
+
@properties['url']
|
355
|
+
end
|
356
|
+
|
357
|
+
##
|
358
|
+
# Fetch a CommandInstance
|
359
|
+
# @return [CommandInstance] Fetched CommandInstance
|
360
|
+
def fetch
|
361
|
+
context.fetch
|
362
|
+
end
|
363
|
+
|
364
|
+
##
|
365
|
+
# Provide a user friendly representation
|
366
|
+
def to_s
|
367
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
368
|
+
"<Twilio.Supersim.V1.CommandInstance #{values}>"
|
369
|
+
end
|
370
|
+
|
371
|
+
##
|
372
|
+
# Provide a detailed, user friendly representation
|
373
|
+
def inspect
|
374
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
375
|
+
"<Twilio.Supersim.V1.CommandInstance #{values}>"
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|