Class: RocketSMS::Message
- Inherits:
-
Object
- Object
- RocketSMS::Message
- Defined in:
- lib/rocket_sms/message.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
- #add_pass ⇒ Object
-
#initialize(params) ⇒ Message
constructor
A new instance of Message.
- #method_missing(sym, *args, &block) ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(params) ⇒ Message
Returns a new instance of Message.
6 7 8 9 |
# File 'lib/rocket_sms/message.rb', line 6 def initialize(params) @params = OpenStruct.new(params) @params.pass ||= 0 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
25 26 27 |
# File 'lib/rocket_sms/message.rb', line 25 def method_missing(sym, *args, &block) @params.send(sym, *args, &block) end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/rocket_sms/message.rb', line 4 def params @params end |
Class Method Details
Instance Method Details
#add_pass ⇒ Object
15 16 17 |
# File 'lib/rocket_sms/message.rb', line 15 def add_pass @params.pass += 1 end |
#to_json ⇒ Object
11 12 13 |
# File 'lib/rocket_sms/message.rb', line 11 def to_json MultiJson.dump(@params.marshal_dump) end |