bandwidth-sdk 13.1.4 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,303 @@
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 VerificationWebhook
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
+ attr_accessor :status
25
+
26
+ # Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.
27
+ attr_accessor :internal_ticket_number
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'account_id' => :'accountId',
55
+ :'phone_number' => :'phoneNumber',
56
+ :'status' => :'status',
57
+ :'internal_ticket_number' => :'internalTicketNumber'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'account_id' => :'String',
70
+ :'phone_number' => :'String',
71
+ :'status' => :'TfvCallbackStatusEnum',
72
+ :'internal_ticket_number' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationWebhook` initialize method'
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationWebhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'account_id')
98
+ self.account_id = attributes[:'account_id']
99
+ end
100
+
101
+ if attributes.key?(:'phone_number')
102
+ self.phone_number = attributes[:'phone_number']
103
+ end
104
+
105
+ if attributes.key?(:'status')
106
+ self.status = attributes[:'status']
107
+ end
108
+
109
+ if attributes.key?(:'internal_ticket_number')
110
+ self.internal_ticket_number = attributes[:'internal_ticket_number']
111
+ end
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
118
+ invalid_properties = Array.new
119
+ if !@phone_number.nil? && @phone_number.to_s.length > 12
120
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 12.')
121
+ end
122
+
123
+ if !@phone_number.nil? && @phone_number.to_s.length < 12
124
+ invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 12.')
125
+ end
126
+
127
+ pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
128
+ if !@phone_number.nil? && @phone_number !~ pattern
129
+ invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ return false if !@phone_number.nil? && @phone_number.to_s.length > 12
140
+ return false if !@phone_number.nil? && @phone_number.to_s.length < 12
141
+ return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
142
+ true
143
+ end
144
+
145
+ # Custom attribute writer method with validation
146
+ # @param [Object] phone_number Value to be assigned
147
+ def phone_number=(phone_number)
148
+ if phone_number.nil?
149
+ fail ArgumentError, 'phone_number cannot be nil'
150
+ end
151
+
152
+ if phone_number.to_s.length > 12
153
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 12.'
154
+ end
155
+
156
+ if phone_number.to_s.length < 12
157
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 12.'
158
+ end
159
+
160
+ pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
161
+ if phone_number !~ pattern
162
+ fail ArgumentError, "invalid value for \"phone_number\", must conform to the pattern #{pattern}."
163
+ end
164
+
165
+ @phone_number = phone_number
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ account_id == o.account_id &&
174
+ phone_number == o.phone_number &&
175
+ status == o.status &&
176
+ internal_ticket_number == o.internal_ticket_number
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Integer] Hash code
187
+ def hash
188
+ [account_id, phone_number, status, internal_ticket_number].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def self.build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ attributes = attributes.transform_keys(&:to_sym)
197
+ transformed_hash = {}
198
+ openapi_types.each_pair do |key, type|
199
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
200
+ transformed_hash["#{key}"] = nil
201
+ elsif type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[attribute_map[key]].is_a?(Array)
205
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
206
+ end
207
+ elsif !attributes[attribute_map[key]].nil?
208
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
209
+ end
210
+ end
211
+ new(transformed_hash)
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def self._deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = Bandwidth.const_get(type)
253
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+ end
303
+ end
@@ -14,31 +14,22 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- # Message Failed Callback Message Schema
18
- class MessageFailedCallbackMessage
17
+ # Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to.
18
+ class WebhookSubscription
19
19
  attr_accessor :id
20
20
 
21
- attr_accessor :owner
21
+ attr_accessor :account_id
22
22
 
23
- attr_accessor :application_id
23
+ # Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID.
24
+ attr_accessor :callback_url
24
25
 
25
- attr_accessor :time
26
+ attr_accessor :type
26
27
 
27
- attr_accessor :segment_count
28
+ attr_accessor :basic_authentication
28
29
 
29
- attr_accessor :direction
30
+ attr_accessor :created_date
30
31
 
31
- attr_accessor :to
32
-
33
- attr_accessor :from
34
-
35
- attr_accessor :text
36
-
37
- attr_accessor :tag
38
-
39
- attr_accessor :media
40
-
41
- attr_accessor :priority
32
+ attr_accessor :modified_date
42
33
 
43
34
  class EnumAttributeValidator
44
35
  attr_reader :datatype
@@ -66,17 +57,12 @@ module Bandwidth
66
57
  def self.attribute_map
67
58
  {
68
59
  :'id' => :'id',
69
- :'owner' => :'owner',
70
- :'application_id' => :'applicationId',
71
- :'time' => :'time',
72
- :'segment_count' => :'segmentCount',
73
- :'direction' => :'direction',
74
- :'to' => :'to',
75
- :'from' => :'from',
76
- :'text' => :'text',
77
- :'tag' => :'tag',
78
- :'media' => :'media',
79
- :'priority' => :'priority'
60
+ :'account_id' => :'accountId',
61
+ :'callback_url' => :'callbackUrl',
62
+ :'type' => :'type',
63
+ :'basic_authentication' => :'basicAuthentication',
64
+ :'created_date' => :'createdDate',
65
+ :'modified_date' => :'modifiedDate'
80
66
  }
81
67
  end
82
68
 
@@ -89,23 +75,19 @@ module Bandwidth
89
75
  def self.openapi_types
90
76
  {
91
77
  :'id' => :'String',
92
- :'owner' => :'String',
93
- :'application_id' => :'String',
94
- :'time' => :'Time',
95
- :'segment_count' => :'Integer',
96
- :'direction' => :'MessageDirectionEnum',
97
- :'to' => :'Array<String>',
98
- :'from' => :'String',
99
- :'text' => :'String',
100
- :'tag' => :'String',
101
- :'media' => :'Array<String>',
102
- :'priority' => :'PriorityEnum'
78
+ :'account_id' => :'String',
79
+ :'callback_url' => :'String',
80
+ :'type' => :'WebhookSubscriptionTypeEnum',
81
+ :'basic_authentication' => :'WebhookSubscriptionBasicAuthentication',
82
+ :'created_date' => :'Time',
83
+ :'modified_date' => :'Time'
103
84
  }
104
85
  end
105
86
 
106
87
  # List of attributes with nullable: true
107
88
  def self.openapi_nullable
108
89
  Set.new([
90
+ :'callback_url',
109
91
  ])
110
92
  end
111
93
 
@@ -113,87 +95,45 @@ module Bandwidth
113
95
  # @param [Hash] attributes Model attributes in the form of hash
114
96
  def initialize(attributes = {})
115
97
  if (!attributes.is_a?(Hash))
116
- fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MessageFailedCallbackMessage` initialize method'
98
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::WebhookSubscription` initialize method'
117
99
  end
118
100
 
119
101
  # check to see if the attribute exists and convert string to symbol for hash key
120
102
  attributes = attributes.each_with_object({}) { |(k, v), h|
121
103
  if (!self.class.attribute_map.key?(k.to_sym))
122
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MessageFailedCallbackMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::WebhookSubscription`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
123
105
  end
