Class: CmSms::Messenger
- Inherits:
-
Object
- Object
- CmSms::Messenger
- Defined in:
- lib/cm_sms/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.
6 7 8 9 10 11 12 13 14 |
# File 'lib/cm_sms/messenger.rb', line 6 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] @reference = attributes[:reference] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/cm_sms/messenger.rb', line 4 def body @body end |
#dcs ⇒ Object
Returns the value of attribute dcs.
4 5 6 |
# File 'lib/cm_sms/messenger.rb', line 4 def dcs @dcs end |
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/cm_sms/messenger.rb', line 4 def from @from end |
#reference ⇒ Object
Returns the value of attribute reference.
4 5 6 |
# File 'lib/cm_sms/messenger.rb', line 4 def reference @reference end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/cm_sms/messenger.rb', line 4 def to @to end |
Class Method Details
.default(hash = {}) ⇒ Object
45 46 47 48 |
# File 'lib/cm_sms/messenger.rb', line 45 def self.default(hash = {}) self.default_params = CmSms.config.defaults.merge(hash).freeze default_params end |
.default_params ⇒ Object
37 38 39 |
# File 'lib/cm_sms/messenger.rb', line 37 def self.default_params @@default_params ||= CmSms.config.defaults end |
.default_params=(params = {}) ⇒ Object
41 42 43 |
# File 'lib/cm_sms/messenger.rb', line 41 def self.default_params=(params = {}) @@default_params = params end |
.method_missing(method_name, *args) ⇒ Object
:nodoc:
25 26 27 28 29 30 31 |
# File 'lib/cm_sms/messenger.rb', line 25 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 |
.respond_to_missing?(method_name, *args) ⇒ Boolean
:nodoc:
33 34 35 |
# File 'lib/cm_sms/messenger.rb', line 33 def self.respond_to_missing?(method_name, *args) # :nodoc: new.respond_to?(method_name.to_s) || super end |
Instance Method Details
#content(attributes = {}) ⇒ Object
16 17 18 19 |
# File 'lib/cm_sms/messenger.rb', line 16 def content(attributes = {}) attributes.each { |attr, value| send("#{attr}=", value) } self end |