Class: Validic::Response
- Inherits:
-
Object
- Object
- Validic::Response
- Includes:
- Validic::REST::Request
- Defined in:
- lib/validic/response.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
Instance Method Summary collapse
-
#initialize(response, connection = nil) ⇒ Response
constructor
A new instance of Response.
- #next ⇒ Object
- #previous ⇒ Object
Methods included from Validic::REST::Request
Constructor Details
#initialize(response, connection = nil) ⇒ Response
Returns a new instance of Response.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/validic/response.rb', line 8 def initialize(response, connection = nil) @connection = connection @summary = summary_object(response) case resp = response_object(response) when Array @records = resp when Hash @attributes = resp end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/validic/response.rb', line 6 def attributes @attributes end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
6 7 8 |
# File 'lib/validic/response.rb', line 6 def records @records end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
6 7 8 |
# File 'lib/validic/response.rb', line 6 def summary @summary end |
Instance Method Details
#next ⇒ Object
19 20 21 22 23 |
# File 'lib/validic/response.rb', line 19 def next return nil unless next_url = summary.next resp = get(next_url, {}) self.class.new(resp, connection) end |
#previous ⇒ Object
25 26 27 28 29 |
# File 'lib/validic/response.rb', line 25 def previous return nil unless previous_url = summary.previous resp = get(previous_url, {}) self.class.new(resp, connection) end |