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.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
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.
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 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 105 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 unless id == SKIP @owner = owner unless owner == SKIP @application_id = application_id unless application_id == SKIP @time = time unless time == SKIP @segment_count = segment_count unless segment_count == SKIP @direction = direction unless direction == SKIP @to = to unless to == SKIP @from = from unless from == SKIP @media = media unless media == SKIP @text = text unless text == SKIP @tag = tag unless tag == SKIP @priority = priority unless priority == SKIP end |
Instance Attribute Details
#application_id ⇒ String
The application ID associated with the message
22 23 24 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 22 def application_id @application_id end |
#direction ⇒ String
The direction of the message relative to Bandwidth. Can be in or out
35 36 37 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 35 def direction @direction end |
#from ⇒ String
The phone number the message was sent from
43 44 45 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 43 def from @from end |
#id ⇒ String
The id of the message
14 15 16 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 14 def id @id end |
#media ⇒ List of String
The list of media URLs sent in the message. Including a ‘filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name.
50 51 52 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 50 def media @media end |
#owner ⇒ String
The Bandwidth phone number associated with the message
18 19 20 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 18 def owner @owner end |
#priority ⇒ String
The priority specified by the user
62 63 64 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 62 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
31 32 33 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 31 def segment_count @segment_count end |
#tag ⇒ String
The custom string set by the user
58 59 60 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 58 def tag @tag end |
#text ⇒ String
The contents of the message
54 55 56 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 54 def text @text end |
#time ⇒ String
The datetime stamp of the message in ISO 8601
26 27 28 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 26 def time @time end |
#to ⇒ List of String
The phone number recipients of the message
39 40 41 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 39 def to @to end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 132 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP owner = hash.key?('owner') ? hash['owner'] : SKIP application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP time = hash.key?('time') ? hash['time'] : SKIP segment_count = hash.key?('segmentCount') ? hash['segmentCount'] : SKIP direction = hash.key?('direction') ? hash['direction'] : SKIP to = hash.key?('to') ? hash['to'] : SKIP from = hash.key?('from') ? hash['from'] : SKIP media = hash.key?('media') ? hash['media'] : SKIP text = hash.key?('text') ? hash['text'] : SKIP tag = hash.key?('tag') ? hash['tag'] : SKIP priority = hash.key?('priority') ? hash['priority'] : SKIP # 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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 65 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 |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
101 102 103 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 101 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb', line 83 def optionals %w[ id owner application_id time segment_count direction to from media text tag priority ] end |