Class: Bandwidth::BandwidthCallbackMessage

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb

Overview

BandwidthCallbackMessage Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(time = nil, type = nil, to = nil, error_code = nil, description = nil, message = nil) ⇒ BandwidthCallbackMessage

Returns a new instance of BandwidthCallbackMessage.



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 65

def initialize(time = nil,
               type = nil,
               to = nil,
               error_code = nil,
               description = nil,
               message = nil)
  @time = time unless time == SKIP
  @type = type unless type == SKIP
  @to = to unless to == SKIP
  @error_code = error_code unless error_code == SKIP
  @description = description unless description == SKIP
  @message = message unless message == SKIP
end

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 30

def description
  @description
end

#error_codeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 26

def error_code
  @error_code
end

#messageBandwidthMessage

TODO: Write general description for this method

Returns:



34
35
36
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 34

def message
  @message
end

#timeString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 14

def time
  @time
end

#toString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 22

def to
  @to
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 18

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  time = hash.key?('time') ? hash['time'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  to = hash.key?('to') ? hash['to'] : SKIP
  error_code = hash.key?('errorCode') ? hash['errorCode'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  message = BandwidthMessage.from_hash(hash['message']) if hash['message']

  # Create object from extracted values.
  BandwidthCallbackMessage.new(time,
                               type,
                               to,
                               error_code,
                               description,
                               message)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['time'] = 'time'
  @_hash['type'] = 'type'
  @_hash['to'] = 'to'
  @_hash['error_code'] = 'errorCode'
  @_hash['description'] = 'description'
  @_hash['message'] = 'message'
  @_hash
end

Instance Method Details

#nullablesObject

An array for nullable fields



61
62
63
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 61

def nullables
  []
end

#optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 49

def optionals
  %w[
    time
    type
    to
    error_code
    description
    message
  ]
end