Class: Loqate::APIResult
- Inherits:
-
Object
- Object
- Loqate::APIResult
- Defined in:
- lib/loqate/api_result.rb
Overview
Generic response of a request to Loqate’s API
Instance Attribute Summary collapse
-
#items ⇒ Array<Hash>
readonly
Array of hashes representing each item in the response body.
Instance Method Summary collapse
-
#errors? ⇒ Boolean
Whether the response contains errors.
-
#initialize(items) ⇒ APIResult
constructor
Instantiates a new API result.
Constructor Details
#initialize(items) ⇒ APIResult
Instantiates a new API result
14 15 16 |
# File 'lib/loqate/api_result.rb', line 14 def initialize(items) @items = items end |
Instance Attribute Details
#items ⇒ Array<Hash> (readonly)
Array of hashes representing each item in the response body
8 9 10 |
# File 'lib/loqate/api_result.rb', line 8 def items @items end |
Instance Method Details
#errors? ⇒ Boolean
Whether the response contains errors
22 23 24 |
# File 'lib/loqate/api_result.rb', line 22 def errors? !items.dig(0, 'Error').nil? end |