Class: Bandwidth::BandwidthMessage
- Defined in:
- lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb
Overview
BandwidthMessage Model.
Instance Attribute Summary collapse
-
#application_id ⇒ String
The application ID associated with the message.
-
#direction ⇒ String
The direction of the message relative to Bandwidth.
-
#from ⇒ String
The phone number the message was sent from.
-
#id ⇒ String
The id of the message.
-
#media ⇒ List of String
The list of media URLs sent in the message.
-
#owner ⇒ String
The Bandwidth phone number associated with the message.
-
#priority ⇒ String
The priority specified by the user.
-
#segment_count ⇒ Integer
The number of segments the original message from the user is broken into before sending over to carrier networks.
-
#tag ⇒ String
The custom string set by the user.
-
#text ⇒ String
The contents of the message.
-
#time ⇒ String
The datetime stamp of the message in ISO 8601.
-
#to ⇒ List of String
The phone number recipients of the message.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#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, priority = nil) ⇒ BandwidthMessage
constructor
A new instance of BandwidthMessage.
Methods inherited from BaseModel
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, priority = nil) ⇒ BandwidthMessage
Returns a new instance of BandwidthMessage.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 76 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, priority = 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 @priority = priority end |
Instance Attribute Details
#application_id ⇒ String
The application ID associated with the message
19 20 21 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 19 def application_id @application_id end |
#direction ⇒ String
The direction of the message relative to Bandwidth. Can be in or out
32 33 34 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 32 def direction @direction end |
#from ⇒ String
The phone number the message was sent from
40 41 42 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 40 def from @from end |
#id ⇒ String
The id of the message
11 12 13 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 11 def id @id end |
#media ⇒ List of String
The list of media URLs sent in the message
44 45 46 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 44 def media @media end |
#owner ⇒ String
The Bandwidth phone number associated with the message
15 16 17 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 15 def owner @owner end |
#priority ⇒ String
The priority specified by the user
56 57 58 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 56 def priority @priority end |
#segment_count ⇒ Integer
The number of segments the original message from the user is broken into before sending over to carrier networks
28 29 30 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 28 def segment_count @segment_count end |
#tag ⇒ String
The custom string set by the user
52 53 54 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 52 def tag @tag end |
#text ⇒ String
The contents of the message
48 49 50 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 48 def text @text end |
#time ⇒ String
The datetime stamp of the message in ISO 8601
23 24 25 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 23 def time @time end |
#to ⇒ List of String
The phone number recipients of the message
36 37 38 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 36 def to @to end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 103 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'] priority = hash['priority'] # Create object from extracted values. BandwidthMessage.new(id, owner, application_id, time, segment_count, direction, to, from, media, text, tag, priority) end |
.names ⇒ Object
A mapping from model property names to API property names.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 59 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['priority'] = 'priority' @_hash end |