Class: RAWS::HTTP::Typhoeus

Inherits:
Object
  • Object
show all
Defined in:
lib/raws/http/typhoeus.rb

Defined Under Namespace

Classes: Request, Response

Class Method Summary collapse

Class Method Details

.connect(uri, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/raws/http/typhoeus.rb', line 5

def self.connect(uri, &block)
  response = nil
  begin
    response = block.call(Request.new(uri))
  rescue RAWS::HTTP::Redirect => e
    r = e.response
    uri = r.header['location'] || r.doc['Error']['Endpoint']
    retry
  end
  response
end