Class: Bandwidth::CreateCallResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/bandwidth-sdk/models/create_call_response.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateCallResponse

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 179

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateCallResponse` initialize method'
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateCallResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'application_id')
    self.application_id = attributes[:'application_id']
  else
    self.application_id = nil
  end

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  else
    self. = nil
  end

  if attributes.key?(:'call_id')
    self.call_id = attributes[:'call_id']
  else
    self.call_id = nil
  end

  if attributes.key?(:'to')
    self.to = attributes[:'to']
  else
    self.to = nil
  end

  if attributes.key?(:'from')
    self.from = attributes[:'from']
  else
    self.from = nil
  end

  if attributes.key?(:'enqueued_time')
    self.enqueued_time = attributes[:'enqueued_time']
  end

  if attributes.key?(:'call_url')
    self.call_url = attributes[:'call_url']
  else
    self.call_url = nil
  end

  if attributes.key?(:'call_timeout')
    self.call_timeout = attributes[:'call_timeout']
  end

  if attributes.key?(:'callback_timeout')
    self.callback_timeout = attributes[:'callback_timeout']
  end

  if attributes.key?(:'tag')
    self.tag = attributes[:'tag']
  end

  if attributes.key?(:'answer_method')
    self.answer_method = attributes[:'answer_method']
  else
    self.answer_method = 'POST'
  end

  if attributes.key?(:'answer_url')
    self.answer_url = attributes[:'answer_url']
  else
    self.answer_url = nil
  end

  if attributes.key?(:'answer_fallback_method')
    self.answer_fallback_method = attributes[:'answer_fallback_method']
  else
    self.answer_fallback_method = 'POST'
  end

  if attributes.key?(:'answer_fallback_url')
    self.answer_fallback_url = attributes[:'answer_fallback_url']
  end

  if attributes.key?(:'disconnect_method')
    self.disconnect_method = attributes[:'disconnect_method']
  else
    self.disconnect_method = 'POST'
  end

  if attributes.key?(:'disconnect_url')
    self.disconnect_url = attributes[:'disconnect_url']
  end

  if attributes.key?(:'username')
    self.username = attributes[:'username']
  end

  if attributes.key?(:'password')
    self.password = attributes[:'password']
  end

  if attributes.key?(:'fallback_username')
    self.fallback_username = attributes[:'fallback_username']
  end

  if attributes.key?(:'fallback_password')
    self.fallback_password = attributes[:'fallback_password']
  end

  if attributes.key?(:'priority')
    self.priority = attributes[:'priority']
  end
end

Instance Attribute Details

#account_idObject

The bandwidth account ID associated with the call.



22
23
24
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 22

def 
  @account_id
end

#answer_fallback_methodObject

Returns the value of attribute answer_fallback_method.



53
54
55
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 53

def answer_fallback_method
  @answer_fallback_method
end

#answer_fallback_urlObject

Fallback URL to deliver the ‘answer` event webhook.



56
57
58
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 56

def answer_fallback_url
  @answer_fallback_url
end

#answer_methodObject

Returns the value of attribute answer_method.



48
49
50
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 48

def answer_method
  @answer_method
end

#answer_urlObject

URL to deliver the ‘answer` event webhook.



51
52
53
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 51

def answer_url
  @answer_url
end

#application_idObject

The id of the application associated with the ‘from` number.



19
20
21
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 19

def application_id
  @application_id
end

#call_idObject

Programmable Voice API Call ID.



25
26
27
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 25

def call_id
  @call_id
end

#call_timeoutObject

The timeout (in seconds) for the callee to answer the call after it starts ringing.



40
41
42
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 40

def call_timeout
  @call_timeout
end

#call_urlObject

The URL to update this call’s state.



37
38
39
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 37

def call_url
  @call_url
end

#callback_timeoutObject

This is the timeout (in seconds) to use when delivering webhooks for the call.



43
44
45
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 43

def callback_timeout
  @callback_timeout
end

#disconnect_methodObject

Returns the value of attribute disconnect_method.



58
59
60
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 58

def disconnect_method
  @disconnect_method
end

#disconnect_urlObject

