bandwidth-sdk 14.1.2 → 15.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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +18 -16
  3. data/README.md +34 -1
  4. data/bandwidth.yml +675 -101
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +210 -6
  7. data/coverage/index.html +14901 -12699
  8. data/docs/Address.md +1 -1
  9. data/docs/CallsApi.md +1 -1
  10. data/docs/CardWidthEnum.md +15 -0
  11. data/docs/ConferencesApi.md +1 -1
  12. data/docs/CreateMultiChannelMessageResponse.md +22 -0
  13. data/docs/ErrorObject.md +20 -0
  14. data/docs/Link.md +20 -0
  15. data/docs/Message.md +1 -1
  16. data/docs/MessageCallback.md +3 -1
  17. data/docs/MessageRequest.md +1 -1
  18. data/docs/MmsMessageContent.md +20 -0
  19. data/docs/MultiChannelAction.md +89 -0
  20. data/docs/MultiChannelActionCalendarEvent.md +30 -0
  21. data/docs/MultiChannelApi.md +80 -0
  22. data/docs/MultiChannelCallbackData.md +26 -0
  23. data/docs/MultiChannelChannelListObject.md +24 -0
  24. data/docs/MultiChannelChannelListObjectContent.md +55 -0
  25. data/docs/MultiChannelMessageCallbackData.md +32 -0
  26. data/docs/MultiChannelMessageChannelEnum.md +15 -0
  27. data/docs/MultiChannelMessageData.md +34 -0
  28. data/docs/MultiChannelMessageDirectionEnum.md +15 -0
  29. data/docs/MultiChannelMessageRequest.md +26 -0
  30. data/docs/MultiChannelStatusEnum.md +15 -0
  31. data/docs/RbmActionBase.md +22 -0
  32. data/docs/RbmActionDial.md +24 -0
  33. data/docs/RbmActionOpenUrl.md +24 -0
  34. data/docs/RbmActionTypeEnum.md +15 -0
  35. data/docs/RbmActionViewLocation.md +28 -0
  36. data/docs/RbmCardContent.md +24 -0
  37. data/docs/RbmCardContentMedia.md +22 -0
  38. data/docs/RbmMediaHeightEnum.md +15 -0
  39. data/docs/RbmMessageCarouselCard.md +22 -0
  40. data/docs/RbmMessageContentFile.md +20 -0
  41. data/docs/RbmMessageContentRichCard.md +49 -0
  42. data/docs/RbmMessageContentText.md +20 -0
  43. data/docs/RbmMessageMedia.md +20 -0
  44. data/docs/RbmStandaloneCard.md +24 -0
  45. data/docs/SmsMessageContent.md +18 -0
  46. data/docs/StandaloneCardOrientationEnum.md +15 -0
  47. data/docs/TfvBasicAuthentication.md +2 -2
  48. data/docs/TfvStatus.md +5 -1
  49. data/docs/TfvSubmissionInfo.md +7 -1
  50. data/docs/ThumbnailAlignmentEnum.md +15 -0
  51. data/docs/TollFreeVerificationApi.md +1 -1
  52. data/docs/VerificationDenialWebhook.md +5 -1
  53. data/docs/VerificationRequest.md +10 -4
  54. data/docs/VerificationUpdateRequest.md +10 -4
  55. data/lib/bandwidth-sdk/api/multi_channel_api.rb +96 -0
  56. data/lib/bandwidth-sdk/configuration.rb +6 -0
  57. data/lib/bandwidth-sdk/models/bxml/verbs/phone_number.rb +1 -0
  58. data/lib/bandwidth-sdk/models/card_width_enum.rb +40 -0
  59. data/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +234 -0
  60. data/lib/bandwidth-sdk/models/error_object.rb +221 -0
  61. data/lib/bandwidth-sdk/models/link.rb +221 -0
  62. data/lib/bandwidth-sdk/models/message.rb +1 -1
  63. data/lib/bandwidth-sdk/models/message_callback.rb +16 -5
  64. data/lib/bandwidth-sdk/models/message_request.rb +1 -1
  65. data/lib/bandwidth-sdk/models/mms_message_content.rb +244 -0
  66. data/lib/bandwidth-sdk/models/multi_channel_action.rb +61 -0
  67. data/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +419 -0
  68. data/lib/bandwidth-sdk/models/multi_channel_callback_data.rb +272 -0
  69. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object.rb +291 -0
  70. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object_content.rb +108 -0
  71. data/lib/bandwidth-sdk/models/multi_channel_message_callback_data.rb +302 -0
  72. data/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb +41 -0
  73. data/lib/bandwidth-sdk/models/multi_channel_message_data.rb +312 -0
  74. data/lib/bandwidth-sdk/models/multi_channel_message_direction_enum.rb +40 -0
  75. data/lib/bandwidth-sdk/models/multi_channel_message_request.rb +310 -0
  76. data/lib/bandwidth-sdk/models/multi_channel_status_enum.rb +42 -0
  77. data/lib/bandwidth-sdk/models/rbm_action_base.rb +313 -0
  78. data/lib/bandwidth-sdk/models/rbm_action_dial.rb +337 -0
  79. data/lib/bandwidth-sdk/models/rbm_action_open_url.rb +356 -0
  80. data/lib/bandwidth-sdk/models/rbm_action_type_enum.rb +44 -0
  81. data/lib/bandwidth-sdk/models/rbm_action_view_location.rb +383 -0
  82. data/lib/bandwidth-sdk/models/rbm_card_content.rb +301 -0
  83. data/lib/bandwidth-sdk/models/rbm_card_content_media.rb +313 -0
  84. data/lib/bandwidth-sdk/models/rbm_media_height_enum.rb +41 -0
  85. data/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb +309 -0
  86. data/lib/bandwidth-sdk/models/rbm_message_content_file.rb +268 -0
  87. data/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb +104 -0
  88. data/lib/bandwidth-sdk/models/rbm_message_content_text.rb +270 -0
  89. data/lib/bandwidth-sdk/models/rbm_message_media.rb +250 -0
  90. data/lib/bandwidth-sdk/models/rbm_standalone_card.rb +304 -0
  91. data/lib/bandwidth-sdk/models/sms_message_content.rb +239 -0
  92. data/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb +40 -0
  93. data/lib/bandwidth-sdk/models/tfv_status.rb +24 -4
  94. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +1 -3
  95. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +35 -5
  96. data/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb +40 -0
  97. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +24 -4
  98. data/lib/bandwidth-sdk/models/verification_request.rb +45 -15
  99. data/lib/bandwidth-sdk/models/verification_update_request.rb +35 -5
  100. data/lib/bandwidth-sdk/version.rb +1 -1
  101. data/lib/bandwidth-sdk.rb +34 -1
  102. data/spec/smoke/conferences_api_spec.rb +4 -4
  103. data/spec/smoke/multi_channel_api_spec.rb +40 -0
  104. data/spec/smoke/transcriptions_api_spec.rb +1 -1
  105. data/spec/unit/api/multi_channel_api_spec.rb +59 -0
  106. data/spec/unit/models/bxml/verbs/phone_number_spec.rb +6 -4
  107. metadata +117 -45
