Class: ActionTexter::Messenger
- Inherits:
-
Object
- Object
- ActionTexter::Messenger
- Defined in:
- lib/action_texter/messenger.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#dcs ⇒ Object
Returns the value of attribute dcs.
-
#from ⇒ Object
Returns the value of attribute from.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#to ⇒ Object
Returns the value of attribute to.
Class Method Summary collapse
- .default(hash = {}) ⇒ Object
- .default_params ⇒ Object
- .default_params=(params = {}) ⇒ Object
-
.method_missing(method_name, *args) ⇒ Object
:nodoc:.
-
.respond_to_missing?(method_name, *args) ⇒ Boolean
:nodoc:.
Instance Method Summary collapse
- #content(attributes = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Messenger
constructor
A new instance of Messenger.
- #message ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Messenger
Returns a new instance of Messenger.
5 6 7 8 9 10 11 12 |
# File 'lib/action_texter/messenger.rb', line 5 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 |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/action_texter/messenger.rb', line 3 def body @body end |
#dcs ⇒ Object
Returns the value of attribute dcs.
3 4 5 |
# File 'lib/action_texter/messenger.rb', line 3 def dcs @dcs end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/action_texter/messenger.rb', line 3 def from @from end |
#reference ⇒ Object
Returns the value of attribute reference.
3 4 5 |
# File 'lib/action_texter/messenger.rb', line 3 def reference @reference end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/action_texter/messenger.rb', line 3 def to @to end |
Class Method Details
.default(hash = {}) ⇒ Object
43 44 45 46 |
# File 'lib/action_texter/messenger.rb', line 43 def self.default(hash = {}) self.default_params = ActionTexter.config.defaults.merge(hash).freeze default_params end |
.default_params ⇒ Object
35 36 37 |
# File 'lib/action_texter/messenger.rb', line 35 def self.default_params @@default_params ||= ActionTexter.config.defaults end |
.default_params=(params = {}) ⇒ Object
39 40 41 |
# File 'lib/action_texter/messenger.rb', line 39 def self.default_params=(params = {}) @@default_params = params end |
.method_missing(method_name, *args) ⇒ Object
:nodoc:
23 24 25 26 27 28 29 |
# File 'lib/action_texter/messenger.rb', line 23 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 |
.respond_to_missing?(method_name, *args) ⇒ Boolean
:nodoc:
31 32 33 |
# File 'lib/action_texter/messenger.rb', line 31 def self.respond_to_missing?(method_name, *args) # :nodoc: new.respond_to?(method_name.to_s) || super end |
Instance Method Details
#content(attributes = {}) ⇒ Object
14 15 16 17 |
# File 'lib/action_texter/messenger.rb', line 14 def content(attributes = {}) attributes.each { |attr, value| send("#{attr}=", value) } self end |
#message ⇒ Object
19 20 21 |
# File 'lib/action_texter/messenger.rb', line 19 def @message ||= ActionTexter::Message.new(from: from, to: to, dcs: dcs, body: body, reference: reference) end |