Class: Bandwidth::CreateCall

Inherits:
ApiModelBase show all
Defined in:
lib/bandwidth-sdk/models/create_call.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 = {}) ⇒ CreateCall

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
302
303
304
# File 'lib/bandwidth-sdk/models/create_call.rb', line 187

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateCall` 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::CreateCall`. 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?(:'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?(:'privacy')
    self.privacy = attributes[:'privacy']
  end

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

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

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

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

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

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

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

  if attributes.key?(:'answer_fallback_url')
    self.answer_fallback_url = attributes[:'answer_fallback_url']
  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?(:'fallback_username')
    self.fallback_username = attributes[:'fallback_username']
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#answer_fallback_methodObject

Returns the value of attribute answer_fallback_method.



50
51
52
# File 'lib/bandwidth-sdk/models/create_call.rb', line 50

def answer_fallback_method
  @answer_fallback_method
end

#answer_fallback_urlObject

A fallback url which, if provided, will be used to retry the ‘answer` webhook delivery in case `answerUrl` fails to respond Must use `https` if specifying `fallbackUsername` and `fallbackPassword`.



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

def answer_fallback_url
  @answer_fallback_url
end

#answer_methodObject

Returns the value of attribute answer_method.



39
40
41
# File 'lib/bandwidth-sdk/models/create_call.rb', line 39

def answer_method
  @answer_method
end

#answer_urlObject

The full URL to send the <a href=‘/docs/voice/webhooks/answer’>Answer</a> event to when the called party answers. This endpoint should return the first <a href=‘/docs/voice/bxml’>BXML document</a> to be executed in the call. Must use ‘https` if specifying `username` and `password`.



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

def answer_url
  @answer_url
end

#application_idObject

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



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

def application_id
  @application_id
end

#call_timeoutObject

The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Can be any numeric value (including decimals) between 1 and 300.



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

def call_timeout
  @call_timeout
end

#callback_timeoutObject

This is the timeout (in seconds) to use when delivering webhooks for the call. Can be any numeric value (including decimals) between 1 and 25.



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

def callback_timeout
  @callback_timeout
end

#disconnect_methodObject

Returns the value of attribute disconnect_method.



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

def disconnect_method
  @disconnect_method
end

#disconnect_urlObject

The URL to send the <a href=‘/docs/voice/webhooks/disconnect’>Disconnect</a> event to when the call ends. This event does not expect a BXML response.



59
60
61
# File 'lib/bandwidth-sdk/models/create_call.rb', line 59

def disconnect_url
  @disconnect_url
end

#display_nameObject

The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If ‘privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`.



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

def display_name
  @display_name
end

#fallback_passwordObject

Basic auth password.



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

def fallback_password
  @fallback_password
end

#fallback_usernameObject

Basic auth username.



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

def fallback_username
  @fallback_username
end

#fromObject

A Bandwidth phone number on your account the call should come from (must be in E.164 format, like ‘+15555551212`) even if `privacy` is set to true.



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

def from
  @from
end

#machine_detectionObject

Returns the value of attribute machine_detection.



69
70
71
# File 'lib/bandwidth-sdk/models/create_call.rb', line 69

def machine_detection
  @machine_detection
end

#passwordObject

Basic auth password.



45
46
47
# File 'lib/bandwidth-sdk/models/create_call.rb', line 45

def password
  @password
end

#priorityObject

The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call.



72
73
74
# File 'lib/bandwidth-sdk/models/create_call.rb', line 72

def priority
  @priority
end

#privacyObject

Hide the calling number. The ‘displayName` field can be used to customize the displayed name.



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

def privacy
  @privacy
end

#tagObject

A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href=‘/docs/voice/bxml/tag’>‘<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=""` Max length 256 characters.



75
76
77
# File 'lib/bandwidth-sdk/models/create_call.rb', line 75

def tag
  @tag
end

#toObject

