class BigMarkerClient::HttpClient
Attributes
connection[R]
Public Class Methods
new()
click to toggle source
# File lib/big_marker_client/http_client.rb, line 5 def initialize @connection = Faraday.new(url: Config.base_url) do |faraday| faraday = headers(faraday) configure_logging(faraday) if Config.log end @connection.adapter :typhoeus end
Private Instance Methods
configure_logging(adapter)
click to toggle source
# File lib/big_marker_client/http_client.rb, line 21 def configure_logging(adapter) adapter.response :logger do |logger| logger.instance_variable_get(:@options)[:log_level] = :debug if Config.debug logger.filter(/password=([^&]+)/, "password=[FILTERED]") logger.filter(/API-KEY: "(\w*)"/, "API-KEY: [FILTERED]") end adapter end
headers(adapter)
click to toggle source
# File lib/big_marker_client/http_client.rb, line 15 def headers(adapter) adapter.headers["Content-Type"] = "application/json" adapter.headers["API-KEY"] = Config.api_key unless Config.api_key.nil? adapter end