class ActionTexter::Message

Attributes

body[RW]
from[RW]
reference[RW]
to[RW]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/action_texter/message.rb, line 9
def initialize(attributes = {})
  @from          = attributes[:from]
  @to            = attributes[:to]
  @body          = attributes[:body]
  @reference     = attributes[:reference]
end

Public Instance Methods

deliver() click to toggle source
# File lib/action_texter/message.rb, line 20
def deliver
  request.perform if valid?
end
deliver!() click to toggle source
# File lib/action_texter/message.rb, line 24
def deliver!
  deliver if valid?
end
request() click to toggle source
# File lib/action_texter/message.rb, line 16
def request
  Request.new(to_json)
end
to_json() click to toggle source
# File lib/action_texter/message.rb, line 32
def to_json
  JSON.generate(recipients: to,
                originator: from,
                body: body)
end
valid?() click to toggle source
# File lib/action_texter/message.rb, line 28
def valid?
  ActionTexter::Validator::Message.new self
end