The destination to call (must be an E.164 formatted number (e.g. ‘+15555551212`) or a SIP URI (e.g. `sip:[email protected]`)).



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

def to
  @to
end

#usernameObject

Basic auth username.



42
43
44
# File 'lib/bandwidth-sdk/models/create_call.rb', line 42

def username
  @username
end

#uuiObject

A comma-separated list of ‘User-To-User’ headers to be sent in the INVITE when calling a SIP URI. Each value must end with an ‘encoding’ parameter as described in <a href=‘tools.ietf.org/html/rfc7433’>RFC 7433</a>. Only ‘jwt’, ‘base64’ and ‘hex’ encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators.



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

def uui
  @uui
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



127
128
129
# File 'lib/bandwidth-sdk/models/create_call.rb', line 127

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



132
133
134
# File 'lib/bandwidth-sdk/models/create_call.rb', line 132

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'to' => :'to',
    :'from' => :'from',
    :'privacy' => :'privacy',
    :'display_name' => :'displayName',
    :'uui' => :'uui',
    :'application_id' => :'applicationId',
    :'answer_url' => :'answerUrl',
    :'answer_method' => :'answerMethod',
    :'username' => :'username',
    :'password' => :'password',
    :'answer_fallback_url' => :'answerFallbackUrl',
    :'answer_fallback_method' => :'answerFallbackMethod',
    :'fallback_username' => :'fallbackUsername',
    :'fallback_password' => :'fallbackPassword',
    :'disconnect_url' => :'disconnectUrl',
    :'disconnect_method' => :'disconnectMethod',
    :'call_timeout' => :'callTimeout',
    :'callback_timeout' => :'callbackTimeout',
    :'machine_detection' => :'machineDetection',
    :'priority' => :'priority',
    :'tag' => :'tag'
  }
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



625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/bandwidth-sdk/models/create_call.rb', line 625

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



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

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'to' => :'String',
    :'from' => :'String',
    :'privacy' => :'Boolean',
    :'display_name' => :'String',
    :'uui' => :'String',
    :'application_id' => :'String',
    :'answer_url' => :'String',
    :'answer_method' => :'CallbackMethodEnum',
    :'username' => :'String',
    :'password' => :'String',
    :'answer_fallback_url' => :'String',
    :'answer_fallback_method' => :'CallbackMethodEnum',
    :'fallback_username' => :'String',
    :'fallback_password' => :'String',
    :'disconnect_url' => :'String',
    :'disconnect_method' => :'CallbackMethodEnum',
    :'call_timeout' => :'Float',
    :'callback_timeout' => :'Float',
    :'machine_detection' => :'MachineDetectionConfiguration',
    :'priority' => :'Integer',
    :'tag' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/bandwidth-sdk/models/create_call.rb', line 584

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


612
613
614
# File 'lib/bandwidth-sdk/models/create_call.rb', line 612

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



618
619
620
# File 'lib/bandwidth-sdk/models/create_call.rb', line 618

def hash
  [to, from, privacy, display_name, uui, application_id, answer_url, answer_method, username, password, answer_fallback_url, answer_fallback_method, fallback_username, fallback_password, disconnect_url, disconnect_method, call_timeout, callback_timeout, machine_detection, priority, tag].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/bandwidth-sdk/models/create_call.rb', line 308

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  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 !@display_name.nil? && @display_name.to_s.length > 256
    invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 256.')
  end

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

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

  if @answer_url.to_s.length > 2048
    invalid_properties.push('invalid value for "answer_url", the character length must be smaller than or equal to 2048.')
  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 !@answer_fallback_url.nil? && @answer_fallback_url.to_s.length > 2048
    invalid_properties.push('invalid value for "answer_fallback_url", the character length must be smaller than or equal to 2048.')
  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

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

  if !@call_timeout.nil? && @call_timeout > 300
    invalid_properties.push('invalid value for "call_timeout", must be smaller than or equal to 300.')
  end

  if !@call_timeout.nil? && @call_timeout < 1
    invalid_properties.push('invalid value for "call_timeout", must be greater than or equal to 1.')
  end

  if !@callback_timeout.nil? && @callback_timeout > 25
    invalid_properties.push('invalid value for "callback_timeout", must be smaller than or equal to 25.')
  end

  if !@callback_timeout.nil? && @callback_timeout < 1
    invalid_properties.push('invalid value for "callback_timeout", must be greater than or equal to 1.')
  end

  if !@priority.nil? && @priority > 5
    invalid_properties.push('invalid value for "priority", must be smaller than or equal to 5.')
  end

  if !@priority.nil? && @priority < 1
    invalid_properties.push('invalid value for "priority", must be greater than or equal to 1.')
  end

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/bandwidth-sdk/models/create_call.rb', line 647

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



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/bandwidth-sdk/models/create_call.rb', line 392

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @to.nil?
  return false if @from.nil?
  return false if !@display_name.nil? && @display_name.to_s.length > 256
  return false if @application_id.nil?
  return false if @answer_url.nil?
  return false if @answer_url.to_s.length > 2048
  return false if !@username.nil? && @username.to_s.length > 1024
  return false if !@password.nil? && @password.to_s.length > 1024
  return false if !@answer_fallback_url.nil? && @answer_fallback_url.to_s.length > 2048
  return false if !@fallback_username.nil? && @fallback_username.to_s.length > 1024
  return false if !@fallback_password.nil? && @fallback_password.to_s.length > 1024
  return false if !@disconnect_url.nil? && @disconnect_url.to_s.length > 2048
  return false if !@call_timeout.nil? && @call_timeout > 300
  return false if !@call_timeout.nil? && @call_timeout < 1
  return false if !@callback_timeout.nil? && @callback_timeout > 25
  return false if !@callback_timeout.nil? && @callback_timeout < 1
  return false if !@priority.nil? && @priority > 5
  return false if !@priority.nil? && @priority < 1
  return false if !@tag.nil? && @tag.to_s.length > 256
  true
end