lib/recurly/client.rb in recurly-4.0.1 vs lib/recurly/client.rb in recurly-4.1.0

- old
+ new

@@ -53,10 +53,12 @@ # sub = client.get_subscription(subscription_id: 'uuid-abcd7890') # # @param api_key [String] The private API key # @param logger [Logger] A logger to use. Defaults to creating a new STDOUT logger with level WARN. def initialize(api_key:, logger: nil) + raise ArgumentError, "'api_key' must be set to a non-nil value" if api_key.nil? + set_api_key(api_key) if logger.nil? @logger = Logger.new(STDOUT).tap do |l| l.level = Logger::WARN @@ -203,11 +205,11 @@ if ex.kind_of?(Net::OpenTimeout) || ex.kind_of?(Errno::ETIMEDOUT) raise Recurly::Errors::TimeoutError, "Request timed out" end raise Recurly::Errors::ConnectionFailedError, "Failed to connect to Recurly: #{ex.message}" - rescue Net::ReadTimeout, Timeout::Error + rescue Timeout::Error raise Recurly::Errors::TimeoutError, "Request timed out" rescue OpenSSL::SSL::SSLError => ex raise Recurly::Errors::SSLError, ex.message rescue StandardError => ex raise Recurly::Errors::NetworkError, ex.message @@ -329,10 +331,10 @@ path = path.gsub("{", "%{") path % options end def set_api_key(api_key) - @api_key = api_key + @api_key = api_key.to_s end def build_url(path, options) path = scope_by_site(path, options) query_params = map_array_params(options.fetch(:params, {}))