class Bandwidth::BandwidthMessage

BandwidthMessage Model.

Attributes

application_id[RW]

The application ID associated with the message @return [String]

direction[RW]

The direction of the message relative to Bandwidth. Can be in or out @return [String]

from[RW]

The phone number the message was sent from @return [String]

id[RW]

The id of the message @return [String]

media[RW]

The list of media URLs sent in the message @return [List of String]

owner[RW]

The Bandwidth phone number associated with the message @return [String]

priority[RW]

The priority specified by the user @return [String]

segment_count[RW]

The number of segments the original message from the user is broken into before sending over to carrier networks @return [Integer]

tag[RW]

The custom string set by the user @return [String]

text[RW]

The contents of the message @return [String]

time[RW]

The datetime stamp of the message in ISO 8601 @return [String]

to[RW]

The phone number recipients of the message @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/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() click to toggle source

A mapping from model property names to API property names.

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