Class: Bulksms::Response
- Inherits:
-
Object
- Object
- Bulksms::Response
- Defined in:
- lib/bulksms/response.rb
Instance Attribute Summary collapse
-
#batch_id ⇒ Object
readonly
Returns the value of attribute batch_id.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, result, batch_id) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(code, result, batch_id) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 |
# File 'lib/bulksms/response.rb', line 6 def initialize(code, result, batch_id) @code = code @result = result @batch_id = batch_id end |
Instance Attribute Details
#batch_id ⇒ Object (readonly)
Returns the value of attribute batch_id.
4 5 6 |
# File 'lib/bulksms/response.rb', line 4 def batch_id @batch_id end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/bulksms/response.rb', line 4 def code @code end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/bulksms/response.rb', line 4 def result @result end |
Class Method Details
.parse(response_text) ⇒ Object
16 17 18 19 |
# File 'lib/bulksms/response.rb', line 16 def self.parse(response_text) tokens = response_text.split('|') new tokens[0].to_i, tokens[1], tokens[2].to_i end |
Instance Method Details
#success? ⇒ Boolean
12 13 14 |
# File 'lib/bulksms/response.rb', line 12 def success? @code == 0 end |