lib/panoptes/endpoints/base_endpoint.rb in panoptes-client-1.0.0.pre1 vs lib/panoptes/endpoints/base_endpoint.rb in panoptes-client-1.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'faraday' require 'faraday_middleware' require 'faraday/panoptes' module Panoptes @@ -56,11 +58,14 @@ headers['If-Match'] = etag if etag end end def request(method, path, *args) - path = "#{prefix}/#{path}" if prefix + if prefix + sep = path[0] == '/' ? nil : '/' + path = "#{prefix}#{sep}#{path}" + end handle_response connection.send(method, path, *args) end def handle_response(response) case response.status @@ -81,12 +86,10 @@ else faraday.request :panoptes_api_v1 faraday.request :json faraday.response :json faraday.adapter Faraday.default_adapter - if @params - faraday.params = @params - end + faraday.params = @params if @params end end def auth_request(faraday, auth) if auth[:token]