Class: Skuby::SMSResponse
- Inherits:
-
Object
- Object
- Skuby::SMSResponse
- Defined in:
- lib/skuby/sms_response.rb
Instance Attribute Summary collapse
-
#recipients ⇒ Object
readonly
Returns the value of attribute recipients.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #error_code ⇒ Object
- #error_message ⇒ Object
-
#initialize(response, text, recipients) ⇒ SMSResponse
constructor
A new instance of SMSResponse.
- #remaining_sms ⇒ Object
- #sms_id ⇒ Object
- #sms_id? ⇒ Boolean
- #status ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response, text, recipients) ⇒ SMSResponse
Returns a new instance of SMSResponse.
5 6 7 8 9 |
# File 'lib/skuby/sms_response.rb', line 5 def initialize(response, text, recipients) @response = CGI.parse(response) @text = text @recipients = Array(recipients) end |
Instance Attribute Details
#recipients ⇒ Object (readonly)
Returns the value of attribute recipients.
3 4 5 |
# File 'lib/skuby/sms_response.rb', line 3 def recipients @recipients end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/skuby/sms_response.rb', line 3 def response @response end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/skuby/sms_response.rb', line 3 def text @text end |
Instance Method Details
#error_code ⇒ Object
31 32 33 |
# File 'lib/skuby/sms_response.rb', line 31 def error_code @response["code"].first.to_i end |
#error_message ⇒ Object
35 36 37 |
# File 'lib/skuby/sms_response.rb', line 35 def @response["message"].first end |
#remaining_sms ⇒ Object
23 24 25 |
# File 'lib/skuby/sms_response.rb', line 23 def remaining_sms @response["remaining_sms"].first.to_i end |
#sms_id ⇒ Object
27 28 29 |
# File 'lib/skuby/sms_response.rb', line 27 def sms_id @response["id"].first end |
#sms_id? ⇒ Boolean
15 16 17 |
# File 'lib/skuby/sms_response.rb', line 15 def sms_id? !sms_id.nil? end |
#status ⇒ Object
19 20 21 |
# File 'lib/skuby/sms_response.rb', line 19 def status @response["status"].first end |
#success? ⇒ Boolean
11 12 13 |
# File 'lib/skuby/sms_response.rb', line 11 def success? status == "success" end |