Class: Bandwidth::BandwidthMessage

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

Overview

BandwidthMessage Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, owner = nil, application_id = nil, time = nil, segment_count = nil, direction = nil, to = nil, from = nil, media = nil, text = nil, tag = nil) ⇒ BandwidthMessage

Returns a new instance of BandwidthMessage.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 70

def initialize(id = nil,
               owner = nil,
               application_id = nil,
               time = nil,
               segment_count = nil,
               direction = nil,
               to = nil,
               from = nil,
               media = nil,
               text = nil,
               tag = nil)
  @id = id
  @owner = owner
  @application_id = application_id
  @time = time
  @segment_count = segment_count
  @direction = direction
  @to = to
  @from = from
  @media = media
  @text = text
  @tag = tag
end

Instance Attribute Details

#application_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def application_id
  @application_id
end

#directionString

TODO: Write general description for this method

Returns:

  • (String)


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

def direction
  @direction
end

#fromString

TODO: Write general description for this method

Returns:

  • (String)


39
40
41
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 39

def from
  @from
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


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

def id
  @id
end

#mediaList of String

TODO: Write general description for this method

Returns:

  • (List of String)


43
44
45
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 43

def media
  @media
end

#ownerString

TODO: Write general description for this method

Returns:

  • (String)


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

def owner
  @owner
end

#segment_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def segment_count
  @segment_count
end

#tagString

TODO: Write general description for this method

Returns:

  • (String)


51
52
53
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 51

def tag
  @tag
end

#textString

TODO: Write general description for this method

Returns:

  • (String)


47
48
49
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 47

def text
  @text
end

#timeString

TODO: Write general description for this method

Returns:

  • (String)


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

def time
  @time
end

#toList of String

TODO: Write general description for this method

Returns:

  • (List of String)


35
36
37
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 35

def to
  @to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash['id']
  owner = hash['owner']
  application_id = hash['applicationId']
  time = hash['time']
  segment_count = hash['segmentCount']
  direction = hash['direction']
  to = hash['to']
  from = hash['from']
  media = hash['media']
  text = hash['text']
  tag = hash['tag']

  # Create object from extracted values.
  BandwidthMessage.new(id,
                       owner,
                       application_id,
                       time,
                       segment_count,
                       direction,
                       to,
                       from,
                       media,
                       text,
                       tag)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['owner'] = 'owner'
  @_hash['application_id'] = 'applicationId'
  @_hash['time'] = 'time'
  @_hash['segment_count'] = 'segmentCount'
  @_hash['direction'] = 'direction'
  @_hash['to'] = 'to'
  @_hash['from'] = 'from'
  @_hash['media'] = 'media'
  @_hash['text'] = 'text'
  @_hash['tag'] = 'tag'
  @_hash
end