Sha256: 427af7965ed352ef07200975079532de5e51a262225379d5874932af26726aee
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'faraday' module ComicVine class Api module HTTPService class << self attr_accessor :faraday_middleware, :http_options private def faraday_options(options) valid_options = [ :request, :proxy, :ssl, :builder, :url, :parallel_manager, :params, :headers, :builder_class ] Hash[options.select { |key, _| valid_options.include?(key) }] end end self.http_options ||= {} DEFAULT_MIDDLEWARE = proc do |builder| builder.adapter Faraday.default_adapter end def self.make_request(request) connection = Faraday.new( request.server, faraday_options(request.options), &(faraday_middleware || DEFAULT_MIDDLEWARE) ) response = connection.send(request.verb, request.path, request.args) ComicVine::Api::Response.new( status: response.status.to_i, headers: response.headers, body: response.body ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comic_vine-api-0.1.0 | lib/comic_vine/api/http_service.rb |