bandwidth-sdk 13.1.4 → 14.1.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +15 -12
  3. data/README.md +45 -18
  4. data/bandwidth-sdk.gemspec +1 -1
  5. data/bandwidth.yml +1638 -589
  6. data/coverage/.last_run.json +1 -1
  7. data/coverage/.resultset.json +1388 -420
  8. data/coverage/index.html +20846 -10460
  9. data/custom_templates/README.mustache +6 -6
  10. data/custom_templates/gemspec.mustache +1 -1
  11. data/docs/AdditionalDenialReason.md +22 -0
  12. data/docs/Address.md +30 -0
  13. data/docs/CallbackTypeEnum.md +15 -0
  14. data/docs/Contact.md +24 -0
  15. data/docs/Error.md +22 -0
  16. data/docs/FailureWebhook.md +28 -0
  17. data/docs/LinksObject.md +24 -0
  18. data/docs/MediaApi.md +1 -1
  19. data/docs/Message.md +1 -1
  20. data/docs/MessageCallback.md +28 -0
  21. data/docs/MessageCallbackMessage.md +40 -0
  22. data/docs/OptInWorkflow.md +20 -0
  23. data/docs/TelephoneNumber.md +18 -0
  24. data/docs/TfvBasicAuthentication.md +20 -0
  25. data/docs/TfvCallbackStatusEnum.md +15 -0
  26. data/docs/TfvError.md +22 -0
  27. data/docs/TfvStatus.md +32 -0
  28. data/docs/TfvStatusEnum.md +15 -0
  29. data/docs/TfvSubmissionInfo.md +34 -0
  30. data/docs/TfvSubmissionWrapper.md +18 -0
  31. data/docs/TollFreeVerificationApi.md +585 -0
  32. data/docs/VerificationDenialWebhook.md +32 -0
  33. data/docs/VerificationRequest.md +36 -0
  34. data/docs/VerificationUpdateRequest.md +34 -0
  35. data/docs/VerificationWebhook.md +24 -0
  36. data/docs/WebhookSubscription.md +30 -0
  37. data/docs/WebhookSubscriptionBasicAuthentication.md +20 -0
  38. data/docs/WebhookSubscriptionRequestSchema.md +22 -0
  39. data/docs/WebhookSubscriptionTypeEnum.md +15 -0
  40. data/docs/WebhookSubscriptionsListBody.md +22 -0
  41. data/lib/bandwidth-sdk/api/media_api.rb +1 -1
  42. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +614 -0
  43. data/lib/bandwidth-sdk/configuration.rb +48 -0
  44. data/lib/bandwidth-sdk/models/additional_denial_reason.rb +254 -0
  45. data/lib/bandwidth-sdk/models/address.rb +501 -0
  46. data/lib/bandwidth-sdk/models/callback_type_enum.rb +42 -0
  47. data/lib/bandwidth-sdk/models/contact.rb +393 -0
  48. data/lib/bandwidth-sdk/models/error.rb +232 -0
  49. data/lib/bandwidth-sdk/models/failure_webhook.rb +304 -0
  50. data/lib/bandwidth-sdk/models/{transcription_metadata.rb → links_object.rb} +34 -35
  51. data/lib/bandwidth-sdk/models/{message_failed_callback.rb → message_callback.rb} +31 -13
  52. data/lib/bandwidth-sdk/models/{inbound_message_callback_message.rb → message_callback_message.rb} +6 -4
  53. data/lib/bandwidth-sdk/models/{inbound_message_callback.rb → opt_in_workflow.rb} +42 -61
  54. data/lib/bandwidth-sdk/models/telephone_number.rb +213 -0
  55. data/lib/bandwidth-sdk/models/{message_delivered_callback.rb → tfv_basic_authentication.rb} +58 -69
  56. data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +40 -0
  57. data/lib/bandwidth-sdk/models/{message_sending_callback.rb → tfv_error.rb} +12 -64
  58. data/lib/bandwidth-sdk/models/{message_delivered_callback_message.rb → tfv_status.rb} +86 -162
  59. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +43 -0
  60. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +452 -0
  61. data/lib/bandwidth-sdk/models/{transcription_list.rb → tfv_submission_wrapper.rb} +12 -14
  62. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +325 -0
  63. data/lib/bandwidth-sdk/models/verification_request.rb +547 -0
  64. data/lib/bandwidth-sdk/models/verification_update_request.rb +501 -0
  65. data/lib/bandwidth-sdk/models/verification_webhook.rb +303 -0
  66. data/lib/bandwidth-sdk/models/{message_failed_callback_message.rb → webhook_subscription.rb} +68 -158
  67. data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +274 -0
  68. data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +306 -0
  69. data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +40 -0
  70. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +242 -0
  71. data/lib/bandwidth-sdk/version.rb +1 -1
  72. data/lib/bandwidth-sdk.rb +28 -8
  73. data/openapi-config.yml +1 -1
  74. data/spec/call_utils.rb +2 -2
  75. data/spec/smoke/toll_free_verification_api_spec.rb +69 -0
  76. data/spec/spec_helper.rb +1 -1
  77. data/spec/unit/api/mfa_api_spec.rb +1 -1
  78. data/spec/unit/api/toll_free_verification_api_spec.rb +278 -0
  79. data/spec/unit/client/api_client_spec.rb +1 -1
  80. metadata +111 -62
  81. data/lib/bandwidth-sdk/models/disconenct_callback.rb +0 -405
  82. data/lib/bandwidth-sdk/models/message_sending_callback_message.rb +0 -418
