Sha256: 745384dbc08b104d44ae5ce7275c3db49db94c499bcf73961573bd8539f5e9a2

Contents?: true

Size: 881 Bytes

Versions: 2

Compression:

Stored size: 881 Bytes

Contents

module ActionTexter
  class Message
    include DeliveryMethods
    attr_accessor :from, :to, :cc, :subject, :body, :reference, :delivery_handler
    attr_reader :delivery_method, :delivery_options

    def initialize(attributes = {})
      @from          = attributes[:from]
      @to            = attributes[:to]
      @cc            = attributes[:cc]
      @subject       = attributes[:subject]
      @body          = attributes[:body]
      @reference     = attributes[:reference]
      wrap_delivery_behavior!(self, ActionTexter.config.delivery_method)
    end

    def deliver
      @delivery_method.deliver(self)
      # request.perform if valid?
    end

    def deliver!
      deliver
    end

    def delivery_method(method = nil, opts = {})
      unless method
        @delivery_method
      else
        @delivery_method = method.new(opts)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
action-texter-0.2.1.pre lib/action_texter/message.rb
action-texter-0.2.0.pre lib/action_texter/message.rb