URL to deliver the ‘disconnect` event webhook.



61
62
63
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 61

def disconnect_url
  @disconnect_url
end

#enqueued_timeObject

The time at which the call was accepted into the queue.



34
35
36
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 34

def enqueued_time
  @enqueued_time
end

#fallback_passwordObject

Basic auth password.



73
74
75
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 73

def fallback_password
  @fallback_password
end

#fallback_usernameObject

Basic auth username.



70
71
72
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 70

def fallback_username
  @fallback_username
end

#fromObject

Phone number that created the outbound call.



31
32
33
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 31

def from
  @from
end

#passwordObject

Basic auth password.



67
68
69
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 67

def password
  @password
end

#priorityObject

The priority of this call over other calls from your account.



76
77
78
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 76

def priority
  @priority
end

#tagObject

Custom tag value.



46
47
48
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 46

def tag
  @tag
end

#toObject

Recipient of the outgoing call.



28
29
30
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 28

def to
  @to
end

#usernameObject

Basic auth username.



64
65
66
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 64

def username
  @username
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 474

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Bandwidth.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



128
129
130
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 128

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 101

def self.attribute_map
  {
    :'application_id' => :'applicationId',
    :'account_id' => :'accountId',
    :'call_id' => :'callId',
    :'to' => :'to',
    :'from' => :'from',
    :'enqueued_time' => :'enqueuedTime',
    :'call_url' => :'callUrl',
    :'call_timeout' => :'callTimeout',
    :'callback_timeout' => :'callbackTimeout',
    :'tag' => :'tag',
    :'answer_method' => :'answerMethod',
    :'answer_url' => :'answerUrl',
    :'answer_fallback_method' => :'answerFallbackMethod',
    :'answer_fallback_url' => :'answerFallbackUrl',
    :'disconnect_method' => :'disconnectMethod',
    :'disconnect_url' => :'disconnectUrl',
    :'username' => :'username',
    :'password' => :'password',
    :'fallback_username' => :'fallbackUsername',
    :'fallback_password' => :'fallbackPassword',
    :'priority' => :'priority'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 450

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 160

def self.openapi_nullable
  Set.new([
    :'enqueued_time',
    :'tag',
    :'answer_method',
    :'answer_fallback_method',
    :'answer_fallback_url',
    :'disconnect_method',
    :'disconnect_url',
    :'username',
    :'password',
    :'fallback_username',
    :'fallback_password',
    :'priority'
  ])
end

.openapi_typesObject

Attribute type mapping.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 133

def self.openapi_types
  {
    :'application_id' => :'String',
    :'account_id' => :'String',
    :'call_id' => :'String',
    :'to' => :'String',
    :'from' => :'String',
    :'enqueued_time' => :'Time',
    :'call_url' => :'String',
    :'call_timeout' => :'Float',
    :'callback_timeout' => :'Float',
    :'tag' => :'String',
    :'answer_method' => :'CallbackMethodEnum',
    :'answer_url' => :'String',
    :'answer_fallback_method' => :'CallbackMethodEnum',
    :'answer_fallback_url' => :'String',
    :'disconnect_method' => :'CallbackMethodEnum',
    :'disconnect_url' => :'String',
    :'username' => :'String',
    :'password' => :'String',
    :'fallback_username' => :'String',
    :'fallback_password' => :'String',
    :'priority' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 409

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      application_id == o.application_id &&
       == o. &&
      call_id == o.call_id &&
      to == o.to &&
      from == o.from &&
      enqueued_time == o.enqueued_time &&
      call_url == o.call_url &&
      call_timeout == o.call_timeout &&
      callback_timeout == o.callback_timeout &&
      tag == o.tag &&
      answer_method == o.answer_method &&
      answer_url == o.answer_url &&
      answer_fallback_method == o.answer_fallback_method &&
      answer_fallback_url == o.answer_fallback_url &&
      disconnect_method == o.disconnect_method &&
      disconnect_url == o.disconnect_url &&
      username == o.username &&
      password == o.password &&
      fallback_username == o.fallback_username &&
      fallback_password == o.fallback_password &&
      priority == o.priority
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



545
546
547
548
549
550
551
552
553
554
555
556
557
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 545

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


437
438
439
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 437

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



443
444
445
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 443

def hash
  [application_id, , call_id, to, from, enqueued_time, call_url, call_timeout, callback_timeout, tag, answer_method, answer_url, answer_fallback_method, answer_fallback_url, disconnect_method, disconnect_url, username, password, fallback_username, fallback_password, priority].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 299

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @application_id.nil?
    invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
  end

  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if @call_id.nil?
    invalid_properties.push('invalid value for "call_id", call_id cannot be nil.')
  end

  if @to.nil?
    invalid_properties.push('invalid value for "to", to cannot be nil.')
  end

  if @from.nil?
    invalid_properties.push('invalid value for "from", from cannot be nil.')
  end

  if @call_url.nil?
    invalid_properties.push('invalid value for "call_url", call_url cannot be nil.')
  end

  if @answer_url.nil?
    invalid_properties.push('invalid value for "answer_url", answer_url cannot be nil.')
  end

  if !@username.nil? && @username.to_s.length > 1024
    invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 1024.')
  end

  if !@password.nil? && @password.to_s.length > 1024
    invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 1024.')
  end

  if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
    invalid_properties.push('invalid value for "fallback_username", the character length must be smaller than or equal to 1024.')
  end

  if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
    invalid_properties.push('invalid value for "fallback_password", the character length must be smaller than or equal to 1024.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



521
522
523
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 521

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 527

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



515
516
517
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 515

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 351

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @application_id.nil?
  return false if @account_id.nil?
  return false if @call_id.nil?
  return false if @to.nil?
  return false if @from.nil?
  return false if @call_url.nil?
  return false if @answer_url.nil?
  return false if !@username.nil? && @username.to_s.length > 1024
  return false if !@password.nil? && @password.to_s.length > 1024
  return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
  return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
  true
end