Sha256: 30eda6ae08c6ff523dc4948f965cef52d15e8c49d17c26b1453dde69248311b4

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 Bytes

Contents

# encoding: utf-8

begin
  require 'dotenv'
  Dotenv.load
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

1 entries across 1 versions & 1 rubygems

Version Path
dpd_api-0.1.5 lib/dpd_api/configuration.rb