Class: Mobitex::Response
- Inherits:
-
Object
- Object
- Mobitex::Response
- Defined in:
- lib/mobitex/response.rb
Instance Attribute Summary collapse
-
#statuses ⇒ Object
readonly
Returns the value of attribute statuses.
Class Method Summary collapse
-
.parse(raw_response) ⇒ Object
Public: Parses raw statuses from Mobitex response.
Instance Method Summary collapse
-
#initialize(statuses = []) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(statuses = []) ⇒ Response
Returns a new instance of Response.
27 28 29 |
# File 'lib/mobitex/response.rb', line 27 def initialize(statuses = []) @statuses = statuses end |
Instance Attribute Details
#statuses ⇒ Object (readonly)
Returns the value of attribute statuses.
4 5 6 |
# File 'lib/mobitex/response.rb', line 4 def statuses @statuses end |
Class Method Details
.parse(raw_response) ⇒ Object
Public: Parses raw statuses from Mobitex response.
Examples
response = Mobitex::Response.parse("Status: 001, Id: 3e2dc963309c6b574f6c7467a62ef25b, Number: 123456789\nStatus: 106, Id: 251eb8c426466a149bacf15f6c00eacf, Number: 987654321")
response.statuses.length # => 2
response.statuses.first.status # => '001'
response.statuses.first.id # => '3e2dc963309c6b574f6c7467a62ef25b'
response.statuses.first.number # => '123456789'
Returns Response object.
17 18 19 20 21 22 23 24 25 |
# File 'lib/mobitex/response.rb', line 17 def self.parse(raw_response) statuses = [] raw_response.lines.map do |raw_status| statuses << Status.parse(raw_status) end new(statuses) end |