Sha256: 4501937f78f5edcb5c8e6c2e800615721527053d8ac13c029f9bc1730ca46005
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
require 'faraday' module Rapidash module HTTPClient attr_accessor :site attr_writer :connection def site=(value) @connection = nil @site = value end def connection @connection ||= Faraday.new(site) end def request(verb, url, options = {}) url = connection.build_url(url, options[:params]).to_s response = connection.run_request(verb, url, options[:body], options[:header]) # "foo"[0] does not work in 1.8.7, "foo"[0,1] is required case response.status.to_s[0,1] #Handle redirects when "3" request(verb, response.headers["location"], options) when "2" return Response.new(response) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rapidash-0.0.2 | lib/rapidash/http_client.rb |