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.



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

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

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def description
  @description
end

#error_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def error_code
  @error_code
end

#messageBandwidthMessage

TODO: Write general description for this method

Returns:



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

def message
  @message
end

#timeString

TODO: Write general description for this method

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 11

def time
  @time
end

#toString

TODO: Write general description for this method

Returns:

  • (String)


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

def to
  @to
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  time = hash['time']
  type = hash['type']
  to = hash['to']
  error_code = hash['errorCode']
  description = hash['description']
  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.



34
35
36
37
38
39
40
41
42
43
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb', line 34

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