Class: Scrapinghub::ApiResponse
- Inherits:
-
Object
- Object
- Scrapinghub::ApiResponse
- Defined in:
- lib/scrapinghub/api_response.rb
Instance Method Summary collapse
-
#initialize(net_http_request) ⇒ ApiResponse
constructor
A new instance of ApiResponse.
- #response ⇒ Object
Constructor Details
#initialize(net_http_request) ⇒ ApiResponse
Returns a new instance of ApiResponse.
5 6 7 8 9 10 11 12 |
# File 'lib/scrapinghub/api_response.rb', line 5 def initialize(net_http_request) case net_http_request when Net::HTTPOK @body = JSON.parse(net_http_request.body) else raise "Invalid Net:HTTP request sent to ApiResponse" end end |
Instance Method Details
#response ⇒ Object
14 15 16 |
# File 'lib/scrapinghub/api_response.rb', line 14 def response @body end |