Sha256: c99b774b49de6896ca7cad03eccca8ad5b1023e5d0fe3d6dd554295806effbdf
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
module Cellular class SMS attr_accessor :recipient, :sender, :message, :price, :country_code 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_code = options[:country_code] || Cellular.config.country_code @delivered = false end def deliver @delivery_status, @delivery_message = @backend.deliver options @delivered = true end def deliver_later Cellular::Jobs::AsyncMessenger.perform_async options end def save(options = {}) raise NotImplementedError end def receive(options = {}) raise NotImplementedError end def delivered? @delivered end def country warn "[DEPRECATION] 'country' is deprecated; use 'country_code' instead" @country_code end def country=(country) warn "[DEPRECATION] 'country' is deprecated; use 'country_code' instead" @country_code = country end private def options { recipient: @recipient, sender: @sender, message: @message, price: @price, country_code: @country_code } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cellular-1.3.0 | lib/cellular/models/sms.rb |