Sha256: 9b266971897b751286cd6791231ced02dc4577f1d8c3e3ae3181536a56e94aa8

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true
module Usps
  module Config
    extend self

    ATTRIBUTES = %i[
      proxy
      user_agent
      ca_path
      ca_file
      logger
      endpoint
      user_id
      token
      timeout
      open_timeout
      default_page_size
      default_max_retries
    ].freeze

    attr_accessor(*Config::ATTRIBUTES)

    def reset
      self.endpoint = 'https://secure.shippingapis.com/'
      self.user_agent = "USPS Ruby Client/#{Usps::VERSION}"
      self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
      self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
      self.user_id = nil
      self.token = nil
      self.proxy = nil
      self.logger = nil
      self.timeout = nil
      self.open_timeout = nil
      self.default_page_size = 100
      self.default_max_retries = 100
    end
  end

  class << self
    def configure
      block_given? ? yield(Config) : Config
    end

    def config
      Config
    end
  end
end

Usps::Config.reset

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
usps-ruby-client-0.2.0 lib/usps/config.rb
usps-ruby-client-0.1.3 lib/usps/config.rb
usps-ruby-client-0.1.2 lib/usps/config.rb
usps-ruby-client-0.1.1 lib/usps/config.rb
usps-ruby-client-0.1.0 lib/usps/config.rb