Class: Bandwidth::Diversion

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/voice_lib/voice/models/diversion.rb

Overview

Diversion Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(reason = nil, privacy = nil, unknown = nil, orig_to = nil) ⇒ Diversion

Returns a new instance of Diversion.



53
54
55
56
57
58
59
60
61
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 53

def initialize(reason = nil,
               privacy = nil,
               unknown = nil,
               orig_to = nil)
  @reason = reason unless reason == SKIP
  @privacy = privacy unless privacy == SKIP
  @unknown = unknown unless unknown == SKIP
  @orig_to = orig_to unless orig_to == SKIP
end

Instance Attribute Details

#orig_toString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 26

def orig_to
  @orig_to
end

#privacyString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 18

def privacy
  @privacy
end

#reasonString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 14

def reason
  @reason
end

#unknownString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 22

def unknown
  @unknown
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  privacy = hash.key?('privacy') ? hash['privacy'] : SKIP
  unknown = hash.key?('unknown') ? hash['unknown'] : SKIP
  orig_to = hash.key?('origTo') ? hash['origTo'] : SKIP

  # Create object from extracted values.
  Diversion.new(reason,
                privacy,
                unknown,
                orig_to)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reason'] = 'reason'
  @_hash['privacy'] = 'privacy'
  @_hash['unknown'] = 'unknown'
  @_hash['orig_to'] = 'origTo'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



49
50
51
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 49

def nullables
  []
end

#optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/bandwidth/voice_lib/voice/models/diversion.rb', line 39

def optionals
  %w[
    reason
    privacy
    unknown
    orig_to
  ]
end