Sha256: e00b46425969806eaf2aeebfdfde12fd6a99934551bfc5fe1345b667d41108ad
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
module CmSms class Messenger attr_accessor :from, :to, :body, :dcs def initialize(attributes = {}) self.class.default_params ||= {} @from = attributes[:from] || self.class.default_params[:from] @to = attributes[:to] || self.class.default_params[:to] @dcs = attributes[:dcs] || self.class.default_params[:dcs] @body = attributes[:body] end def content(attributes = {}) attributes.each { |attr, value| send("#{attr}=", value) } self end def message @message ||= CmSms::Message.new(from: from, to: to, dcs: dcs, body: body) end def self.method_missing(method_name, *args) # :nodoc: if new.respond_to?(method_name.to_s) CmSms::MessageDelivery.new(self, method_name, *args) else super end end def self.respond_to_missing?(method_name, *args) # :nodoc: new.respond_to?(method_name.to_s) || super end def self.default_params @@default_params ||= CmSms.config.defaults end def self.default_params=(params = {}) @@default_params = params end def self.default(hash = {}) self.default_params = CmSms.config.defaults.merge(hash).freeze default_params end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cm-sms-0.1.1 | lib/cm_sms/messenger.rb |
cm-sms-0.1.0 | lib/cm_sms/messenger.rb |