124
106
  h[k.to_sym] = v
125
107
  }
126
108
 
127
109
  if attributes.key?(:'id')
128
110
  self.id = attributes[:'id']
129
- else
130
- self.id = nil
131
- end
132
-
133
- if attributes.key?(:'owner')
134
- self.owner = attributes[:'owner']
135
- else
136
- self.owner = nil
137
- end
138
-
139
- if attributes.key?(:'application_id')
140
- self.application_id = attributes[:'application_id']
141
- else
142
- self.application_id = nil
143
- end
144
-
145
- if attributes.key?(:'time')
146
- self.time = attributes[:'time']
147
- else
148
- self.time = nil
149
111
  end
150
112
 
151
- if attributes.key?(:'segment_count')
152
- self.segment_count = attributes[:'segment_count']
153
- else
154
- self.segment_count = nil
155
- end
156
-
157
- if attributes.key?(:'direction')
158
- self.direction = attributes[:'direction']
159
- else
160
- self.direction = nil
161
- end
162
-
163
- if attributes.key?(:'to')
164
- if (value = attributes[:'to']).is_a?(Array)
165
- self.to = value
166
- end
167
- else
168
- self.to = nil
113
+ if attributes.key?(:'account_id')
114
+ self.account_id = attributes[:'account_id']
169
115
  end
170
116
 
171
- if attributes.key?(:'from')
172
- self.from = attributes[:'from']
117
+ if attributes.key?(:'callback_url')
118
+ self.callback_url = attributes[:'callback_url']
173
119
  else
174
- self.from = nil
120
+ self.callback_url = nil
175
121
  end
176
122
 
177
- if attributes.key?(:'text')
178
- self.text = attributes[:'text']
179
- else
180
- self.text = nil
123
+ if attributes.key?(:'type')
124
+ self.type = attributes[:'type']
181
125
  end
182
126
 
183
- if attributes.key?(:'tag')
184
- self.tag = attributes[:'tag']
185
- else
186
- self.tag = nil
127
+ if attributes.key?(:'basic_authentication')
128
+ self.basic_authentication = attributes[:'basic_authentication']
187
129
  end
188
130
 
189
- if attributes.key?(:'media')
190
- if (value = attributes[:'media']).is_a?(Array)
191
- self.media = value
192
- end
131
+ if attributes.key?(:'created_date')
132
+ self.created_date = attributes[:'created_date']
193
133
  end
194
134
 
195
- if attributes.key?(:'priority')
196
- self.priority = attributes[:'priority']
135
+ if attributes.key?(:'modified_date')
136
+ self.modified_date = attributes[:'modified_date']
197
137
  end
198
138
  end
199
139
 
@@ -202,44 +142,17 @@ module Bandwidth
202
142
  def list_invalid_properties
