Class: Smess::Sms
- Inherits:
-
Object
- Object
- Smess::Sms
- Defined in:
- lib/smess/sms.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#originator ⇒ Object
Returns the value of attribute originator.
-
#output ⇒ Object
Returns the value of attribute output.
-
#results ⇒ Object
Returns the value of attribute results.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #deliver ⇒ Object
- #delivered? ⇒ Boolean
-
#initialize(*args) ⇒ Sms
constructor
A new instance of Sms.
Constructor Details
#initialize(*args) ⇒ Sms
Returns a new instance of Sms.
6 7 8 9 10 11 12 |
# File 'lib/smess/sms.rb', line 6 def initialize(*args) opts = args.first || {} @to = opts.fetch(:to, nil) @message = opts.fetch(:message, "") @originator = opts.fetch(:originator, nil) @output = opts.fetch(:output, :auto).to_sym end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/smess/sms.rb', line 4 def @message end |
#originator ⇒ Object
Returns the value of attribute originator.
4 5 6 |
# File 'lib/smess/sms.rb', line 4 def originator @originator end |
#output ⇒ Object
Returns the value of attribute output.
4 5 6 |
# File 'lib/smess/sms.rb', line 4 def output @output end |
#results ⇒ Object
Returns the value of attribute results.
4 5 6 |
# File 'lib/smess/sms.rb', line 4 def results @results end |
#to ⇒ Object
Returns the value of attribute to.
4 5 6 |
# File 'lib/smess/sms.rb', line 4 def to @to end |
Instance Method Details
#deliver ⇒ Object
14 15 16 17 18 |
# File 'lib/smess/sms.rb', line 14 def deliver out = Smess.named_output_instance(output) out.sms = self self.results = {sent_with: output}.merge(out.deliver) end |
#delivered? ⇒ Boolean
20 21 22 |
# File 'lib/smess/sms.rb', line 20 def delivered? results[:response_code] == "0" end |