bandwidth-sdk 15.1.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -11
- data/README.md +17 -10
- data/bandwidth.yml +523 -184
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +321 -366
- data/coverage/index.html +10047 -10501
- data/custom_templates/README.mustache +1 -1
- data/docs/BlockedWebhook.md +2 -2
- data/docs/Callback.md +84 -0
- data/docs/CreateMultiChannelMessageResponse.md +3 -3
- data/docs/ErrorObject.md +6 -4
- data/docs/ErrorSource.md +24 -0
- data/docs/FailureWebhook.md +2 -2
- data/docs/InboundCallback.md +28 -0
- data/docs/InboundCallbackMessage.md +48 -0
- data/docs/{MultiChannelStatusEnum.md → InboundCallbackTypeEnum.md} +2 -2
- data/docs/ListMessageItem.md +1 -1
- data/docs/Message.md +5 -5
- data/docs/MessageRequest.md +1 -1
- data/docs/MmsMessageContent.md +2 -2
- data/docs/MmsMessageContentFile.md +18 -0
- data/docs/MultiChannelActionCalendarEvent.md +2 -2
- data/docs/MultiChannelError.md +22 -0
- data/docs/MultiChannelMessageContent.md +20 -0
- data/docs/MultiChannelMessageResponseData.md +32 -0
- data/docs/MultiChannelMessageResponseDataChannelListInner.md +26 -0
- data/docs/RbmActionBase.md +2 -2
- data/docs/RbmActionDial.md +2 -2
- data/docs/RbmActionOpenUrl.md +2 -2
- data/docs/RbmActionViewLocation.md +2 -2
- data/docs/RbmLocationResponse.md +20 -0
- data/docs/RbmSuggestionResponse.md +20 -0
- data/docs/StatusCallback.md +32 -0
- data/docs/StatusCallbackMessage.md +42 -0
- data/docs/{CallbackTypeEnum.md → StatusCallbackTypeEnum.md} +2 -2
- data/docs/TfvStatus.md +2 -2
- data/docs/TfvSubmissionInfo.md +3 -3
- data/docs/TollFreeVerificationApi.md +72 -0
- data/docs/VerificationDenialWebhook.md +2 -2
- data/docs/VerificationRequest.md +3 -3
- data/docs/VerificationUpdateRequest.md +3 -3
- data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +82 -0
- data/lib/bandwidth-sdk/configuration.rb +6 -0
- data/lib/bandwidth-sdk/models/blocked_webhook.rb +2 -2
- data/lib/bandwidth-sdk/models/callback.rb +60 -0
- data/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +1 -1
- data/lib/bandwidth-sdk/models/error_object.rb +45 -13
- data/lib/bandwidth-sdk/models/error_source.rb +244 -0
- data/lib/bandwidth-sdk/models/failure_webhook.rb +7 -7
- data/lib/bandwidth-sdk/models/{message_callback.rb → inbound_callback.rb} +9 -20
- data/lib/bandwidth-sdk/models/inbound_callback_message.rb +454 -0
- data/lib/bandwidth-sdk/models/{multi_channel_message_direction_enum.rb → inbound_callback_type_enum.rb} +7 -6
- data/lib/bandwidth-sdk/models/list_message_item.rb +1 -1
- data/lib/bandwidth-sdk/models/message.rb +3 -3
- data/lib/bandwidth-sdk/models/message_request.rb +1 -1
- data/lib/bandwidth-sdk/models/mms_message_content.rb +1 -2
- data/lib/bandwidth-sdk/models/{multi_channel_message_callback_data.rb → mms_message_content_file.rb} +37 -100
- data/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +21 -21
- data/lib/bandwidth-sdk/models/multi_channel_error.rb +235 -0
- data/lib/bandwidth-sdk/models/{deferred_result.rb → multi_channel_message_content.rb} +17 -16
- data/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +372 -0
- data/lib/bandwidth-sdk/models/{multi_channel_message_data.rb → multi_channel_message_response_data_channel_list_inner.rb} +62 -59
- data/lib/bandwidth-sdk/models/rbm_action_base.rb +21 -21
- data/lib/bandwidth-sdk/models/rbm_action_dial.rb +21 -21
- data/lib/bandwidth-sdk/models/rbm_action_open_url.rb +21 -21
- data/lib/bandwidth-sdk/models/rbm_action_view_location.rb +21 -21
- data/lib/bandwidth-sdk/models/{tag.rb → rbm_location_response.rb} +18 -16
- data/lib/bandwidth-sdk/models/{multi_channel_callback_data.rb → rbm_suggestion_response.rb} +37 -67
- data/lib/bandwidth-sdk/models/status_callback.rb +338 -0
- data/lib/bandwidth-sdk/models/{message_callback_message.rb → status_callback_message.rb} +25 -17
- data/lib/bandwidth-sdk/models/{callback_type_enum.rb → status_callback_type_enum.rb} +5 -5
- data/lib/bandwidth-sdk/models/tfv_status.rb +2 -2
- data/lib/bandwidth-sdk/models/tfv_submission_info.rb +3 -3
- data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +2 -2
- data/lib/bandwidth-sdk/models/verification_request.rb +3 -3
- data/lib/bandwidth-sdk/models/verification_update_request.rb +3 -3
- data/lib/bandwidth-sdk/version.rb +1 -1
- data/lib/bandwidth-sdk.rb +15 -9
- data/spec/smoke/multi_channel_api_spec.rb +18 -20
- data/spec/smoke/toll_free_verification_api_spec.rb +7 -0
- data/spec/unit/api/toll_free_verification_api_spec.rb +8 -0
- data/spec/unit/client/api_client_spec.rb +4 -4
- data/spec/unit/models/tfv_error_spec.rb +78 -0
- data/spec/unit/models/verify_code_response_spec.rb +70 -0
- metadata +112 -100
- data/docs/DeferredResult.md +0 -20
- data/docs/MessageCallback.md +0 -30
- data/docs/MessageCallbackMessage.md +0 -40
- data/docs/MultiChannelCallbackData.md +0 -26
- data/docs/MultiChannelMessageCallbackData.md +0 -32
- data/docs/MultiChannelMessageData.md +0 -34
- data/docs/MultiChannelMessageDirectionEnum.md +0 -15
- data/docs/Tag.md +0 -20
- data/lib/bandwidth-sdk/models/multi_channel_status_enum.rb +0 -42
- data/spec/unit/models/deferred_result_spec.rb +0 -74
- /data/coverage/assets/{0.13.1 → 0.13.2}/DataTables-1.10.20/images/sort_asc.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/DataTables-1.10.20/images/sort_both.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/DataTables-1.10.20/images/sort_desc.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/application.css +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/application.js +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/colorbox/border.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/colorbox/controls.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/colorbox/loading.gif +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/colorbox/loading_background.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/favicon_green.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/favicon_red.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/favicon_yellow.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-icons_222222_256x240.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-icons_2e83ff_256x240.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-icons_454545_256x240.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-icons_888888_256x240.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/images/ui-icons_cd0a0a_256x240.png +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/loading.gif +0 -0
- /data/coverage/assets/{0.13.1 → 0.13.2}/magnify.png +0 -0
@@ -0,0 +1,454 @@
|
|
1
|
+
=begin
|
2
|
+
#Bandwidth
|
3
|
+
|
4
|
+
#Bandwidth's Communication APIs
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: letstalk@bandwidth.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.8.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Bandwidth
|
17
|
+
class InboundCallbackMessage
|
18
|
+
# A unique identifier of the message.
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# The Bandwidth phone number or alphanumeric identifier associated with the message.
|
22
|
+
attr_accessor :owner
|
23
|
+
|
24
|
+
# The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
|
25
|
+
attr_accessor :application_id
|
26
|
+
|
27
|
+
attr_accessor :time
|
28
|
+
|
29
|
+
# The number of segments the user's message is broken into before sending over carrier networks.
|
30
|
+
attr_accessor :segment_count
|
31
|
+
|
32
|
+
attr_accessor :direction
|
33
|
+
|
34
|
+
# The phone number recipients of the message.
|
35
|
+
attr_accessor :to
|
36
|
+
|
37
|
+
# The Bandwidth phone number or alphanumeric identifier the message was sent from.
|
38
|
+
attr_accessor :from
|
39
|
+
|
40
|
+
attr_accessor :text
|
41
|
+
|
42
|
+
# A custom string that will be included in callback events of the message. Max 1024 characters.
|
43
|
+
attr_accessor :tag
|
44
|
+
|
45
|
+
# Optional media, not applicable for sms
|
46
|
+
attr_accessor :media
|
47
|
+
|
48
|
+
attr_accessor :priority
|
49
|
+
|
50
|
+
attr_accessor :channel
|
51
|
+
|
52
|
+
attr_accessor :content
|
53
|
+
|
54
|
+
attr_accessor :suggestion_response
|
55
|
+
|
56
|
+
attr_accessor :location_response
|
57
|
+
|
58
|
+
class EnumAttributeValidator
|
59
|
+
attr_reader :datatype
|
60
|
+
attr_reader :allowable_values
|
61
|
+
|
62
|
+
def initialize(datatype, allowable_values)
|
63
|
+
@allowable_values = allowable_values.map do |value|
|
64
|
+
case datatype.to_s
|
65
|
+
when /Integer/i
|
66
|
+
value.to_i
|
67
|
+
when /Float/i
|
68
|
+
value.to_f
|
69
|
+
else
|
70
|
+
value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def valid?(value)
|
76
|
+
!value || allowable_values.include?(value)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
81
|
+
def self.attribute_map
|
82
|
+
{
|
83
|
+
:'id' => :'id',
|
84
|
+
:'owner' => :'owner',
|
85
|
+
:'application_id' => :'applicationId',
|
86
|
+
:'time' => :'time',
|
87
|
+
:'segment_count' => :'segmentCount',
|
88
|
+
:'direction' => :'direction',
|
89
|
+
:'to' => :'to',
|
90
|
+
:'from' => :'from',
|
91
|
+
:'text' => :'text',
|
92
|
+
:'tag' => :'tag',
|
93
|
+
:'media' => :'media',
|
94
|
+
:'priority' => :'priority',
|
95
|
+
:'channel' => :'channel',
|
96
|
+
:'content' => :'content',
|
97
|
+
:'suggestion_response' => :'suggestionResponse',
|
98
|
+
:'location_response' => :'locationResponse'
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns all the JSON keys this model knows about
|
103
|
+
def self.acceptable_attributes
|
104
|
+
attribute_map.values
|
105
|
+
end
|
106
|
+
|
107
|
+
# Attribute type mapping.
|
108
|
+
def self.openapi_types
|
109
|
+
{
|
110
|
+
:'id' => :'String',
|
111
|
+
:'owner' => :'String',
|
112
|
+
:'application_id' => :'String',
|
113
|
+
:'time' => :'Time',
|
114
|
+
:'segment_count' => :'Integer',
|
115
|
+
:'direction' => :'MessageDirectionEnum',
|
116
|
+
:'to' => :'Array<String>',
|
117
|
+
:'from' => :'String',
|
118
|
+
:'text' => :'String',
|
119
|
+
:'tag' => :'String',
|
120
|
+
:'media' => :'Array<String>',
|
121
|
+
:'priority' => :'PriorityEnum',
|
122
|
+
:'channel' => :'MultiChannelMessageChannelEnum',
|
123
|
+
:'content' => :'MultiChannelMessageContent',
|
124
|
+
:'suggestion_response' => :'RbmSuggestionResponse',
|
125
|
+
:'location_response' => :'RbmLocationResponse'
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
# List of attributes with nullable: true
|
130
|
+
def self.openapi_nullable
|
131
|
+
Set.new([
|
132
|
+
])
|
133
|
+
end
|
134
|
+
|
135
|
+
# List of class defined in allOf (OpenAPI v3)
|
136
|
+
def self.openapi_all_of
|
137
|
+
[
|
138
|
+
:'StatusCallbackMessage'
|
139
|
+
]
|
140
|
+
end
|
141
|
+
|
142
|
+
# Initializes the object
|
143
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
144
|
+
def initialize(attributes = {})
|
145
|
+
if (!attributes.is_a?(Hash))
|
146
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::InboundCallbackMessage` initialize method'
|
147
|
+
end
|
148
|
+
|
149
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
150
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
151
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
152
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InboundCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
153
|
+
end
|
154
|
+
h[k.to_sym] = v
|
155
|
+
}
|
156
|
+
|
157
|
+
if attributes.key?(:'id')
|
158
|
+
self.id = attributes[:'id']
|
159
|
+
else
|
160
|
+
self.id = nil
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'owner')
|
164
|
+
self.owner = attributes[:'owner']
|
165
|
+
else
|
166
|
+
self.owner = nil
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.key?(:'application_id')
|
170
|
+
self.application_id = attributes[:'application_id']
|
171
|
+
else
|
172
|
+
self.application_id = nil
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'time')
|
176
|
+
self.time = attributes[:'time']
|
177
|
+
else
|
178
|
+
self.time = nil
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.key?(:'segment_count')
|
182
|
+
self.segment_count = attributes[:'segment_count']
|
183
|
+
else
|
184
|
+
self.segment_count = nil
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.key?(:'direction')
|
188
|
+
self.direction = attributes[:'direction']
|
189
|
+
else
|
190
|
+
self.direction = nil
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.key?(:'to')
|
194
|
+
if (value = attributes[:'to']).is_a?(Array)
|
195
|
+
self.to = value
|
196
|
+
end
|
197
|
+
else
|
198
|
+
self.to = nil
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.key?(:'from')
|
202
|
+
self.from = attributes[:'from']
|
203
|
+
else
|
204
|
+
self.from = nil
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.key?(:'text')
|
208
|
+
self.text = attributes[:'text']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.key?(:'tag')
|
212
|
+
self.tag = attributes[:'tag']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.key?(:'media')
|
216
|
+
if (value = attributes[:'media']).is_a?(Array)
|
217
|
+
self.media = value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.key?(:'priority')
|
222
|
+
self.priority = attributes[:'priority']
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.key?(:'channel')
|
226
|
+
self.channel = attributes[:'channel']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.key?(:'content')
|
230
|
+
self.content = attributes[:'content']
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.key?(:'suggestion_response')
|
234
|
+
self.suggestion_response = attributes[:'suggestion_response']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.key?(:'location_response')
|
238
|
+
self.location_response = attributes[:'location_response']
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
243
|
+
# @return Array for valid properties with the reasons
|
244
|
+
def list_invalid_properties
|
245
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
246
|
+
invalid_properties = Array.new
|
247
|
+
if @id.nil?
|
248
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
249
|
+
end
|
250
|
+
|
251
|
+
if @owner.nil?
|
252
|
+
invalid_properties.push('invalid value for "owner", owner cannot be nil.')
|
253
|
+
end
|
254
|
+
|
255
|
+
if @application_id.nil?
|
256
|
+
invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
|
257
|
+
end
|
258
|
+
|
259
|
+
if @time.nil?
|
260
|
+
invalid_properties.push('invalid value for "time", time cannot be nil.')
|
261
|
+
end
|
262
|
+
|
263
|
+
if @segment_count.nil?
|
264
|
+
invalid_properties.push('invalid value for "segment_count", segment_count cannot be nil.')
|
265
|
+
end
|
266
|
+
|
267
|
+
if @direction.nil?
|
268
|
+
invalid_properties.push('invalid value for "direction", direction cannot be nil.')
|
269
|
+
end
|
270
|
+
|
271
|
+
if @to.nil?
|
272
|
+
invalid_properties.push('invalid value for "to", to cannot be nil.')
|
273
|
+
end
|
274
|
+
|
275
|
+
if @from.nil?
|
276
|
+
invalid_properties.push('invalid value for "from", from cannot be nil.')
|
277
|
+
end
|
278
|
+
|
279
|
+
invalid_properties
|
280
|
+
end
|
281
|
+
|
282
|
+
# Check to see if the all the properties in the model are valid
|
283
|
+
# @return true if the model is valid
|
284
|
+
def valid?
|
285
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
286
|
+
return false if @id.nil?
|
287
|
+
return false if @owner.nil?
|
288
|
+
return false if @application_id.nil?
|
289
|
+
return false if @time.nil?
|
290
|
+
return false if @segment_count.nil?
|
291
|
+
return false if @direction.nil?
|
292
|
+
return false if @to.nil?
|
293
|
+
return false if @from.nil?
|
294
|
+
true
|
295
|
+
end
|
296
|
+
|
297
|
+
# Custom attribute writer method with validation
|
298
|
+
# @param [Object] to Value to be assigned
|
299
|
+
def to=(to)
|
300
|
+
if to.nil?
|
301
|
+
fail ArgumentError, 'to cannot be nil'
|
302
|
+
end
|
303
|
+
|
304
|
+
@to = to
|
305
|
+
end
|
306
|
+
|
307
|
+
# Checks equality by comparing each attribute.
|
308
|
+
# @param [Object] Object to be compared
|
309
|
+
def ==(o)
|
310
|
+
return true if self.equal?(o)
|
311
|
+
self.class == o.class &&
|
312
|
+
id == o.id &&
|
313
|
+
owner == o.owner &&
|
314
|
+
application_id == o.application_id &&
|
315
|
+
time == o.time &&
|
316
|
+
segment_count == o.segment_count &&
|
317
|
+
direction == o.direction &&
|
318
|
+
to == o.to &&
|
319
|
+
from == o.from &&
|
320
|
+
text == o.text &&
|
321
|
+
tag == o.tag &&
|
322
|
+
media == o.media &&
|
323
|
+
priority == o.priority &&
|
324
|
+
channel == o.channel &&
|
325
|
+
content == o.content &&
|
326
|
+
suggestion_response == o.suggestion_response &&
|
327
|
+
location_response == o.location_response
|
328
|
+
end
|
329
|
+
|
330
|
+
# @see the `==` method
|
331
|
+
# @param [Object] Object to be compared
|
332
|
+
def eql?(o)
|
333
|
+
self == o
|
334
|
+
end
|
335
|
+
|
336
|
+
# Calculates hash code according to all attributes.
|
337
|
+
# @return [Integer] Hash code
|
338
|
+
def hash
|
339
|
+
[id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel, content, suggestion_response, location_response].hash
|
340
|
+
end
|
341
|
+
|
342
|
+
# Builds the object from hash
|
343
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
344
|
+
# @return [Object] Returns the model itself
|
345
|
+
def self.build_from_hash(attributes)
|
346
|
+
return nil unless attributes.is_a?(Hash)
|
347
|
+
attributes = attributes.transform_keys(&:to_sym)
|
348
|
+
transformed_hash = {}
|
349
|
+
openapi_types.each_pair do |key, type|
|
350
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
351
|
+
transformed_hash["#{key}"] = nil
|
352
|
+
elsif type =~ /\AArray<(.*)>/i
|
353
|
+
# check to ensure the input is an array given that the attribute
|
354
|
+
# is documented as an array but the input is not
|
355
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
356
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
357
|
+
end
|
358
|
+
elsif !attributes[attribute_map[key]].nil?
|
359
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
360
|
+
end
|
361
|
+
end
|
362
|
+
new(transformed_hash)
|
363
|
+
end
|
364
|
+
|
365
|
+
# Deserializes the data based on type
|
366
|
+
# @param string type Data type
|
367
|
+
# @param string value Value to be deserialized
|
368
|
+
# @return [Object] Deserialized data
|
369
|
+
def self._deserialize(type, value)
|
370
|
+
case type.to_sym
|
371
|
+
when :Time
|
372
|
+
Time.parse(value)
|
373
|
+
when :Date
|
374
|
+
Date.parse(value)
|
375
|
+
when :String
|
376
|
+
value.to_s
|
377
|
+
when :Integer
|
378
|
+
value.to_i
|
379
|
+
when :Float
|
380
|
+
value.to_f
|
381
|
+
when :Boolean
|
382
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
383
|
+
true
|
384
|
+
else
|
385
|
+
false
|
386
|
+
end
|
387
|
+
when :Object
|
388
|
+
# generic object (usually a Hash), return directly
|
389
|
+
value
|
390
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
391
|
+
inner_type = Regexp.last_match[:inner_type]
|
392
|
+
value.map { |v| _deserialize(inner_type, v) }
|
393
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
394
|
+
k_type = Regexp.last_match[:k_type]
|
395
|
+
v_type = Regexp.last_match[:v_type]
|
396
|
+
{}.tap do |hash|
|
397
|
+
value.each do |k, v|
|
398
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
399
|
+
end
|
400
|
+
end
|
401
|
+
else # model
|
402
|
+
# models (e.g. Pet) or oneOf
|
403
|
+
klass = Bandwidth.const_get(type)
|
404
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
# Returns the string representation of the object
|
409
|
+
# @return [String] String presentation of the object
|
410
|
+
def to_s
|
411
|
+
to_hash.to_s
|
412
|
+
end
|
413
|
+
|
414
|
+
# to_body is an alias to to_hash (backward compatibility)
|
415
|
+
# @return [Hash] Returns the object in the form of hash
|
416
|
+
def to_body
|
417
|
+
to_hash
|
418
|
+
end
|
419
|
+
|
420
|
+
# Returns the object in the form of hash
|
421
|
+
# @return [Hash] Returns the object in the form of hash
|
422
|
+
def to_hash
|
423
|
+
hash = {}
|
424
|
+
self.class.attribute_map.each_pair do |attr, param|
|
425
|
+
value = self.send(attr)
|
426
|
+
if value.nil?
|
427
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
428
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
429
|
+
end
|
430
|
+
|
431
|
+
hash[param] = _to_hash(value)
|
432
|
+
end
|
433
|
+
hash
|
434
|
+
end
|
435
|
+
|
436
|
+
# Outputs non-array value in the form of hash
|
437
|
+
# For object, use to_hash. Otherwise, just return the value
|
438
|
+
# @param [Object] value Any valid value
|
439
|
+
# @return [Hash] Returns the value in the form of hash
|
440
|
+
def _to_hash(value)
|
441
|
+
if value.is_a?(Array)
|
442
|
+
value.compact.map { |v| _to_hash(v) }
|
443
|
+
elsif value.is_a?(Hash)
|
444
|
+
{}.tap do |hash|
|
445
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
446
|
+
end
|
447
|
+
elsif value.respond_to? :to_hash
|
448
|
+
value.to_hash
|
449
|
+
else
|
450
|
+
value
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|
@@ -14,12 +14,13 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Bandwidth
|
17
|
-
class
|
18
|
-
|
19
|
-
|
17
|
+
class InboundCallbackTypeEnum
|
18
|
+
MESSAGE_RECEIVED = 'message-received'.freeze
|
19
|
+
REQUEST_LOCATION_RESPONSE = 'request-location-response'.freeze
|
20
|
+
SUGGESTION_RESPONSE = 'suggestion-response'.freeze
|
20
21
|
|
21
22
|
def self.all_vars
|
22
|
-
@all_vars ||= [
|
23
|
+
@all_vars ||= [MESSAGE_RECEIVED, REQUEST_LOCATION_RESPONSE, SUGGESTION_RESPONSE].freeze
|
23
24
|
end
|
24
25
|
|
25
26
|
# Builds the enum from string
|
@@ -33,8 +34,8 @@ module Bandwidth
|
|
33
34
|
# @param [String] The enum value in the form of the string
|
34
35
|
# @return [String] The enum value
|
35
36
|
def build_from_hash(value)
|
36
|
-
return value if
|
37
|
-
raise "Invalid ENUM value #{value} for class #
|
37
|
+
return value if InboundCallbackTypeEnum.all_vars.include?(value)
|
38
|
+
raise "Invalid ENUM value #{value} for class #InboundCallbackTypeEnum"
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
@@ -33,7 +33,7 @@ module Bandwidth
|
|
33
33
|
|
34
34
|
attr_accessor :message_type
|
35
35
|
|
36
|
-
# The number of segments the message
|
36
|
+
# The number of segments the user's message is broken into before sending over carrier networks.
|
37
37
|
attr_accessor :segment_count
|
38
38
|
|
39
39
|
# The numeric error code of the message.
|
@@ -21,13 +21,13 @@ module Bandwidth
|
|
21
21
|
# The Bandwidth phone number associated with the message.
|
22
22
|
attr_accessor :owner
|
23
23
|
|
24
|
-
# The
|
24
|
+
# The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
|
25
25
|
attr_accessor :application_id
|
26
26
|
|
27
27
|
# The datetime stamp of the message in ISO 8601
|
28
28
|
attr_accessor :time
|
29
29
|
|
30
|
-
# The number of segments the
|
30
|
+
# The number of segments the user's message is broken into before sending over carrier networks.
|
31
31
|
attr_accessor :segment_count
|
32
32
|
|
33
33
|
attr_accessor :direction
|
@@ -44,7 +44,7 @@ module Bandwidth
|
|
44
44
|
# The contents of the message.
|
45
45
|
attr_accessor :text
|
46
46
|
|
47
|
-
#
|
47
|
+
# A custom string that will be included in callback events of the message. Max 1024 characters.
|
48
48
|
attr_accessor :tag
|
49
49
|
|
50
50
|
attr_accessor :priority
|
@@ -15,7 +15,7 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Bandwidth
|
17
17
|
class MessageRequest
|
18
|
-
# The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard.
|
18
|
+
# The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
|
19
19
|
attr_accessor :application_id
|
20
20
|
|
21
21
|
# The phone number(s) the message should be sent to in E164 format.
|
@@ -18,7 +18,6 @@ module Bandwidth
|
|
18
18
|
# The contents of the text message. Must be 2048 characters or less.
|
19
19
|
attr_accessor :text
|
20
20
|
|
21
|
-
# A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters.
|
22
21
|
attr_accessor :media
|
23
22
|
|
24
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -38,7 +37,7 @@ module Bandwidth
|
|
38
37
|
def self.openapi_types
|
39
38
|
{
|
40
39
|
:'text' => :'String',
|
41
|
-
:'media' => :'Array<
|
40
|
+
:'media' => :'Array<MmsMessageContentFile>'
|
42
41
|
}
|
43
42
|
end
|
44
43
|
|