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
data/lib/bandwidth-sdk/models/{multi_channel_message_callback_data.rb → mms_message_content_file.rb}
RENAMED
@@ -14,61 +14,14 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Bandwidth
|
17
|
-
class
|
18
|
-
# The
|
19
|
-
attr_accessor :
|
20
|
-
|
21
|
-
attr_accessor :status
|
22
|
-
|
23
|
-
attr_accessor :direction
|
24
|
-
|
25
|
-
# The sender ID of the message. This could be an alphanumeric sender ID.
|
26
|
-
attr_accessor :from
|
27
|
-
|
28
|
-
# The phone number the message should be sent to in E164 format.
|
29
|
-
attr_accessor :to
|
30
|
-
|
31
|
-
# The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
|
32
|
-
attr_accessor :application_id
|
33
|
-
|
34
|
-
attr_accessor :channel
|
35
|
-
|
36
|
-
# A custom string that will be included in callback events of the message. Max 1024 characters.
|
37
|
-
attr_accessor :tag
|
38
|
-
|
39
|
-
class EnumAttributeValidator
|
40
|
-
attr_reader :datatype
|
41
|
-
attr_reader :allowable_values
|
42
|
-
|
43
|
-
def initialize(datatype, allowable_values)
|
44
|
-
@allowable_values = allowable_values.map do |value|
|
45
|
-
case datatype.to_s
|
46
|
-
when /Integer/i
|
47
|
-
value.to_i
|
48
|
-
when /Float/i
|
49
|
-
value.to_f
|
50
|
-
else
|
51
|
-
value
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def valid?(value)
|
57
|
-
!value || allowable_values.include?(value)
|
58
|
-
end
|
59
|
-
end
|
17
|
+
class MmsMessageContentFile
|
18
|
+
# The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details.
|
19
|
+
attr_accessor :file_url
|
60
20
|
|
61
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
62
22
|
def self.attribute_map
|
63
23
|
{
|
64
|
-
:'
|
65
|
-
:'status' => :'status',
|
66
|
-
:'direction' => :'direction',
|
67
|
-
:'from' => :'from',
|
68
|
-
:'to' => :'to',
|
69
|
-
:'application_id' => :'applicationId',
|
70
|
-
:'channel' => :'channel',
|
71
|
-
:'tag' => :'tag'
|
24
|
+
:'file_url' => :'fileUrl'
|
72
25
|
}
|
73
26
|
end
|
74
27
|
|
@@ -80,14 +33,7 @@ module Bandwidth
|
|
80
33
|
# Attribute type mapping.
|
81
34
|
def self.openapi_types
|
82
35
|
{
|
83
|
-
:'
|
84
|
-
:'status' => :'MultiChannelStatusEnum',
|
85
|
-
:'direction' => :'MultiChannelMessageDirectionEnum',
|
86
|
-
:'from' => :'String',
|
87
|
-
:'to' => :'String',
|
88
|
-
:'application_id' => :'String',
|
89
|
-
:'channel' => :'MultiChannelMessageChannelEnum',
|
90
|
-
:'tag' => :'String'
|
36
|
+
:'file_url' => :'String'
|
91
37
|
}
|
92
38
|
end
|
93
39
|
|
@@ -101,47 +47,21 @@ module Bandwidth
|
|
101
47
|
# @param [Hash] attributes Model attributes in the form of hash
|
102
48
|
def initialize(attributes = {})
|
103
49
|
if (!attributes.is_a?(Hash))
|
104
|
-
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::
|
50
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MmsMessageContentFile` initialize method'
|
105
51
|
end
|
106
52
|
|
107
53
|
# check to see if the attribute exists and convert string to symbol for hash key
|
108
54
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
109
55
|
if (!self.class.attribute_map.key?(k.to_sym))
|
110
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MmsMessageContentFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
111
57
|
end
|
112
58
|
h[k.to_sym] = v
|
113
59
|
}
|
114
60
|
|
115
|
-
if attributes.key?(:'
|
116
|
-
self.
|
117
|
-
|
118
|
-
|
119
|
-
if attributes.key?(:'status')
|
120
|
-
self.status = attributes[:'status']
|
121
|
-
end
|
122
|
-
|
123
|
-
if attributes.key?(:'direction')
|
124
|
-
self.direction = attributes[:'direction']
|
125
|
-
end
|
126
|
-
|
127
|
-
if attributes.key?(:'from')
|
128
|
-
self.from = attributes[:'from']
|
129
|
-
end
|
130
|
-
|
131
|
-
if attributes.key?(:'to')
|
132
|
-
self.to = attributes[:'to']
|
133
|
-
end
|
134
|
-
|
135
|
-
if attributes.key?(:'application_id')
|
136
|
-
self.application_id = attributes[:'application_id']
|
137
|
-
end
|
138
|
-
|
139
|
-
if attributes.key?(:'channel')
|
140
|
-
self.channel = attributes[:'channel']
|
141
|
-
end
|
142
|
-
|
143
|
-
if attributes.key?(:'tag')
|
144
|
-
self.tag = attributes[:'tag']
|
61
|
+
if attributes.key?(:'file_url')
|
62
|
+
self.file_url = attributes[:'file_url']
|
63
|
+
else
|
64
|
+
self.file_url = nil
|
145
65
|
end
|
146
66
|
end
|
147
67
|
|
@@ -150,6 +70,14 @@ module Bandwidth
|
|
150
70
|
def list_invalid_properties
|
151
71
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
152
72
|
invalid_properties = Array.new
|
73
|
+
if @file_url.nil?
|
74
|
+
invalid_properties.push('invalid value for "file_url", file_url cannot be nil.')
|
75
|
+
end
|
76
|
+
|
77
|
+
if @file_url.to_s.length > 1000
|
78
|
+
invalid_properties.push('invalid value for "file_url", the character length must be smaller than or equal to 1000.')
|
79
|
+
end
|
80
|
+
|
153
81
|
invalid_properties
|
154
82
|
end
|
155
83
|
|
@@ -157,22 +85,31 @@ module Bandwidth
|
|
157
85
|
# @return true if the model is valid
|
158
86
|
def valid?
|
159
87
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
88
|
+
return false if @file_url.nil?
|
89
|
+
return false if @file_url.to_s.length > 1000
|
160
90
|
true
|
161
91
|
end
|
162
92
|
|
93
|
+
# Custom attribute writer method with validation
|
94
|
+
# @param [Object] file_url Value to be assigned
|
95
|
+
def file_url=(file_url)
|
96
|
+
if file_url.nil?
|
97
|
+
fail ArgumentError, 'file_url cannot be nil'
|
98
|
+
end
|
99
|
+
|
100
|
+
if file_url.to_s.length > 1000
|
101
|
+
fail ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.'
|
102
|
+
end
|
103
|
+
|
104
|
+
@file_url = file_url
|
105
|
+
end
|
106
|
+
|
163
107
|
# Checks equality by comparing each attribute.
|
164
108
|
# @param [Object] Object to be compared
|
165
109
|
def ==(o)
|
166
110
|
return true if self.equal?(o)
|
167
111
|
self.class == o.class &&
|
168
|
-
|
169
|
-
status == o.status &&
|
170
|
-
direction == o.direction &&
|
171
|
-
from == o.from &&
|
172
|
-
to == o.to &&
|
173
|
-
application_id == o.application_id &&
|
174
|
-
channel == o.channel &&
|
175
|
-
tag == o.tag
|
112
|
+
file_url == o.file_url
|
176
113
|
end
|
177
114
|
|
178
115
|
# @see the `==` method
|
@@ -184,7 +121,7 @@ module Bandwidth
|
|
184
121
|
# Calculates hash code according to all attributes.
|
185
122
|
# @return [Integer] Hash code
|
186
123
|
def hash
|
187
|
-
[
|
124
|
+
[file_url].hash
|
188
125
|
end
|
189
126
|
|
190
127
|
# Builds the object from hash
|
@@ -21,7 +21,7 @@ module Bandwidth
|
|
21
21
|
attr_accessor :text
|
22
22
|
|
23
23
|
# Base64 payload the customer receives when the reply is clicked.
|
24
|
-
attr_accessor :
|
24
|
+
attr_accessor :postback_data
|
25
25
|
|
26
26
|
# The title of the event.
|
27
27
|
attr_accessor :title
|
@@ -62,7 +62,7 @@ module Bandwidth
|
|
62
62
|
{
|
63
63
|
:'type' => :'type',
|
64
64
|
:'text' => :'text',
|
65
|
-
:'
|
65
|
+
:'postback_data' => :'postbackData',
|
66
66
|
:'title' => :'title',
|
67
67
|
:'start_time' => :'startTime',
|
68
68
|
:'end_time' => :'endTime',
|
@@ -80,7 +80,7 @@ module Bandwidth
|
|
80
80
|
{
|
81
81
|
:'type' => :'RbmActionTypeEnum',
|
82
82
|
:'text' => :'String',
|
83
|
-
:'
|
83
|
+
:'postback_data' => :'String',
|
84
84
|
:'title' => :'String',
|
85
85
|
:'start_time' => :'Time',
|
86
86
|
:'end_time' => :'Time',
|
@@ -128,10 +128,10 @@ module Bandwidth
|
|
128
128
|
self.text = nil
|
129
129
|
end
|
130
130
|
|
131
|
-
if attributes.key?(:'
|
132
|
-
self.
|
131
|
+
if attributes.key?(:'postback_data')
|
132
|
+
self.postback_data = attributes[:'postback_data']
|
133
133
|
else
|
134
|
-
self.
|
134
|
+
self.postback_data = nil
|
135
135
|
end
|
136
136
|
|
137
137
|
if attributes.key?(:'title')
|
@@ -174,12 +174,12 @@ module Bandwidth
|
|
174
174
|
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.')
|
175
175
|
end
|
176
176
|
|
177
|
-
if @
|
178
|
-
invalid_properties.push('invalid value for "
|
177
|
+
if @postback_data.nil?
|
178
|
+
invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.')
|
179
179
|
end
|
180
180
|
|
181
|
-
if @
|
182
|
-
invalid_properties.push('invalid value for "
|
181
|
+
if @postback_data.to_s.length > 2048
|
182
|
+
invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.')
|
183
183
|
end
|
184
184
|
|
185
185
|
if @title.nil?
|
@@ -212,8 +212,8 @@ module Bandwidth
|
|
212
212
|
return false if @type.nil?
|
213
213
|
return false if @text.nil?
|
214
214
|
return false if @text.to_s.length > 25
|
215
|
-
return false if @
|
216
|
-
return false if @
|
215
|
+
return false if @postback_data.nil?
|
216
|
+
return false if @postback_data.to_s.length > 2048
|
217
217
|
return false if @title.nil?
|
218
218
|
return false if @title.to_s.length > 100
|
219
219
|
return false if @start_time.nil?
|
@@ -237,17 +237,17 @@ module Bandwidth
|
|
237
237
|
end
|
238
238
|
|
239
239
|
# Custom attribute writer method with validation
|
240
|
-
# @param [Object]
|
241
|
-
def
|
242
|
-
if
|
243
|
-
fail ArgumentError, '
|
240
|
+
# @param [Object] postback_data Value to be assigned
|
241
|
+
def postback_data=(postback_data)
|
242
|
+
if postback_data.nil?
|
243
|
+
fail ArgumentError, 'postback_data cannot be nil'
|
244
244
|
end
|
245
245
|
|
246
|
-
if
|
247
|
-
fail ArgumentError, 'invalid value for "
|
246
|
+
if postback_data.to_s.length > 2048
|
247
|
+
fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.'
|
248
248
|
end
|
249
249
|
|
250
|
-
@
|
250
|
+
@postback_data = postback_data
|
251
251
|
end
|
252
252
|
|
253
253
|
# Custom attribute writer method with validation
|
@@ -285,7 +285,7 @@ module Bandwidth
|
|
285
285
|
self.class == o.class &&
|
286
286
|
type == o.type &&
|
287
287
|
text == o.text &&
|
288
|
-
|
288
|
+
postback_data == o.postback_data &&
|
289
289
|
title == o.title &&
|
290
290
|
start_time == o.start_time &&
|
291
291
|
end_time == o.end_time &&
|
@@ -301,7 +301,7 @@ module Bandwidth
|
|
301
301
|
# Calculates hash code according to all attributes.
|
302
302
|
# @return [Integer] Hash code
|
303
303
|
def hash
|
304
|
-
[type, text,
|
304
|
+
[type, text, postback_data, title, start_time, end_time, description].hash
|
305
305
|
end
|
306
306
|
|
307
307
|
# Builds the object from hash
|
@@ -0,0 +1,235 @@
|
|
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 MultiChannelError
|
18
|
+
attr_accessor :links
|
19
|
+
|
20
|
+
attr_accessor :data
|
21
|
+
|
22
|
+
attr_accessor :errors
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'links' => :'links',
|
28
|
+
:'data' => :'data',
|
29
|
+
:'errors' => :'errors'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'links' => :'Array<Link>',
|
42
|
+
:'data' => :'Object',
|
43
|
+
:'errors' => :'Array<ErrorObject>'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'data',
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelError` initialize method'
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'links')
|
70
|
+
if (value = attributes[:'links']).is_a?(Array)
|
71
|
+
self.links = value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.key?(:'data')
|
76
|
+
self.data = attributes[:'data']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'errors')
|
80
|
+
if (value = attributes[:'errors']).is_a?(Array)
|
81
|
+
self.errors = value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
90
|
+
invalid_properties = Array.new
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
# Checks equality by comparing each attribute.
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def ==(o)
|
104
|
+
return true if self.equal?(o)
|
105
|
+
self.class == o.class &&
|
106
|
+
links == o.links &&
|
107
|
+
data == o.data &&
|
108
|
+
errors == o.errors
|
109
|
+
end
|
110
|
+
|
111
|
+
# @see the `==` method
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def eql?(o)
|
114
|
+
self == o
|
115
|
+
end
|
116
|
+
|
117
|
+
# Calculates hash code according to all attributes.
|
118
|
+
# @return [Integer] Hash code
|
119
|
+
def hash
|
120
|
+
[links, data, errors].hash
|
121
|
+
end
|
122
|
+
|
123
|
+
# Builds the object from hash
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
+
# @return [Object] Returns the model itself
|
126
|
+
def self.build_from_hash(attributes)
|
127
|
+
return nil unless attributes.is_a?(Hash)
|
128
|
+
attributes = attributes.transform_keys(&:to_sym)
|
129
|
+
transformed_hash = {}
|
130
|
+
openapi_types.each_pair do |key, type|
|
131
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
132
|
+
transformed_hash["#{key}"] = nil
|
133
|
+
elsif type =~ /\AArray<(.*)>/i
|
134
|
+
# check to ensure the input is an array given that the attribute
|
135
|
+
# is documented as an array but the input is not
|
136
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
137
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
138
|
+
end
|
139
|
+
elsif !attributes[attribute_map[key]].nil?
|
140
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
141
|
+
end
|
142
|
+
end
|
143
|
+
new(transformed_hash)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Deserializes the data based on type
|
147
|
+
# @param string type Data type
|
148
|
+
# @param string value Value to be deserialized
|
149
|
+
# @return [Object] Deserialized data
|
150
|
+
def self._deserialize(type, value)
|
151
|
+
case type.to_sym
|
152
|
+
when :Time
|
153
|
+
Time.parse(value)
|
154
|
+
when :Date
|
155
|
+
Date.parse(value)
|
156
|
+
when :String
|
157
|
+
value.to_s
|
158
|
+
when :Integer
|
159
|
+
value.to_i
|
160
|
+
when :Float
|
161
|
+
value.to_f
|
162
|
+
when :Boolean
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
164
|
+
true
|
165
|
+
else
|
166
|
+
false
|
167
|
+
end
|
168
|
+
when :Object
|
169
|
+
# generic object (usually a Hash), return directly
|
170
|
+
value
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
177
|
+
{}.tap do |hash|
|
178
|
+
value.each do |k, v|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
else # model
|
183
|
+
# models (e.g. Pet) or oneOf
|
184
|
+
klass = Bandwidth.const_get(type)
|
185
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the string representation of the object
|
190
|
+
# @return [String] String presentation of the object
|
191
|
+
def to_s
|
192
|
+
to_hash.to_s
|
193
|
+
end
|
194
|
+
|
195
|
+
# to_body is an alias to to_hash (backward compatibility)
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_body
|
198
|
+
to_hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns the object in the form of hash
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
203
|
+
def to_hash
|
204
|
+
hash = {}
|
205
|
+
self.class.attribute_map.each_pair do |attr, param|
|
206
|
+
value = self.send(attr)
|
207
|
+
if value.nil?
|
208
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
209
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
210
|
+
end
|
211
|
+
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
@@ -14,16 +14,17 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Bandwidth
|
17
|
-
|
18
|
-
|
17
|
+
# The structure of the content field of a multichannel message.
|
18
|
+
class MultiChannelMessageContent
|
19
|
+
attr_accessor :text
|
19
20
|
|
20
|
-
attr_accessor :
|
21
|
+
attr_accessor :media
|
21
22
|
|
22
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
24
|
def self.attribute_map
|
24
25
|
{
|
25
|
-
:'
|
26
|
-
:'
|
26
|
+
:'text' => :'text',
|
27
|
+
:'media' => :'media'
|
27
28
|
}
|
28
29
|
end
|
29
30
|
|
@@ -35,8 +36,8 @@ module Bandwidth
|
|
35
36
|
# Attribute type mapping.
|
36
37
|
def self.openapi_types
|
37
38
|
{
|
38
|
-
:'
|
39
|
-
:'
|
39
|
+
:'text' => :'String',
|
40
|
+
:'media' => :'RbmMessageContentFile'
|
40
41
|
}
|
41
42
|
end
|
42
43
|
|
@@ -50,23 +51,23 @@ module Bandwidth
|
|
50
51
|
# @param [Hash] attributes Model attributes in the form of hash
|
51
52
|
def initialize(attributes = {})
|
52
53
|
if (!attributes.is_a?(Hash))
|
53
|
-
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::
|
54
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageContent` initialize method'
|
54
55
|
end
|
55
56
|
|
56
57
|
# check to see if the attribute exists and convert string to symbol for hash key
|
57
58
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
59
|
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
61
|
end
|
61
62
|
h[k.to_sym] = v
|
62
63
|
}
|
63
64
|
|
64
|
-
if attributes.key?(:'
|
65
|
-
self.
|
65
|
+
if attributes.key?(:'text')
|
66
|
+
self.text = attributes[:'text']
|
66
67
|
end
|
67
68
|
|
68
|
-
if attributes.key?(:'
|
69
|
-
self.
|
69
|
+
if attributes.key?(:'media')
|
70
|
+
self.media = attributes[:'media']
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
@@ -90,8 +91,8 @@ module Bandwidth
|
|
90
91
|
def ==(o)
|
91
92
|
return true if self.equal?(o)
|
92
93
|
self.class == o.class &&
|
93
|
-
|
94
|
-
|
94
|
+
text == o.text &&
|
95
|
+
media == o.media
|
95
96
|
end
|
96
97
|
|
97
98
|
# @see the `==` method
|
@@ -103,7 +104,7 @@ module Bandwidth
|
|
103
104
|
# Calculates hash code according to all attributes.
|
104
105
|
# @return [Integer] Hash code
|
105
106
|
def hash
|
106
|
-
[
|
107
|
+
[text, media].hash
|
107
108
|
end
|
108
109
|
|
109
110
|
# Builds the object from hash
|