Class: VoicecomSms::Response
- Inherits:
-
Object
- Object
- VoicecomSms::Response
- Defined in:
- lib/voicecom_sms/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(raw_response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(raw_response) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 |
# File 'lib/voicecom_sms/response.rb', line 5 def initialize(raw_response) @raw_response = raw_response @status = raw_response.status @body = raw_response.body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/voicecom_sms/response.rb', line 3 def body @body end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/voicecom_sms/response.rb', line 3 def @message end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/voicecom_sms/response.rb', line 3 def status @status end |
Instance Method Details
#success? ⇒ Boolean
11 12 13 14 |
# File 'lib/voicecom_sms/response.rb', line 11 def success? return false unless @raw_response @raw_response.success? && @body =~ /SEND_OK/ && @body !~ /ERROR/ end |