Class: Net::SMS::BulkSMS::Response
- Inherits:
-
Object
- Object
- Net::SMS::BulkSMS::Response
- Defined in:
- lib/net/sms/bulksms/response.rb
Overview
A response sent by the BulkSMS gateway
Instance Attribute Summary collapse
-
#batch_id ⇒ Object
readonly
Returns the value of attribute batch_id.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, description, batch_id) ⇒ Response
constructor
A new instance of Response.
-
#successful? ⇒ Boolean
Was the original request successful?.
Constructor Details
#initialize(code, description, batch_id) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 |
# File 'lib/net/sms/bulksms/response.rb', line 9 def initialize(code, description, batch_id) @code = code @description = description @batch_id = batch_id end |
Instance Attribute Details
#batch_id ⇒ Object (readonly)
Returns the value of attribute batch_id.
7 8 9 |
# File 'lib/net/sms/bulksms/response.rb', line 7 def batch_id @batch_id end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/net/sms/bulksms/response.rb', line 7 def code @code end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/net/sms/bulksms/response.rb', line 7 def description @description end |
Class Method Details
.parse(response_text) ⇒ Object
15 16 17 18 |
# File 'lib/net/sms/bulksms/response.rb', line 15 def self.parse(response_text) tokens = response_text.split('|') self.new tokens[0].to_i, tokens[1], tokens[2].to_i end |
Instance Method Details
#successful? ⇒ Boolean
Was the original request successful?
21 22 23 |
# File 'lib/net/sms/bulksms/response.rb', line 21 def successful? (@code == 0) ? true : false end |