lib/action_texter/messenger.rb in action-texter-0.1.2.ALPHA vs lib/action_texter/messenger.rb in action-texter-0.2.0.pre
- old
+ new
@@ -1,24 +1,21 @@
module ActionTexter
class Messenger
- attr_accessor :from, :to, :body, :dcs, :reference
+ attr_accessor :from, :to, :body, :subject, :reference
def initialize(attributes = {})
self.class.default_params ||= {}
-
- @from = attributes[:from] || self.class.default_params[:from]
- @to = attributes[:to] || self.class.default_params[:to]
- @body = attributes[:body]
- @reference = attributes[:reference]
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, dcs: dcs, body: body, reference: reference)
+ @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)