Class: Bandwidth::MessageRequest
- Defined in:
- lib/bandwidth/messaging_lib/messaging/models/message_request.rb
Overview
MessageRequest Model.
Instance Attribute Summary collapse
-
#application_id ⇒ String
The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard.
-
#from ⇒ String
One of your telephone numbers the message should come from in E164 format.
-
#media ⇒ List of String
A list of URLs to include as media attachments as part of the message.
-
#priority ⇒ PriorityEnum
The message’s priority, currently for toll-free or short code SMS only.
-
#tag ⇒ String
A custom string that will be included in callback events of the message.
-
#text ⇒ String
The contents of the text message.
-
#to ⇒ List of String
The phone number(s) the message should be sent to in E164 format.
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(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil, priority = nil) ⇒ MessageRequest
constructor
A new instance of MessageRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil, priority = nil) ⇒ MessageRequest
Returns a new instance of MessageRequest.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 54 def initialize(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil, priority = nil) @application_id = application_id @to = to @from = from @text = text @media = media @tag = tag @priority = priority end |
Instance Attribute Details
#application_id ⇒ String
The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard.
12 13 14 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 12 def application_id @application_id end |
#from ⇒ String
One of your telephone numbers the message should come from in E164 format
20 21 22 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 20 def from @from end |
#media ⇒ List of String
A list of URLs to include as media attachments as part of the message.
28 29 30 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 28 def media @media end |
#priority ⇒ PriorityEnum
The message’s priority, currently for toll-free or short code SMS only. Messages with a priority value of ‘“high”` are given preference over your other traffic.
39 40 41 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 39 def priority @priority end |
#tag ⇒ String
A custom string that will be included in callback events of the message. Max 1024 characters
33 34 35 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 33 def tag @tag end |
#text ⇒ String
The contents of the text message. Must be 2048 characters or less.
24 25 26 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 24 def text @text end |
#to ⇒ List of String
The phone number(s) the message should be sent to in E164 format
16 17 18 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 16 def to @to end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. application_id = hash['applicationId'] to = hash['to'] from = hash['from'] text = hash['text'] media = hash['media'] tag = hash['tag'] priority = hash['priority'] # Create object from extracted values. MessageRequest.new(application_id, to, from, text, media, tag, priority) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['application_id'] = 'applicationId' @_hash['to'] = 'to' @_hash['from'] = 'from' @_hash['text'] = 'text' @_hash['media'] = 'media' @_hash['tag'] = 'tag' @_hash['priority'] = 'priority' @_hash end |