Sha256: 9f4b95a251c6fddec4f792643f382d85494769a9e3829cb908cf3999658f6a5b
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
module Http module Remote module Route extend ActiveSupport::Concern def send_request(verb, route, body) logger = Logger.new 'log/faraday.log' conn = Faraday.new 'https://api.github.com/' do |c| # TODO: Pass host as a parameter # NOTE: The order is **important**! Leave HttpCache first c.use Faraday::HttpCache, store: :file_store, store_options: ['/tmp/faraday'], logger: logger c.use FaradayMiddleware::EncodeJson # query params are not JSON(body) but data are c.use Faraday::Response::Logger, logger c.use Faraday::Adapter::NetHttp end conn.headers[:user_agent] = 'RSpec API' conn.authorization *authorization.flatten sleep 0.5 # TODO: Pass as a parameter @last_response = conn.send verb, route, body do |request| @last_request = request end end def authorization # TODO: Any other way to access metadata in a before(:all) ? self.class.metadata[:rspec_api][:authorization] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-api-0.1.2 | lib/rspec-api/http/remote/route.rb |
rspec-api-0.1.1 | lib/rspec-api/http/remote/route.rb |