Sha256: cf19876fcea0ad8be83aea9285da6e9a716ca7957ea741858ed9661f8f4fa933

Contents?: true

Size: 594 Bytes

Versions: 3

Compression:

Stored size: 594 Bytes

Contents

module Affirm
  class Configuration
    attr_accessor :public_api_key
    attr_accessor :private_api_key
    attr_accessor :environment

    ENDPOINTS = {
      production: "api.affirm.com",
      sandbox:    "sandbox.affirm.com"
    }

    def initialize
      @environment = :production
    end

    def endpoint
      "https://#{ENDPOINTS[environment]}"
    end
  end

  class << self
    def configuration
      @configuration ||= Configuration.new
    end

    def configuration=(config)
      @configuration = config
    end

    def configure
      yield configuration
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
affirm-ruby-1.0.1 lib/affirm/configuration.rb
affirm-ruby-1.0.0 lib/affirm/configuration.rb
affirm-ruby-0.0.1 lib/affirm/configuration.rb