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



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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/bandwidth-sdk/models/create_call.rb', line 199

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

  if attributes.key?(:'identity')
    self.identity = attributes[:'identity']
  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_method ⇒ Object

Returns the value of attribute answer_fallback_method.



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

def answer_fallback_method
  @answer_fallback_method
end

#answer_fallback_url ⇒ Object

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.



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

def answer_fallback_url
  @answer_fallback_url
end

#answer_method ⇒ Object

Returns the value of attribute answer_method.



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

def answer_method
  @answer_method
end

#answer_url ⇒ Object

The full URL to send the Answer event to when the called party answers. This endpoint should return the first BXML document to be executed in the call. Must use https if specifying username and password.



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

def answer_url
  @answer_url
end

#application_id ⇒ Object

The id of the application associated with the from number.



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

def application_id
  @application_id
end

#call_timeout ⇒ Object

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.



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

def call_timeout
  @call_timeout
end

#callback_timeout ⇒ Object

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.



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

def callback_timeout
  @callback_timeout
end

#disconnect_method ⇒ Object

Returns the value of attribute disconnect_method.



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

def disconnect_method
  @disconnect_method
end

#disconnect_url ⇒ Object

The URL to send the Disconnect event to when the call ends. This event does not expect a BXML response.



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

def disconnect_url
  @disconnect_url
end

#display_name ⇒ Object

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_password ⇒ Object

Basic auth password.



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

def fallback_password
  @fallback_password
end

#fallback_username ⇒ Object

Basic auth username.



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

def fallback_username
  @fallback_username
end

#from ⇒ Object

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

#identity ⇒ Object

A complete SIP Identity header value that you signed yourself. It must be a valid STIR/SHAKEN PASSporT and may not exceed 2000 characters. Bandwidth sends it unmodified on the outbound call and does not sign the call. Bandwidth checks only the format and size of the value, not the signature. Applies to outbound calls to US destinations only. Cannot be combined with requestedAttestationLevel. A request that includes both, or a value that is too long or not in the expected format, is rejected with a 400.



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

def identity
  @identity
end

#machine_detection ⇒ Object

Returns the value of attribute machine_detection.



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

def machine_detection
  @machine_detection
end

#password ⇒ Object

Basic auth password.



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

def password
  @password
end

#priority ⇒ Object

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.



78
79
80
# File 'lib/bandwidth-sdk/models/create_call.rb', line 78

def priority
  @priority
end

#privacy ⇒ Object

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

#requested_attestation_level ⇒ Object

The STIR/SHAKEN attestation level (A, B, or C) you request Bandwidth sign this call with. Applies to outbound calls to US destinations only, and only to accounts that use the Hosted Signing Service; it is ignored for all other accounts. If omitted, the attestation policy configured on your account is used. Cannot be combined with identity. A request that includes both is rejected with a 400, as is any value other than A, B, or C.



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

def requested_attestation_level
  @requested_attestation_level
end

#tag ⇒ Object

A custom string that will be sent with all webhooks for this call unless overwritten by a future <Tag></a> verb or tag attribute on another verb, or cleared. May be cleared by setting tag=\"\" Max length 4096 characters.



81
82
83
# File 'lib/bandwidth-sdk/models/create_call.rb', line 81

def tag
  @tag
end

#username ⇒ Object

Basic auth username.



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

def username
  @username
end

#uui ⇒ Object

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 RFC 7433. 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_map ⇒ Object

Returns attribute mapping this model knows about



135
136
137
# File 'lib/bandwidth-sdk/models/create_call.rb', line 135

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



140
141
142
# File 'lib/bandwidth-sdk/models/create_call.rb', line 140

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/bandwidth-sdk/models/create_call.rb', line 106

def self.attribute_map
  {
    :'to' => :'to',
    :'from' => :'from',
    :'privacy' => :'privacy',
    :'display_name' => :'displayName',
    :'uui' => :'uui',
    :'requested_attestation_level' => :'requestedAttestationLevel',
    :'identity' => :'identity',
    :'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



682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'lib/bandwidth-sdk/models/create_call.rb', line 682

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_nullable ⇒ Object

List of attributes with nullable: true



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/bandwidth-sdk/models/create_call.rb', line 174

def self.openapi_nullable
  Set.new([
    :'privacy',
    :'display_name',
    :'uui',
    :'requested_attestation_level',
    :'identity',
    :'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_types ⇒ Object

Attribute type mapping.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/bandwidth-sdk/models/create_call.rb', line 145

def self.openapi_types
  {
    :'to' => :'String',
    :'from' => :'String',
    :'privacy' => :'Boolean',
    :'display_name' => :'String',
    :'uui' => :'String',
    :'requested_attestation_level' => :'AttestationLevelEnum',
    :'identity' => :'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



639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/bandwidth-sdk/models/create_call.rb', line 639

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 &&
      requested_attestation_level == o.requested_attestation_level &&
      identity == o.identity &&
      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


669
670
671
# File 'lib/bandwidth-sdk/models/create_call.rb', line 669

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



675
676
677
# File 'lib/bandwidth-sdk/models/create_call.rb', line 675

def hash
  [to, from, privacy, display_name, uui, requested_attestation_level, identity, 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_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/bandwidth-sdk/models/create_call.rb', line 328

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

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

  pattern = Regexp.new(/^ *[A-Za-z0-9\-_.+\/=;:<>"][A-Za-z0-9\-_.+\/=;:<>" ]*$/)
  if !@identity.nil? && @identity !~ pattern
    invalid_properties.push("invalid value for \"identity\", must conform to the pattern #{pattern}.")
  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 > 4096
    invalid_properties.push('invalid value for "tag", the character length must be smaller than or equal to 4096.')
  end

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/bandwidth-sdk/models/create_call.rb', line 704

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



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/bandwidth-sdk/models/create_call.rb', line 425

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 !@identity.nil? && @identity.to_s.length > 2000
  return false if !@identity.nil? && @identity.to_s.length < 1
  return false if !@identity.nil? && @identity !~ Regexp.new(/^ *[A-Za-z0-9\-_.+\/=;:<>"][A-Za-z0-9\-_.+\/=;:<>" ]*$/)
  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 > 4096
  true
end