@@ -0,0 +1,304 @@
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 FailureWebhook
18
+ # User's account ID.
19
+ attr_accessor :account_id
20
+
21
+ # Toll-free telephone number in E.164 format.
22
+ attr_accessor :phone_number
23
+
24
+ # An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered.
25
+ attr_accessor :error_code
26
+
27
+ # A description of the error that was encountered.
28
+ attr_accessor :error_description
29
+
30
+ # Details of the errors that were encountered when processing the request.
31
+ attr_accessor :errors
32
+
33
+ # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
34
+ attr_accessor :internal_ticket_number
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'account_id' => :'accountId',
40
+ :'phone_number' => :'phoneNumber',
41
+ :'error_code' => :'errorCode',
42
+ :'error_description' => :'errorDescription',
43
+ :'errors' => :'errors',
44
+ :'internal_ticket_number' => :'internalTicketNumber'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'account_id' => :'String',
57
+ :'phone_number' => :'String',
58
+ :'error_code' => :'String',
59
+ :'error_description' => :'String',
60
+ :'errors' => :'Array<String>',
61
+ :'internal_ticket_number' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::FailureWebhook` initialize method'
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::FailureWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'account_id')
87
+ self.account_id = attributes[:'account_id']
88
+ end
89
+
90
+ if attributes.key?(:'phone_number')
91
+ self.phone_number = attributes[:'phone_number']
92
+ end
93
+
94
+ if attributes.key?(:'error_code')
95
+ self.error_code = attributes[:'error_code']
96
+ end
97
+
98
+ if attributes.key?(:'error_description')
99
+ self.error_description = attributes[:'error_description']
100
+ end
101
+
102
+ if attributes.key?(:'errors')
103
+ if (value = attributes[:'errors']).is_a?(Array)
104
+ self.errors = value
105
+ end
106
+ end
107
+
108
+ if attributes.key?(:'internal_ticket_number')
109
+ self.internal_ticket_number = attributes[:'internal_ticket_number']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ if !@phone_number.nil? && @phone_number.to_s.length > 12
119
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
120
+ end
121
+
122
+ if !@phone_number.nil? && @phone_number.to_s.length < 12
123
+ invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.')
124
+ end
125
+
126
+ pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
127
+ if !@phone_number.nil? && @phone_number !~ pattern
128
+ invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
129
+ end
130
+
131
+ invalid_properties
132
+ end
133
+
134
+ # Check to see if the all the properties in the model are valid
135
+ # @return true if the model is valid
136
+ def valid?
137
+ warn '[DEPRECATED] the `valid?` method is obsolete'
138
+ return false if !@phone_number.nil? && @phone_number.to_s.length > 12
139
+ return false if !@phone_number.nil? && @phone_number.to_s.length < 12
140
+ return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
141
+ true
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] phone_number Value to be assigned
146
+ def phone_number=(phone_number)
147
+ if phone_number.nil?
148
+ fail ArgumentError, 'phone_number cannot be nil'
149
+ end
150
+
151
+ if phone_number.to_s.length > 12
152
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
153
+ end
154
+
155
+ if phone_number.to_s.length < 12
156
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.'
157
+ end
158
+
159
+ pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
160
+ if phone_number !~ pattern
161
+ fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
162
+ end
163
+
164
+ @phone_number = phone_number
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ account_id == o.account_id &&
173
+ phone_number == o.phone_number &&
174
+ error_code == o.error_code &&
175
+ error_description == o.error_description &&
176
+ errors == o.errors &&
177
+ internal_ticket_number == o.internal_ticket_number
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Integer] Hash code
188
+ def hash
189
+ [account_id, phone_number, error_code, error_description, errors, internal_ticket_number].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ attributes = attributes.transform_keys(&:to_sym)
198
+ transformed_hash = {}
199
+ openapi_types.each_pair do |key, type|
200
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = nil
202
+ elsif type =~ /\AArray<(.*)>/i
203
+ # check to ensure the input is an array given that the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[attribute_map[key]].is_a?(Array)
206
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
207
+ end
208
+ elsif !attributes[attribute_map[key]].nil?
209
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
210
+ end
211
+ end
212
+ new(transformed_hash)
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def self._deserialize(type, value)
220
+ case type.to_sym
221
+ when :Time
222
+ Time.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :Boolean
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ # models (e.g. Pet) or oneOf
253
+ klass = Bandwidth.const_get(type)
254
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ if value.nil?
277
+ is_nullable = self.class.openapi_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value)
291
+ if value.is_a?(Array)
292
+ value.compact.map { |v| _to_hash(v) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash
299
+ else
300
+ value
301
+ end
302
+ end
303
+ end
304
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.8.0
10
10
 
11
11
  =end
12
12
 
@@ -14,27 +14,26 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- # If the recording was transcribed, metadata about the transcription
18
- class TranscriptionMetadata
19
- # The unique transcription ID
20
- attr_accessor :id
17
+ class LinksObject
18
+ # The first (or only) page of results matching the query.
19
+ attr_accessor :first
21
20
 
22
- # The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values.
23
- attr_accessor :status
21
+ # If more results exist than specified by 'size', this link returns the next page of 'size' results.
22
+ attr_accessor :_next
24
23
 
25
- # The time that the transcription was completed
26
- attr_accessor :completed_time
24
+ # If the results are more than one page, this link returns the previous page of 'size' results.
25
+ attr_accessor :previous
27
26
 
28
- # The URL of the [transcription](#operation/getCallTranscription)
29
- attr_accessor :url
27
+ # If more results exist than specified by 'size', this link return the last page of result.
28
+ attr_accessor :last
30
29
 
31
30
  # Attribute mapping from ruby-style variable name to JSON key.
32
31
  def self.attribute_map
33
32
  {
34
- :'id' => :'id',
35
- :'status' => :'status',
36
- :'completed_time' => :'completedTime',
37
- :'url' => :'url'
33
+ :'first' => :'first',
34
+ :'_next' => :'next',
35
+ :'previous' => :'previous',
36
+ :'last' => :'last'
38
37
  }
39
38
  end
40
39
 
@@ -46,10 +45,10 @@ module Bandwidth
46
45
  # Attribute type mapping.
47
46
  def self.openapi_types
48
47
  {
49
- :'id' => :'String',
50
- :'status' => :'String',
51
- :'completed_time' => :'String',
52
- :'url' => :'String'
48
+ :'first' => :'String',
49
+ :'_next' => :'String',
50
+ :'previous' => :'String',
51
+ :'last' => :'String'
53
52
  }
54
53
  end
55
54
 
@@ -63,31 +62,31 @@ module Bandwidth
63
62
  # @param [Hash] attributes Model attributes in the form of hash
64
63
  def initialize(attributes = {})
65
64
  if (!attributes.is_a?(Hash))
66
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TranscriptionMetadata` initialize method'
65
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LinksObject` initialize method'
67
66
  end
68
67
 
69
68
  # check to see if the attribute exists and convert string to symbol for hash key
70
69
  attributes = attributes.each_with_object({}) { |(k, v), h|
71
70
  if (!self.class.attribute_map.key?(k.to_sym))
72
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TranscriptionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LinksObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
72
  end
74
73
  h[k.to_sym] = v
75
74
  }
76
75
 
77
- if attributes.key?(:'id')
78
- self.id = attributes[:'id']
76
+ if attributes.key?(:'first')
77
+ self.first = attributes[:'first']
79
78
  end
80
79
 
81
- if attributes.key?(:'status')
82
- self.status = attributes[:'status']
80
+ if attributes.key?(:'_next')
81
+ self._next = attributes[:'_next']
83
82
  end
84
83
 
85
- if attributes.key?(:'completed_time')
86
- self.completed_time = attributes[:'completed_time']
84
+ if attributes.key?(:'previous')
85
+ self.previous = attributes[:'previous']
87
86
  end
88
87
 
89
- if attributes.key?(:'url')
90
- self.url = attributes[:'url']
88
+ if attributes.key?(:'last')
89
+ self.last = attributes[:'last']
91
90
  end
92
91
  end
93
92
 
@@ -111,10 +110,10 @@ module Bandwidth
111
110
  def ==(o)
112
111
  return true if self.equal?(o)
113
112
  self.class == o.class &&
114
- id == o.id &&
115
- status == o.status &&
116
- completed_time == o.completed_time &&
117
- url == o.url
113
+ first == o.first &&
114
+ _next == o._next &&
115
+ previous == o.previous &&
116
+ last == o.last
118
117
  end
119
118
 
120
119
  # @see the `==` method
@@ -126,7 +125,7 @@ module Bandwidth
126
125
  # Calculates hash code according to all attributes.
127
126
  # @return [Integer] Hash code
128
127
  def hash
129
- [id, status, completed_time, url].hash
128
+ [first, _next, previous, last].hash
130
129
  end
131
130
 
132
131
  # Builds the object from hash
@@ -191,7 +190,7 @@ module Bandwidth
191
190
  else # model
192
191
  # models (e.g. Pet) or oneOf
193
192
  klass = Bandwidth.const_get(type)
194
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
195
194
  end
196
195
  end
197
196
 
@@ -14,20 +14,44 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- # Message Failed Callback
18
- class MessageFailedCallback
17
+ # Message Callback Schema
18
+ class MessageCallback
19
19
  attr_accessor :time
20
20
 
21
21
  attr_accessor :type
22
22
 
23
23
  attr_accessor :to
24
24
 
25
+ # A detailed description of the event described by the callback.
25
26
  attr_accessor :description
26
27
 
27
28
  attr_accessor :message
28
29
 
30
+ # Optional error code, applicable only when type is `message-failed`.
29
31
  attr_accessor :error_code
30
32
 
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
31
55
  # Attribute mapping from ruby-style variable name to JSON key.
32
56
  def self.attribute_map
33
57
  {
@@ -49,10 +73,10 @@ module Bandwidth
49
73
  def self.openapi_types
50
74
  {
51
75
  :'time' => :'Time',
52
- :'type' => :'String',
76
+ :'type' => :'CallbackTypeEnum',
53
77
  :'to' => :'String',
54
78
  :'description' => :'String',
55
- :'message' => :'MessageFailedCallbackMessage',
79
+ :'message' => :'MessageCallbackMessage',
56
80
  :'error_code' => :'Integer'
57
81
  }
58
82
  end
@@ -60,6 +84,7 @@ module Bandwidth
60
84
  # List of attributes with nullable: true
61
85
  def self.openapi_nullable
62
86
  Set.new([
87
+ :'error_code'
63
88
  ])
64
89
  end
65
90
 
@@ -67,13 +92,13 @@ module Bandwidth
67
92
  # @param [Hash] attributes Model attributes in the form of hash
68
93
  def initialize(attributes = {})
69
94
  if (!attributes.is_a?(Hash))
70
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageFailedCallback` initialize method'
95
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageCallback` initialize method'
71
96
  end
72
97
 
73
98
  # check to see if the attribute exists and convert string to symbol for hash key
74
99
  attributes = attributes.each_with_object({}) { |(k, v), h|
75
100
  if (!self.class.attribute_map.key?(k.to_sym))
76
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageFailedCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageCallback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
102
  end
78
103
  h[k.to_sym] = v
79
104
  }
@@ -110,8 +135,6 @@ module Bandwidth
110
135
 
111
136
  if attributes.key?(:'error_code')
112
137
  self.error_code = attributes[:'error_code']
113
- else
114
- self.error_code = nil
115
138
  end
116
139
  end
117
140
 
@@ -140,10 +163,6 @@ module Bandwidth
140
163
  invalid_properties.push('invalid value for "message", message cannot be nil.')
141
164
  end
142
165
 
143
- if @error_code.nil?
144
- invalid_properties.push('invalid value for "error_code", error_code cannot be nil.')
145
- end
146
-
147
166
  invalid_properties
148
167
  end
149
168
 
@@ -156,7 +175,6 @@ module Bandwidth
156
175
  return false if @to.nil?
157
176
  return false if @description.nil?
158
177
  return false if @message.nil?
159
- return false if @error_code.nil?
160
178
  true
161
179
  end
162
180
 
@@ -14,8 +14,8 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- # Inbound Message Callback Message Schema
18
- class InboundMessageCallbackMessage
17
+ # Message payload schema within a MessageCallback
18
+ class MessageCallbackMessage
19
19
  attr_accessor :id
20
20
 
21
21
  attr_accessor :owner
@@ -36,6 +36,7 @@ module Bandwidth
36
36
 
37
37
  attr_accessor :tag
38
38
 
39
+ # Optional media, applicable only for mms
39
40
  attr_accessor :media
40
41
 
41
42
  attr_accessor :priority
@@ -106,6 +107,7 @@ module Bandwidth
106
107
  # List of attributes with nullable: true
107
108
  def self.openapi_nullable
108
109
  Set.new([
110
+ :'media',
109
111
  ])
110
112
  end
111
113
 
@@ -113,13 +115,13 @@ module Bandwidth
113
115
  # @param [Hash] attributes Model attributes in the form of hash
114
116
  def initialize(attributes = {})
115
117
  if (!attributes.is_a?(Hash))
116
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::InboundMessageCallbackMessage` initialize method'
118
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageCallbackMessage` initialize method'
117
119
  end
118
120
 
119
121
  # check to see if the attribute exists and convert string to symbol for hash key
120
122
  attributes = attributes.each_with_object({}) { |(k, v), h|
121
123
  if (!self.class.attribute_map.key?(k.to_sym))
122
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::InboundMessageCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
124
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
123
125
  end
124
126
  h[k.to_sym] = v
125
127
  }