Sha256: 349a82fada383de4e2db60311ab596ae672c2cbfd3456a4ef393946059e28faa

Contents?: true

Size: 901 Bytes

Versions: 8

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

module CapitalOnTap
  class Configuration
    attr_accessor :client_id, :client_secret, :username, :password, :env
    attr_writer :debug

    AUTH_DOMAINS = {
      production: 'https://api-auth.capitalontap.com',
      development: 'https://prelive-api-auth.capitalontap.com'
    }.freeze

    API_DOMAINS = {
      production: 'https://api-partner.capitalontap.com',
      development: 'https://prelive-api-partner.capitalontap.com'
    }.freeze

    def initialize
      @client_id = ''
      @client_secret = ''
      @username = ''
      @password = ''
      @env = defined?(Rails) ? Rails.env : :development
      @debug = false
    end

    def debug?
      @debug
    end

    def base_auth_url
      AUTH_DOMAINS[@env.to_sym] || AUTH_DOMAINS[:development]
    end

    def base_url
      API_DOMAINS[@env.to_sym] || API_DOMAINS[:development]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
capital_on_tap-1.0.1 lib/capital_on_tap/configuration.rb
capital_on_tap-1.0.0 lib/capital_on_tap/configuration.rb
capital_on_tap-0.2.1 lib/capital_on_tap/configuration.rb
capital_on_tap-0.2.0 lib/capital_on_tap/configuration.rb
capital_on_tap-0.1.8 lib/capital_on_tap/configuration.rb
capital_on_tap-0.1.7 lib/capital_on_tap/configuration.rb
capital_on_tap-0.1.6 lib/capital_on_tap/configuration.rb
capital_on_tap-0.1.5 lib/capital_on_tap/configuration.rb