class Paymongo::Configuration
Constants
- API_VERSION
- READABLE_ATTRIBUTES
- WRITABLE_ATTRIBUTES
Public Class Methods
_default_logger()
click to toggle source
# File lib/paymongo/configuration.rb, line 86 def self._default_logger logger = Logger.new(STDOUT) logger.level = Logger::INFO logger end
expectant_reader(*attributes)
click to toggle source
# File lib/paymongo/configuration.rb, line 15 def self.expectant_reader(*attributes) attributes.each do |attribute| ( class << self self end ) .send(:define_method, attribute) do attribute_value = instance_variable_get("@#{attribute}") if attribute_value.nil? || attribute_value.to_s.empty? raise ConfigurationError.new( "Paymongo::Configuration.#{attribute.to_s} needs to be set" ) end attribute_value end end end
gateway()
click to toggle source
# File lib/paymongo/configuration.rb, line 35 def self.gateway Paymongo::Gateway.new(instantiate) end
instantiate()
click to toggle source
# File lib/paymongo/configuration.rb, line 39 def self.instantiate config = new end
logger()
click to toggle source
# File lib/paymongo/configuration.rb, line 43 def self.logger @logger ||= _default_logger end
new(options = {})
click to toggle source
# File lib/paymongo/configuration.rb, line 47 def initialize(options = {}) WRITABLE_ATTRIBUTES.each do |attr| instance_variable_set "@#{attr}", options[attr] || Paymongo.configuration.send(attr) end end
Public Instance Methods
api_version()
click to toggle source
# File lib/paymongo/configuration.rb, line 54 def api_version API_VERSION end
assert_has_keys()
click to toggle source
# File lib/paymongo/configuration.rb, line 96 def assert_has_keys if public_key.nil? || secret_key.nil? raise ConfigurationError.new( 'Paymongo::Gateway public_key and secret_key are required.' ) end end
base_url()
click to toggle source
# File lib/paymongo/configuration.rb, line 58 def base_url "#{protocol}://#{server}:#{port}/v#{API_VERSION}" end
https()
click to toggle source
# File lib/paymongo/configuration.rb, line 62 def https Http.new(self) end
inspect()
click to toggle source
Calls superclass method
# File lib/paymongo/configuration.rb, line 92 def inspect super.gsub(/@secret_key=\".*\"/, '@secret_key="[FILTERED]"') end
logger()
click to toggle source
# File lib/paymongo/configuration.rb, line 66 def logger @logger ||= self.class._default_logger end
port()
click to toggle source
# File lib/paymongo/configuration.rb, line 70 def port 443 end
protocol()
click to toggle source
# File lib/paymongo/configuration.rb, line 74 def protocol 'https' end
server()
click to toggle source
# File lib/paymongo/configuration.rb, line 78 def server 'api.paymongo.com' end
ssl?()
click to toggle source
# File lib/paymongo/configuration.rb, line 82 def ssl? true end