Class: Factual::PlacesResponse
- Inherits:
-
Object
- Object
- Factual::PlacesResponse
- Defined in:
- lib/factual/places_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
- #data ⇒ Object
- #error? ⇒ Boolean
- #error_message ⇒ Object
- #error_type ⇒ Object
- #included_rows ⇒ Object
-
#initialize(response) ⇒ PlacesResponse
constructor
A new instance of PlacesResponse.
- #resolved? ⇒ Boolean
- #resolved_venue ⇒ Object
- #status ⇒ Object
- #success? ⇒ Boolean
- #total_rows ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(response) ⇒ PlacesResponse
Returns a new instance of PlacesResponse.
6 7 8 |
# File 'lib/factual/places_response.rb', line 6 def initialize(response) @body = rash_response(response) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/factual/places_response.rb', line 4 def body @body end |
Instance Method Details
#data ⇒ Object
42 43 44 45 46 |
# File 'lib/factual/places_response.rb', line 42 def data if !@body.response.data.blank? @body.response.data end end |
#error? ⇒ Boolean
22 23 24 |
# File 'lib/factual/places_response.rb', line 22 def error? @body.status == "error" end |
#error_message ⇒ Object
26 27 28 |
# File 'lib/factual/places_response.rb', line 26 def @body. if error? end |
#error_type ⇒ Object
30 31 32 |
# File 'lib/factual/places_response.rb', line 30 def error_type @body.error_type if error? end |
#included_rows ⇒ Object
34 35 36 |
# File 'lib/factual/places_response.rb', line 34 def included_rows @body.included_rows end |
#resolved? ⇒ Boolean
48 49 50 |
# File 'lib/factual/places_response.rb', line 48 def resolved? success? && data.present? && data[0].resolved end |
#resolved_venue ⇒ Object
52 53 54 |
# File 'lib/factual/places_response.rb', line 52 def resolved_venue data[0] if resolved? end |
#status ⇒ Object
14 15 16 |
# File 'lib/factual/places_response.rb', line 14 def status @body.status end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/factual/places_response.rb', line 18 def success? @body.status == "ok" end |
#total_rows ⇒ Object
38 39 40 |
# File 'lib/factual/places_response.rb', line 38 def total_rows @body.total_row_count end |
#version ⇒ Object
10 11 12 |
# File 'lib/factual/places_response.rb', line 10 def version @body.version end |