@@ -0,0 +1,291 @@
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 MultiChannelChannelListObject
18
+ # The sender ID of the message. This could be an alphanumeric sender ID.
19
+ attr_accessor :from
20
+
21
+ # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
22
+ attr_accessor :application_id
23
+
24
+ attr_accessor :channel
25
+
26
+ attr_accessor :content
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'from' => :'from',
54
+ :'application_id' => :'applicationId',
55
+ :'channel' => :'channel',
56
+ :'content' => :'content'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'from' => :'String',
69
+ :'application_id' => :'String',
70
+ :'channel' => :'MultiChannelMessageChannelEnum',
71
+ :'content' => :'MultiChannelChannelListObjectContent'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListObject` initialize method'
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'from')
97
+ self.from = attributes[:'from']
98
+ else
99
+ self.from = nil
100
+ end
101
+
102
+ if attributes.key?(:'application_id')
103
+ self.application_id = attributes[:'application_id']
104
+ else
105
+ self.application_id = nil
106
+ end
107
+
108
+ if attributes.key?(:'channel')
109
+ self.channel = attributes[:'channel']
110
+ else
111
+ self.channel = nil
112
+ end
113
+
114
+ if attributes.key?(:'content')
115
+ self.content = attributes[:'content']
116
+ else
117
+ self.content = nil
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @from.nil?
127
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
128
+ end
129
+
130
+ if @application_id.nil?
131
+ invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
132
+ end
133
+
134
+ if @channel.nil?
135
+ invalid_properties.push('invalid value for "channel", channel cannot be nil.')
136
+ end
137
+
138
+ if @content.nil?
139
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
140
+ end
141
+
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
+ return false if @from.nil?
150
+ return false if @application_id.nil?
151
+ return false if @channel.nil?
152
+ return false if @content.nil?
153
+ true
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ from == o.from &&
162
+ application_id == o.application_id &&
163
+ channel == o.channel &&
164
+ content == o.content
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [from, application_id, channel, content].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ attributes = attributes.transform_keys(&:to_sym)
185
+ transformed_hash = {}
186
+ openapi_types.each_pair do |key, type|
187
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = nil
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[attribute_map[key]].is_a?(Array)
193
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
194
+ end
195
+ elsif !attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
197
+ end
198
+ end
199
+ new(transformed_hash)
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def self._deserialize(type, value)
207
+ case type.to_sym
208
+ when :Time
209
+ Time.parse(value)
210
+ when :Date
211
+ Date.parse(value)
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :Boolean
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else # model
239
+ # models (e.g. Pet) or oneOf
240
+ klass = Bandwidth.const_get(type)
241
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
242
+ end
243
+ end
244
+
245
+ # Returns the string representation of the object
246
+ # @return [String] String presentation of the object
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_hash (backward compatibility)
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_body
254
+ to_hash
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ if value.nil?
264
+ is_nullable = self.class.openapi_nullable.include?(attr)
265
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
+ end
267
+
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+ end
291
+ end
@@ -0,0 +1,108 @@
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
+ # The content of the message.
18
+ module MultiChannelChannelListObjectContent
19
+ class << self
20
+ # List of class defined in oneOf (OpenAPI v3)
21
+ def openapi_one_of
22
+ [
23
+ :'MmsMessageContent',
24
+ :'RbmMessageContentRichCard',
25
+ :'RbmMessageContentText',
26
+ :'RbmMessageMedia',
27
+ :'SmsMessageContent'
28
+ ]
29
+ end
30
+
31
+ # Builds the object
32
+ # @param [Mixed] Data to be matched against the list of oneOf items
33
+ # @return [Object] Returns the model or the data itself
34
+ def build(data)
35
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
36
+ # Note:
37
+ # - We do not attempt to check whether exactly one item matches.
38
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
39
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
40
+ # - TODO: scalar values are de facto behaving as if they were nullable.
41
+ # - TODO: logging when debugging is set.
42
+ openapi_one_of.each do |klass|
43
+ begin
44
+ next if klass == :AnyType # "nullable: true"
45
+ typed_data = find_and_cast_into_type(klass, data)
46
+ return typed_data if typed_data
47
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
48
+ end
49
+ end
50
+
51
+ openapi_one_of.include?(:AnyType) ? data : nil
52
+ end
53
+
54
+ private
55
+
56
+ SchemaMismatchError = Class.new(StandardError)
57
+
58
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
59
+ def find_and_cast_into_type(klass, data)
60
+ return if data.nil?
61
+
62
+ case klass.to_s
63
+ when 'Boolean'
64
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
65
+ when 'Float'
66
+ return data if data.instance_of?(Float)
67
+ when 'Integer'
68
+ return data if data.instance_of?(Integer)
69
+ when 'Time'
70
+ return Time.parse(data)
71
+ when 'Date'
72
+ return Date.parse(data)
73
+ when 'String'
74
+ return data if data.instance_of?(String)
75
+ when 'Object' # "type: object"
76
+ return data if data.instance_of?(Hash)
77
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
78
+ if data.instance_of?(Array)
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
81
+ end
82
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
83
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
84
+ sub_type = Regexp.last_match[:sub_type]
85
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
86
+ end
87
+ else # model
88
+ const = Bandwidth.const_get(klass)
89
+ if const
90
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
91
+ model = const.build(data)
92
+ return model if model
93
+ else
94
+ # raise if data contains keys that are not known to the model
95
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
96
+ model = const.build_from_hash(data)
97
+ return model if model
98
+ end
99
+ end
100
+ end
101
+
102
+ raise # if no match by now, raise
103
+ rescue
104
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,302 @@
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 MultiChannelMessageCallbackData
18
+ # The ID of the message.
19
+ attr_accessor :message_id
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
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'message_id' => :'messageId',
65
+ :'status' => :'status',
66
+ :'direction' => :'direction',
67
+ :'from' => :'from',
68
+ :'to' => :'to',
69
+ :'application_id' => :'applicationId',
70
+ :'channel' => :'channel',
71
+ :'tag' => :'tag'
72
+ }
73
+ end
74
+
75
+ # Returns all the JSON keys this model knows about
76
+ def self.acceptable_attributes
77
+ attribute_map.values
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.openapi_types
82
+ {
83
+ :'message_id' => :'String',
84
+ :'status' => :'MultiChannelStatusEnum',
85
+ :'direction' => :'MultiChannelMessageDirectionEnum',
86
+ :'from' => :'String',
87
+ :'to' => :'String',
88
+ :'application_id' => :'String',
89
+ :'channel' => :'MultiChannelMessageChannelEnum',
90
+ :'tag' => :'String'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageCallbackData` initialize method'
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelMessageCallbackData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'message_id')
116
+ self.message_id = attributes[:'message_id']
117
+ end
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']
145
+ end
146
+ end
147
+
148
+ # Show invalid properties with the reasons. Usually used together with valid?
149
+ # @return Array for valid properties with the reasons
150
+ def list_invalid_properties
151
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
152
+ invalid_properties = Array.new
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ warn '[DEPRECATED] the `valid?` method is obsolete'
160
+ true
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ message_id == o.message_id &&
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
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [message_id, status, direction, from, to, application_id, channel, tag].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ transformed_hash = {}
197
+ openapi_types.each_pair do |key, type|
198
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = nil
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[attribute_map[key]].is_a?(Array)
204
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
205
+ end
206
+ elsif !attributes[attribute_map[key]].nil?
207
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
208
+ end
209
+ end
210
+ new(transformed_hash)
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def self._deserialize(type, value)
218
+ case type.to_sym
219
+ when :Time
220
+ Time.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :Boolean
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ # models (e.g. Pet) or oneOf
251
+ klass = Bandwidth.const_get(type)
252
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+ end
302
+ end