class Bandwidth::MessageRequest

MessageRequest Model.

Attributes

application_id[RW]

The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. @return [String]

from[RW]

One of your telephone numbers the message should come from in E164 format @return [String]

media[RW]

A list of URLs to include as media attachments as part of the message. @return [List of String]

priority[RW]

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. @return [PriorityEnum]

tag[RW]

A custom string that will be included in callback events of the message. Max 1024 characters @return [String]

text[RW]

The contents of the text message. Must be 2048 characters or less. @return [String]

to[RW]

The phone number(s) the message should be sent to in E164 format @return [List of String]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# 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() click to toggle source

A mapping from model property names to API property names.

# 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
new(application_id = nil, to = nil, from = nil, text = nil, media = nil, tag = nil, priority = nil) click to toggle source
# 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