Sha256: 4295c35ad5b3299c35d5611522467f3ff2f9082f2b79e04ab7c0ac37ec81eb24

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require "faraday"
require "faraday_middleware"

require_relative "experian/http"
require_relative "experian/client"
require_relative "experian/version"
require_relative "experian/report"

module Experian
  class Error < StandardError; end
  class AuthenticationError < Error; end
  class ConfigurationError < Error; end

  class Configuration
    attr_writer :user_code, :password, :version, :request_timeout, :base_uri, :extra_headers
    attr_reader :base_uri, :request_timeout, :version, :extra_headers

    DEFAULT_BASE_URI = "https://informes.axesor.es".freeze
    DEFAULT_VERSION = "9.0".freeze
    DEFAULT_REQUEST_TIMEOUT = 120

    def initialize
      @user_code = nil
      @password = nil
      @version = DEFAULT_VERSION
      @request_timeout = DEFAULT_REQUEST_TIMEOUT
      @base_uri = DEFAULT_BASE_URI
      @extra_headers = {}
    end

    def user_code
      return @user_code if @user_code
      raise ConfigurationError, "Experian user_code missing!"
    end

    def password
      return @password if @password
      raise ConfigurationError, "Experian password missing!"
    end
  end

  class << self
    attr_writer :configuration
  end

  def self.configuration
    @configuration ||= Experian::Configuration.new
  end

  def self.configure
    yield(configuration)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-experian-0.0.5 lib/experian.rb