Sha256: 6a9210226f6548e29d283693db08a99f6a09a8fabe2e03903014badc0b9f48ea
Contents?: true
Size: 1010 Bytes
Versions: 3
Compression:
Stored size: 1010 Bytes
Contents
# frozen_string_literal: true module Monri class Config attr_accessor :merchant_key attr_accessor :authenticity_token SUPPORTED_ENVS = %w[test production].freeze # @return [String] def base_api_url if environment == 'test' 'https://ipgtest.monri.com' elsif environment == 'production' 'https://ipg.monri.com' else raise ArgumentError, "Environment=#{environment} not supported" end end def self.default_config rv = Config.new rv.environment = :test rv end attr_reader :environment def environment=(val) val = val.nil? ? nil : val.to_s unless SUPPORTED_ENVS.include?(val) raise Monri::Config::InvalidConfiguration, "Environment='#{val}' is not supported environment" end @environment = val end def configured? !merchant_key.nil? && !authenticity_token.nil? && !environment.nil? end class InvalidConfiguration < StandardError; end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
monri-0.3.0 | lib/monri/config.rb |
monri-0.2.0 | lib/monri/config.rb |
monri-0.1.0 | lib/monri/config.rb |