twilio-ruby 5.0.0.rc4 → 5.0.0.rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -1
- data/Makefile +3 -0
- data/lib/twilio-ruby.rb +0 -1
- data/lib/twilio-ruby/framework/version.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/address.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/application.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +0 -11
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sandbox.rb +0 -10
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/sms/sms_message.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +0 -13
- data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +0 -13
- data/lib/twilio-ruby/rest/client.rb +7 -7
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +0 -12
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +0 -12
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +0 -13
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +0 -14
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +0 -14
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +0 -13
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +0 -18
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +0 -12
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +0 -12
- data/lib/twilio-ruby/rest/monitor/v1/event.rb +0 -12
- data/lib/twilio-ruby/rest/notifications.rb +4 -0
- data/lib/twilio-ruby/rest/notifications/v1.rb +9 -0
- data/lib/twilio-ruby/rest/notifications/v1/credential.rb +390 -0
- data/lib/twilio-ruby/rest/notifications/v1/service.rb +0 -12
- data/lib/twilio-ruby/rest/notifications/v1/service/binding.rb +0 -13
- data/lib/twilio-ruby/rest/preview.rb +47 -0
- data/lib/twilio-ruby/rest/preview/wireless.rb +53 -0
- data/lib/twilio-ruby/rest/preview/wireless/command.rb +345 -0
- data/lib/twilio-ruby/rest/preview/wireless/device.rb +456 -0
- data/lib/twilio-ruby/rest/preview/wireless/device/usage.rb +227 -0
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +325 -0
- data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +0 -12
- data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +0 -12
- data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +0 -12
- data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +0 -12
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +0 -12
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +0 -14
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +0 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +0 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +0 -10
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +0 -13
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +0 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +0 -10
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +0 -12
- data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +0 -13
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +0 -13
- data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +0 -13
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +0 -13
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/usage/trigger_spec.rb +3 -3
- data/spec/integration/ip_messaging/v1/credential_spec.rb +1 -1
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +1 -1
- data/spec/integration/notifications/v1/credential_spec.rb +228 -0
- data/spec/integration/notifications/v1/service/binding_spec.rb +2 -2
- data/spec/integration/preview/wireless/command_spec.rb +58 -0
- data/spec/integration/preview/wireless/device/usage_spec.rb +25 -0
- data/spec/integration/preview/wireless/device_spec.rb +72 -0
- data/spec/integration/preview/wireless/rate_plan_spec.rb +39 -0
- metadata +19 -16
- data/lib/twilio-ruby/rest/conversations.rb +0 -40
- data/lib/twilio-ruby/rest/conversations/v1.rb +0 -35
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +0 -270
- data/lib/twilio-ruby/rest/conversations/v1/conversation/completed.rb +0 -217
- data/lib/twilio-ruby/rest/conversations/v1/conversation/in_progress.rb +0 -217
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +0 -352
- data/spec/integration/conversations/v1/conversation/completed_spec.rb +0 -89
- data/spec/integration/conversations/v1/conversation/in_progress_spec.rb +0 -89
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +0 -174
- data/spec/integration/conversations/v1/conversation_spec.rb +0 -49
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Preview < Domain
|
|
10
|
+
class Wireless < Version
|
|
11
|
+
class DeviceContext < InstanceContext
|
|
12
|
+
class UsageList < ListResource
|
|
13
|
+
##
|
|
14
|
+
# Initialize the UsageList
|
|
15
|
+
# @param [Version] version Version that contains the resource
|
|
16
|
+
# @param [String] device_sid The device_sid
|
|
17
|
+
|
|
18
|
+
# @return [UsageList] UsageList
|
|
19
|
+
def initialize(version, device_sid: nil)
|
|
20
|
+
super(version)
|
|
21
|
+
|
|
22
|
+
# Path Solution
|
|
23
|
+
@solution = {
|
|
24
|
+
device_sid: device_sid
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# Provide a user friendly representation
|
|
30
|
+
def to_s
|
|
31
|
+
'#<Twilio.Preview.Wireless.UsageList>'
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class UsagePage < Page
|
|
36
|
+
##
|
|
37
|
+
# Initialize the UsagePage
|
|
38
|
+
# @param [Version] version Version that contains the resource
|
|
39
|
+
# @param [Response] response Response from the API
|
|
40
|
+
# @param [Hash] solution Path solution for the resource
|
|
41
|
+
# @param [String] device_sid The device_sid
|
|
42
|
+
|
|
43
|
+
# @return [UsagePage] UsagePage
|
|
44
|
+
def initialize(version, response, solution)
|
|
45
|
+
super(version, response)
|
|
46
|
+
|
|
47
|
+
# Path Solution
|
|
48
|
+
@solution = solution
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
##
|
|
52
|
+
# Build an instance of UsageInstance
|
|
53
|
+
# @param [Hash] payload Payload response from the API
|
|
54
|
+
|
|
55
|
+
# @return [UsageInstance] UsageInstance
|
|
56
|
+
def get_instance(payload)
|
|
57
|
+
return UsageInstance.new(
|
|
58
|
+
@version,
|
|
59
|
+
payload,
|
|
60
|
+
device_sid: @solution['device_sid'],
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
##
|
|
65
|
+
# Provide a user friendly representation
|
|
66
|
+
def to_s
|
|
67
|
+
'<Twilio.Preview.Wireless.UsagePage>'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class UsageContext < InstanceContext
|
|
72
|
+
##
|
|
73
|
+
# Initialize the UsageContext
|
|
74
|
+
# @param [Version] version Version that contains the resource
|
|
75
|
+
# @param [String] device_sid The device_sid
|
|
76
|
+
|
|
77
|
+
# @return [UsageContext] UsageContext
|
|
78
|
+
def initialize(version, device_sid)
|
|
79
|
+
super(version)
|
|
80
|
+
|
|
81
|
+
# Path Solution
|
|
82
|
+
@solution = {
|
|
83
|
+
device_sid: device_sid,
|
|
84
|
+
}
|
|
85
|
+
@uri = "/Devices/#{@solution[:device_sid]}/Usage"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
##
|
|
89
|
+
# Fetch a UsageInstance
|
|
90
|
+
# @param [String] end_ The end
|
|
91
|
+
# @param [String] start The start
|
|
92
|
+
|
|
93
|
+
# @return [UsageInstance] Fetched UsageInstance
|
|
94
|
+
def fetch(end_: nil, start: nil)
|
|
95
|
+
params = {
|
|
96
|
+
'End' => end_,
|
|
97
|
+
'Start' => start,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
payload = @version.fetch(
|
|
101
|
+
'GET',
|
|
102
|
+
@uri,
|
|
103
|
+
params,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
return UsageInstance.new(
|
|
107
|
+
@version,
|
|
108
|
+
payload,
|
|
109
|
+
device_sid: @solution['device_sid'],
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
##
|
|
114
|
+
# Provide a user friendly representation
|
|
115
|
+
def to_s
|
|
116
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
117
|
+
"#<Twilio.Preview.Wireless.UsageContext #{context}>"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
class UsageInstance < InstanceResource
|
|
122
|
+
##
|
|
123
|
+
# Initialize the UsageInstance
|
|
124
|
+
# @param [Version] version Version that contains the resource
|
|
125
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
126
|
+
# @param [String] device_sid The device_sid
|
|
127
|
+
|
|
128
|
+
# @return [UsageInstance] UsageInstance
|
|
129
|
+
def initialize(version, payload, device_sid: nil)
|
|
130
|
+
super(version)
|
|
131
|
+
|
|
132
|
+
# Marshaled Properties
|
|
133
|
+
@properties = {
|
|
134
|
+
'device_sid' => payload['device_sid'],
|
|
135
|
+
'device_alias' => payload['device_alias'],
|
|
136
|
+
'account_sid' => payload['account_sid'],
|
|
137
|
+
'period' => payload['period'],
|
|
138
|
+
'commands_usage' => payload['commands_usage'],
|
|
139
|
+
'commands_costs' => payload['commands_costs'],
|
|
140
|
+
'data_usage' => payload['data_usage'],
|
|
141
|
+
'data_costs' => payload['data_costs'],
|
|
142
|
+
'url' => payload['url'],
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
# Context
|
|
146
|
+
@instance_context = nil
|
|
147
|
+
@params = {
|
|
148
|
+
'device_sid' => device_sid,
|
|
149
|
+
}
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
##
|
|
153
|
+
# Generate an instance context for the instance, the context is capable of
|
|
154
|
+
# performing various actions. All instance actions are proxied to the context
|
|
155
|
+
# @param [Version] version Version that contains the resource
|
|
156
|
+
|
|
157
|
+
# @return [UsageContext] UsageContext for this UsageInstance
|
|
158
|
+
def context
|
|
159
|
+
unless @instance_context
|
|
160
|
+
@instance_context = UsageContext.new(
|
|
161
|
+
@version,
|
|
162
|
+
@params['device_sid'],
|
|
163
|
+
)
|
|
164
|
+
end
|
|
165
|
+
@instance_context
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def device_sid
|
|
169
|
+
@properties['device_sid']
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def device_alias
|
|
173
|
+
@properties['device_alias']
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def account_sid
|
|
177
|
+
@properties['account_sid']
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def period
|
|
181
|
+
@properties['period']
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def commands_usage
|
|
185
|
+
@properties['commands_usage']
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def commands_costs
|
|
189
|
+
@properties['commands_costs']
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def data_usage
|
|
193
|
+
@properties['data_usage']
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def data_costs
|
|
197
|
+
@properties['data_costs']
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def url
|
|
201
|
+
@properties['url']
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
##
|
|
205
|
+
# Fetch a UsageInstance
|
|
206
|
+
# @param [String] end_ The end
|
|
207
|
+
# @param [String] start The start
|
|
208
|
+
|
|
209
|
+
# @return [UsageInstance] Fetched UsageInstance
|
|
210
|
+
def fetch(end_: nil, start: nil)
|
|
211
|
+
@context.fetch(
|
|
212
|
+
start: start,
|
|
213
|
+
)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
##
|
|
217
|
+
# Provide a user friendly representation
|
|
218
|
+
def to_s
|
|
219
|
+
context = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
220
|
+
"<Twilio.Preview.Wireless.UsageInstance #{context}>"
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Preview < Domain
|
|
10
|
+
class Wireless < Version
|
|
11
|
+
class RatePlanList < ListResource
|
|
12
|
+
##
|
|
13
|
+
# Initialize the RatePlanList
|
|
14
|
+
# @param [Version] version Version that contains the resource
|
|
15
|
+
|
|
16
|
+
# @return [RatePlanList] RatePlanList
|
|
17
|
+
def initialize(version)
|
|
18
|
+
super(version)
|
|
19
|
+
|
|
20
|
+
# Path Solution
|
|
21
|
+
@solution = {}
|
|
22
|
+
@uri = "/RatePlans"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Lists RatePlanInstance records from the API as a list.
|
|
27
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
28
|
+
# memory before returning.
|
|
29
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
30
|
+
# guarantees to never return more than limit. Default is no limit
|
|
31
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
32
|
+
# the default value of 50 records. If no page_size is defined
|
|
33
|
+
# but a limit is defined, stream() will attempt to read the
|
|
34
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
35
|
+
|
|
36
|
+
# @return [Array] Array of up to limit results
|
|
37
|
+
def list(limit: nil, page_size: nil)
|
|
38
|
+
self.stream(
|
|
39
|
+
limit: limit,
|
|
40
|
+
page_size: page_size
|
|
41
|
+
).entries
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
# Streams RatePlanInstance records from the API as an Enumerable.
|
|
46
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
47
|
+
# is reached.
|
|
48
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
49
|
+
# guarantees to never return more than limit. Default is no limit
|
|
50
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
51
|
+
# the default value of 50 records. If no page_size is defined
|
|
52
|
+
# but a limit is defined, stream() will attempt to read the
|
|
53
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
54
|
+
|
|
55
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
56
|
+
def stream(limit: nil, page_size: nil)
|
|
57
|
+
limits = @version.read_limits(limit, page_size)
|
|
58
|
+
|
|
59
|
+
page = self.page(
|
|
60
|
+
page_size: limits['page_size'],
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
@version.stream(page, limit: limits['limit'], page_limit: limits['page_limit'])
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
##
|
|
67
|
+
# When passed a block, yields RatePlanInstance records from the API.
|
|
68
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
69
|
+
# is reached.
|
|
70
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
71
|
+
# guarantees to never return more than limit. Default is no limit
|
|
72
|
+
# @param [Integer] page_size Number of records to fetch per request, when not set will use
|
|
73
|
+
# the default value of 50 records. If no page_size is defined
|
|
74
|
+
# but a limit is defined, stream() will attempt to read the
|
|
75
|
+
# limit with the most efficient page size, i.e. min(limit, 1000)
|
|
76
|
+
def each
|
|
77
|
+
limits = @version.read_limits
|
|
78
|
+
|
|
79
|
+
page = self.page(
|
|
80
|
+
page_size: limits['page_size'],
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
@version.stream(page,
|
|
84
|
+
limit: limits['limit'],
|
|
85
|
+
page_limit: limits['page_limit']).each {|x| yield x}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
##
|
|
89
|
+
# Retrieve a single page of RatePlanInstance records from the API.
|
|
90
|
+
# Request is executed immediately.
|
|
91
|
+
# @param [String] page_token PageToken provided by the API
|
|
92
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
93
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
94
|
+
|
|
95
|
+
# @return [Page] Page of RatePlanInstance
|
|
96
|
+
def page(page_token: nil, page_number: nil, page_size: nil)
|
|
97
|
+
params = {
|
|
98
|
+
'PageToken' => page_token,
|
|
99
|
+
'Page' => page_number,
|
|
100
|
+
'PageSize' => page_size,
|
|
101
|
+
}
|
|
102
|
+
response = @version.page(
|
|
103
|
+
'GET',
|
|
104
|
+
@uri,
|
|
105
|
+
params
|
|
106
|
+
)
|
|
107
|
+
return RatePlanPage.new(@version, response, @solution)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
##
|
|
111
|
+
# Provide a user friendly representation
|
|
112
|
+
def to_s
|
|
113
|
+
'#<Twilio.Preview.Wireless.RatePlanList>'
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
class RatePlanPage < Page
|
|
118
|
+
##
|
|
119
|
+
# Initialize the RatePlanPage
|
|
120
|
+
# @param [Version] version Version that contains the resource
|
|
121
|
+
# @param [Response] response Response from the API
|
|
122
|
+
# @param [Hash] solution Path solution for the resource
|
|
123
|
+
|
|
124
|
+
# @return [RatePlanPage] RatePlanPage
|
|
125
|
+
def initialize(version, response, solution)
|
|
126
|
+
super(version, response)
|
|
127
|
+
|
|
128
|
+
# Path Solution
|
|
129
|
+
@solution = solution
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
##
|
|
133
|
+
# Build an instance of RatePlanInstance
|
|
134
|
+
# @param [Hash] payload Payload response from the API
|
|
135
|
+
|
|
136
|
+
# @return [RatePlanInstance] RatePlanInstance
|
|
137
|
+
def get_instance(payload)
|
|
138
|
+
return RatePlanInstance.new(
|
|
139
|
+
@version,
|
|
140
|
+
payload,
|
|
141
|
+
)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
##
|
|
145
|
+
# Provide a user friendly representation
|
|
146
|
+
def to_s
|
|
147
|
+
'<Twilio.Preview.Wireless.RatePlanPage>'
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
class RatePlanContext < InstanceContext
|
|
152
|
+
##
|
|
153
|
+
# Initialize the RatePlanContext
|
|
154
|
+
# @param [Version] version Version that contains the resource
|
|
155
|
+
# @param [String] sid The sid
|
|
156
|
+
|
|
157
|
+
# @return [RatePlanContext] RatePlanContext
|
|
158
|
+
def initialize(version, sid)
|
|
159
|
+
super(version)
|
|
160
|
+
|
|
161
|
+
# Path Solution
|
|
162
|
+
@solution = {
|
|
163
|
+
sid: sid,
|
|
164
|
+
}
|
|
165
|
+
@uri = "/RatePlans/#{@solution[:sid]}"
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
##
|
|
169
|
+
# Fetch a RatePlanInstance
|
|
170
|
+
# @return [RatePlanInstance] Fetched RatePlanInstance
|
|
171
|
+
def fetch
|
|
172
|
+
params = {}
|
|
173
|
+
|
|
174
|
+
payload = @version.fetch(
|
|
175
|
+
'GET',
|
|
176
|
+
@uri,
|
|
177
|
+
params,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
return RatePlanInstance.new(
|
|
181
|
+
@version,
|
|
182
|
+
payload,
|
|
183
|
+
sid: @solution['sid'],
|
|
184
|
+
)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
##
|
|
188
|
+
# Provide a user friendly representation
|
|
189
|
+
def to_s
|
|
190
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
191
|
+
"#<Twilio.Preview.Wireless.RatePlanContext #{context}>"
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
class RatePlanInstance < InstanceResource
|
|
196
|
+
##
|
|
197
|
+
# Initialize the RatePlanInstance
|
|
198
|
+
# @param [Version] version Version that contains the resource
|
|
199
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
200
|
+
# @param [String] sid The sid
|
|
201
|
+
|
|
202
|
+
# @return [RatePlanInstance] RatePlanInstance
|
|
203
|
+
def initialize(version, payload, sid: nil)
|
|
204
|
+
super(version)
|
|
205
|
+
|
|
206
|
+
# Marshaled Properties
|
|
207
|
+
@properties = {
|
|
208
|
+
'sid' => payload['sid'],
|
|
209
|
+
'alias_' => payload['alias'],
|
|
210
|
+
'account_sid' => payload['account_sid'],
|
|
211
|
+
'friendly_name' => payload['friendly_name'],
|
|
212
|
+
'data_metering' => payload['data_metering'],
|
|
213
|
+
'capabilities' => payload['capabilities'],
|
|
214
|
+
'voice_cap' => payload['voice_cap'].to_i,
|
|
215
|
+
'messaging_cap' => payload['messaging_cap'].to_i,
|
|
216
|
+
'commands_cap' => payload['commands_cap'].to_i,
|
|
217
|
+
'data_cap' => payload['data_cap'].to_i,
|
|
218
|
+
'cap_period' => payload['cap_period'].to_i,
|
|
219
|
+
'cap_unit' => payload['cap_unit'],
|
|
220
|
+
'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
|
|
221
|
+
'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
|
|
222
|
+
'url' => payload['url'],
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
# Context
|
|
226
|
+
@instance_context = nil
|
|
227
|
+
@params = {
|
|
228
|
+
'sid' => sid || @properties['sid'],
|
|
229
|
+
}
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
##
|
|
233
|
+
# Generate an instance context for the instance, the context is capable of
|
|
234
|
+
# performing various actions. All instance actions are proxied to the context
|
|
235
|
+
# @param [Version] version Version that contains the resource
|
|
236
|
+
|
|
237
|
+
# @return [RatePlanContext] RatePlanContext for this RatePlanInstance
|
|
238
|
+
def context
|
|
239
|
+
unless @instance_context
|
|
240
|
+
@instance_context = RatePlanContext.new(
|
|
241
|
+
@version,
|
|
242
|
+
@params['sid'],
|
|
243
|
+
)
|
|
244
|
+
end
|
|
245
|
+
@instance_context
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def sid
|
|
249
|
+
@properties['sid']
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def alias_
|
|
253
|
+
@properties['alias_']
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def account_sid
|
|
257
|
+
@properties['account_sid']
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def friendly_name
|
|
261
|
+
@properties['friendly_name']
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def data_metering
|
|
265
|
+
@properties['data_metering']
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def capabilities
|
|
269
|
+
@properties['capabilities']
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def voice_cap
|
|
273
|
+
@properties['voice_cap']
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def messaging_cap
|
|
277
|
+
@properties['messaging_cap']
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def commands_cap
|
|
281
|
+
@properties['commands_cap']
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def data_cap
|
|
285
|
+
@properties['data_cap']
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def cap_period
|
|
289
|
+
@properties['cap_period']
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def cap_unit
|
|
293
|
+
@properties['cap_unit']
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def date_created
|
|
297
|
+
@properties['date_created']
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def date_updated
|
|
301
|
+
@properties['date_updated']
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
def url
|
|
305
|
+
@properties['url']
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
##
|
|
309
|
+
# Fetch a RatePlanInstance
|
|
310
|
+
# @return [RatePlanInstance] Fetched RatePlanInstance
|
|
311
|
+
def fetch
|
|
312
|
+
@context.fetch()
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
##
|
|
316
|
+
# Provide a user friendly representation
|
|
317
|
+
def to_s
|
|
318
|
+
context = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
319
|
+
"<Twilio.Preview.Wireless.RatePlanInstance #{context}>"
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|