class Bestgems::Client
Public Instance Methods
agent()
click to toggle source
# File lib/bestgems/client.rb, line 24 def agent @agent ||= ::Faraday.new do |http| http.request :url_encoded # http.response :logger http.adapter :net_http end end
get(url, **opts)
click to toggle source
# File lib/bestgems/client.rb, line 10 def get(url, **opts) request :get, url, opts end
request(method, path, **opts)
click to toggle source
# File lib/bestgems/client.rb, line 14 def request(method, path, **opts) response = agent.send(method, path.to_s, opts) case response.status when 404 raise NotFound when 200 response.body end end