Class: ActiveScraper::FakeHTTPartyResponse
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ActiveScraper::FakeHTTPartyResponse
- Defined in:
- lib/active_scraper/fake_http_party_response.rb
Instance Method Summary collapse
-
#initialize(request, response, parsed_block = nil, options = {}) ⇒ FakeHTTPartyResponse
constructor
A new instance of FakeHTTPartyResponse.
Constructor Details
#initialize(request, response, parsed_block = nil, options = {}) ⇒ FakeHTTPartyResponse
Returns a new instance of FakeHTTPartyResponse.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/active_scraper/fake_http_party_response.rb', line 7 def initialize(request, response, parsed_block=nil, ={}) request = request.to_fake_party_hash if request.is_a?(CachedRequest) response = response.to_fake_party_hash if response.is_a?(CachedResponse) ## making HTTParty happy... parsed_block ||= ->(){ response.body } super(HTTParty::Response.new request, response, parsed_block, ) end |