Sha256: e9df0f7be3ef6df44f61a68a63db652bf3b6038f30546800347cd124d23dd460
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require "duty_calculator" require "faraday/detailed_logger" module DutyCalculator class Client def self.new ::Faraday.new(url: DutyCalculator.configuration.api_root) do |faraday| # middleware faraday.use FaradayMiddleware::FollowRedirects faraday.use FaradayMiddleware::EncodeJson # response defs faraday.use Faraday::Response::ParseXml faraday.use Faraday::Response::Mashify faraday.use Faraday::Response::RaiseError unless DutyCalculator.configuration.debug if DutyCalculator.configuration.debug faraday.response :detailed_logger, DutyCalculator.configuration.logger else faraday.response :logger, DutyCalculator.configuration.logger end faraday.adapter ::Faraday.default_adapter end end def self.api_base if DutyCalculator.configuration.sandbox return "#{DutyCalculator.configuration.api_version}/sandbox/#{DutyCalculator.configuration.api_key}" else return "#{DutyCalculator.configuration.api_version}/#{DutyCalculator.configuration.api_key}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
duty_calculator-0.0.8 | lib/duty_calculator/client.rb |