203
143
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
204
144
  invalid_properties = Array.new
205
- if @id.nil?
206
- invalid_properties.push('invalid value for "id", id cannot be nil.')
207
- end
208
-
209
- if @owner.nil?
210
- invalid_properties.push('invalid value for "owner", owner cannot be nil.')
211
- end
212
-
213
- if @application_id.nil?
214
- invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
215
- end
216
-
217
- if @time.nil?
218
- invalid_properties.push('invalid value for "time", time cannot be nil.')
219
- end
220
-
221
- if @segment_count.nil?
222
- invalid_properties.push('invalid value for "segment_count", segment_count cannot be nil.')
223
- end
224
-
225
- if @direction.nil?
226
- invalid_properties.push('invalid value for "direction", direction cannot be nil.')
145
+ if @callback_url.to_s.length > 2000
146
+ invalid_properties.push('invalid value for "callback_url", the character length must be smaller than or equal to 2000.')
227
147
  end
228
148
 
229
- if @to.nil?
230
- invalid_properties.push('invalid value for "to", to cannot be nil.')
149
+ if @callback_url.to_s.length < 0
150
+ invalid_properties.push('invalid value for "callback_url", the character length must be great than or equal to 0.')
231
151
  end
232
152
 
233
- if @from.nil?
234
- invalid_properties.push('invalid value for "from", from cannot be nil.')
235
- end
236
-
237
- if @text.nil?
238
- invalid_properties.push('invalid value for "text", text cannot be nil.')
239
- end
240
-
241
- if @tag.nil?
242
- invalid_properties.push('invalid value for "tag", tag cannot be nil.')
153
+ pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
154
+ if @callback_url !~ pattern
155
+ invalid_properties.push("invalid value for \"callback_url\", must conform to the pattern #{pattern}.")
243
156
  end
244
157
 
245
158
  invalid_properties
@@ -249,27 +162,29 @@ module Bandwidth
249
162
  # @return true if the model is valid
250
163
  def valid?
251
164
  warn '[DEPRECATED] the `valid?` method is obsolete'
252
- return false if @id.nil?
253
- return false if @owner.nil?
254
- return false if @application_id.nil?
255
- return false if @time.nil?
256
- return false if @segment_count.nil?
257
- return false if @direction.nil?
258
- return false if @to.nil?
259
- return false if @from.nil?
260
- return false if @text.nil?
261
- return false if @tag.nil?
165
+ return false if @callback_url.to_s.length > 2000
166
+ return false if @callback_url.to_s.length < 0
167
+ return false if @callback_url !~ Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
262
168
  true
263
169
  end
264
170
 
265
171
  # Custom attribute writer method with validation
266
- # @param [Object] to Value to be assigned
267
- def to=(to)
268
- if to.nil?
269
- fail ArgumentError, 'to cannot be nil'
172
+ # @param [Object] callback_url Value to be assigned
173
+ def callback_url=(callback_url)
174
+ if !callback_url.nil? && callback_url.to_s.length > 2000
175
+ fail ArgumentError, 'invalid value for "callback_url", the character length must be smaller than or equal to 2000.'
176
+ end
177
+
178
+ if !callback_url.nil? && callback_url.to_s.length < 0
179
+ fail ArgumentError, 'invalid value for "callback_url", the character length must be great than or equal to 0.'
180
+ end
181
+
182
+ pattern = Regexp.new(/^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/)
183
+ if !callback_url.nil? && callback_url !~ pattern
184
+ fail ArgumentError, "invalid value for \"callback_url\", must conform to the pattern #{pattern}."
270
185
  end
271
186
 
272
- @to = to
187
+ @callback_url = callback_url
273
188
  end
274
189
 
275
190
  # Checks equality by comparing each attribute.
@@ -278,17 +193,12 @@ module Bandwidth
278
193
  return true if self.equal?(o)
279
194
  self.class == o.class &&
280
195
  id == o.id &&
281
- owner == o.owner &&
282
- application_id == o.application_id &&
283
- time == o.time &&
284
- segment_count == o.segment_count &&
285
- direction == o.direction &&
286
- to == o.to &&
287
- from == o.from &&
288
- text == o.text &&
289
- tag == o.tag &&
290
- media == o.media &&
291
- priority == o.priority
196
+ account_id == o.account_id &&
197
+ callback_url == o.callback_url &&
198
+ type == o.type &&
199
+ basic_authentication == o.basic_authentication &&
200
+ created_date == o.created_date &&
201
+ modified_date == o.modified_date
292
202
  end
293
203
 
294
204
  # @see the `==` method
@@ -300,7 +210,7 @@ module Bandwidth
300
210
  # Calculates hash code according to all attributes.
301
211
  # @return [Integer] Hash code
302
212
  def hash
303
- [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority].hash
213
+ [id, account_id, callback_url, type, basic_authentication, created_date, modified_date].hash
304
214
  end
305
215
 
306
216
  # Builds the object from hash