Sha256: b4df9599bed5dc7785735d326a103a20529f6a9e7c0668f9fd292a5583377120

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

# encoding: utf-8

begin
  require 'dotenv'
  Dotenv.load
rescue LoadError
  nil
end

module DpdApi
  class << self
    attr_accessor :configuration
  end

  def self.configure
    self.configuration ||= Configuration.new
    yield(configuration)
  end

  class Configuration
    attr_accessor :client_key,
                  :client_number,
                  :base_url,
                  :debug

    attr_reader :auth_params

    def initialize
      @client_key    = ENV['DPD_CLIENT_KEY']    || '123'
      @client_number = ENV['DPD_CLIENT_NUMBER'] || '234'
      @base_url      = 'http://wstest.dpd.ru'
      @debug         = false
    end

    def auth_params
      {
        auth: {
          client_number: client_number,
          client_key:    client_key,
        }
      }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dpd_api-0.1.10 lib/dpd_api/configuration.rb
dpd_api-0.1.9 lib/dpd_api/configuration.rb
dpd_api-0.1.8 lib/dpd_api/configuration.rb
dpd_api-0.1.7 lib/dpd_api/configuration.rb
dpd_api-0.1.6 lib/dpd_api/configuration.rb