Sha256: e0676d401cd6fc45a16d9a2b975d6fd07cd6c992ebfc95163c0a95fbf5c02a06

Contents?: true

Size: 659 Bytes

Versions: 6

Compression:

Stored size: 659 Bytes

Contents

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

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

    def initialize
      @environment = :production
    end

    def environment=(env)
      @environment = env.to_sym
    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

6 entries across 6 versions & 1 rubygems

Version Path
affirm-ruby-1.2.0 lib/affirm/configuration.rb
affirm-ruby-1.1.3 lib/affirm/configuration.rb
affirm-ruby-1.1.2 lib/affirm/configuration.rb
affirm-ruby-1.1.1 lib/affirm/configuration.rb
affirm-ruby-1.1.0 lib/affirm/configuration.rb
affirm-ruby-1.0.2 lib/affirm/configuration.rb