Module: Bing::Request
- Defined in:
- lib/bing/request.rb
Overview
Responsible for making requests to Bing. Uses persistent HTTP connections.
Constant Summary collapse
- HTTP =
Net::HTTP::Persistent.new
- USER_AGENT =
"Bing Client Version: #{Bing::VERSION}"
Instance Method Summary collapse
-
#get(uri) ⇒ Object
Perform a get request and ensure that the response.code == 20d, otherwise raise a BadGateway.
Instance Method Details
#get(uri) ⇒ Object
Perform a get request and ensure that the response.code == 20d, otherwise raise a BadGateway.
13 14 15 16 17 18 19 20 |
# File 'lib/bing/request.rb', line 13 def get uri response = HTTP.request uri raise BadGateway.bad_response(response.code, uri) unless response.code =~ /20\d/ response end |