Sha256: 04014bfa78bdd0e4cc10187d37e6262057f09443ec678c2361477643ed6504ac

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

module Cellular
  class SMS

    attr_accessor :recipient, :sender, :message, :price, :country

    def initialize(options = {})
      @backend = Cellular.config.backend

      @recipient = options[:recipient]
      @sender = options[:sender] || Cellular.config.sender
      @message = options[:message]
      @price = options[:price] || Cellular.config.price
      @country = options[:country] || Cellular.config.country_code

      @delivered = false
    end

    def deliver
      @delivery_status, @delivery_message = @backend.deliver(
        recipient: @recipient,
        sender: @sender,
        price: @price,
        country: @country,
        message: @message
      )

      @delivered = true
    end

    def save(options = {})
      raise NotImplementedError
    end

    def receive(options = {})
      raise NotImplementedError
    end

    def delivered?
      @delivered
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cellular-1.2.0 lib/cellular/models/sms.rb