Class: Yelp4r::Response
- Inherits:
-
Object
- Object
- Yelp4r::Response
- Defined in:
- lib/yelp4r/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
- #data ⇒ Object
- #error_message ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #response_code ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/yelp4r/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/yelp4r/response.rb', line 4 def body @body end |
Instance Method Details
#data ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/yelp4r/response.rb', line 22 def data if !@body.businesses.blank? @body.businesses elsif !@body.neighborhoods.blank? @body.neighborhoods end end |
#error_message ⇒ Object
18 19 20 |
# File 'lib/yelp4r/response.rb', line 18 def @body..text unless success? end |
#response_code ⇒ Object
10 11 12 |
# File 'lib/yelp4r/response.rb', line 10 def response_code @body..code end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/yelp4r/response.rb', line 14 def success? response_code == 0 end |