Class: Bandwidth::CreateCallResponse

Inherits:
ApiModelBase 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

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreateCallResponse

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
296
297
298
299
300
301
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 184

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
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_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: " + acceptable_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

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



133
134
135
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 133

def self.acceptable_attributes
  acceptable_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



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

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



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 165

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.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 138

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



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
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 485

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


513
514
515
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 513

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



519
520
521
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 519

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



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
348
349
350
351
352
353
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 305

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_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



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

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/bandwidth-sdk/models/create_call_response.rb', line 357

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