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.
-
#expiration ⇒ String
A string with the date/time value that the message will automatically expire by.
-
#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, expiration = nil) ⇒ MessageRequest
constructor
A new instance of MessageRequest.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#initialize(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil, priority = nil, expiration = nil) ⇒ MessageRequest
Returns a new instance of MessageRequest.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 79 def initialize(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil, priority = nil, expiration = nil) @application_id = application_id unless application_id == SKIP @to = to unless to == SKIP @from = from unless from == SKIP @text = text unless text == SKIP @media = media unless media == SKIP @tag = tag unless tag == SKIP @priority = priority unless priority == SKIP @expiration = expiration unless expiration == SKIP end |
Instance Attribute Details
#application_id ⇒ String
The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard.
15 16 17 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 15 def application_id @application_id end |
#expiration ⇒ String
A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00.
47 48 49 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 47 def expiration @expiration end |
#from ⇒ String
One of your telephone numbers the message should come from in E164 format
23 24 25 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 23 def from @from end |
#media ⇒ List of String
A list of URLs to include as media attachments as part of the message.
31 32 33 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 31 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.
42 43 44 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 42 def priority @priority end |
#tag ⇒ String
A custom string that will be included in callback events of the message. Max 1024 characters
36 37 38 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 36 def tag @tag end |
#text ⇒ String
The contents of the text message. Must be 2048 characters or less.
27 28 29 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 27 def text @text end |
#to ⇒ List of String
The phone number(s) the message should be sent to in E164 format
19 20 21 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 19 def to @to end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 98 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP to = hash.key?('to') ? hash['to'] : SKIP from = hash.key?('from') ? hash['from'] : SKIP text = hash.key?('text') ? hash['text'] : SKIP media = hash.key?('media') ? hash['media'] : SKIP tag = hash.key?('tag') ? hash['tag'] : SKIP priority = hash.key?('priority') ? hash['priority'] : SKIP expiration = hash.key?('expiration') ? hash['expiration'] : SKIP # Create object from extracted values. MessageRequest.new(application_id, to, from, text, media, tag, priority, expiration) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 50 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['expiration'] = 'expiration' @_hash end |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 75 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 |
# File 'lib/bandwidth/messaging_lib/messaging/models/message_request.rb', line 64 def optionals %w[ text media tag priority expiration ] end |