Class: Bandwidth::CreateCall

Inherits:
Object
  • Object
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

Constructor Details

#initialize(attributes = {}) ⇒ CreateCall

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
296
297
298
# File 'lib/bandwidth-sdk/models/create_call.rb', line 182

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
  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::CreateCall`. 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?(:'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’ and ‘base64’ 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

._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



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
# File 'lib/bandwidth-sdk/models/create_call.rb', line 613

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



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

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



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

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



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

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.



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

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



548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/bandwidth-sdk/models/create_call.rb', line 548

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

#_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



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

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


576
577
578
# File 'lib/bandwidth-sdk/models/create_call.rb', line 576

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



582
583
584
# File 'lib/bandwidth-sdk/models/create_call.rb', line 582

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



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

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_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



660
661
662
# File 'lib/bandwidth-sdk/models/create_call.rb', line 660

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



666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/bandwidth-sdk/models/create_call.rb', line 666

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



654
655
656
# File 'lib/bandwidth-sdk/models/create_call.rb', line 654

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



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/bandwidth-sdk/models/create_call.rb', line 386

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