Sha256: 184dd9d60f2eaa7bdd3a6829091d437954e6dc131bba5dfbf1750f83c5239acd
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module ActionTexter class Messenger attr_accessor :from, :to, :body, :subject, :reference def initialize(attributes = {}) self.class.default_params ||= {} end def content(attributes = {}) # override with defaults attributes = attributes.merge( self.class.default_params ).freeze attributes.each { |attr, value| send("#{attr}=", value) } self end def message @message ||= ActionTexter::Message.new(from: from, to: to, subject: subject, body: body, reference: reference) end def self.method_missing(method_name, *args) # :nodoc: if new.respond_to?(method_name.to_s) ActionTexter::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 ||= ActionTexter.config.defaults end def self.default_params=(params = {}) @@default_params = params end def self.default(hash = {}) self.default_params = ActionTexter.config.defaults.merge(hash).freeze default_params end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
action-texter-0.2.1.pre | lib/action_texter/messenger.rb |
action-texter-0.2.0.pre | lib/action_texter/messenger.rb |