module MoipV2::Configuration

Constants

DEFAULT_API_KEY
DEFAULT_API_TOKEN
DEFAULT_ENDPOINT
DEFAULT_METHOD
DEFAULT_USER_AGENT
VALID_CONFIG_KEYS
VALID_CONNECTION_KEYS
VALID_OPTIONS_KEYS

Public Class Methods

extended(base) click to toggle source

Make sure we have the default values set when we get ‘extended’

# File lib/moip_v2/configuration.rb, line 19
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source
# File lib/moip_v2/configuration.rb, line 23
def configure
  yield self if block_given?
  Base.site = self.endpoint
  Refund.site = "#{Base.site}payments/:payment_id"
  Payment.site = "#{Base.site}orders/:order_id/"
end
options() click to toggle source
# File lib/moip_v2/configuration.rb, line 35
def options
  Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
end
reset() click to toggle source
# File lib/moip_v2/configuration.rb, line 39
def reset
  self.endpoint   = DEFAULT_ENDPOINT
  self.method     = DEFAULT_METHOD
  self.user_agent = DEFAULT_USER_AGENT

  self.api_token  = DEFAULT_API_TOKEN
  self.api_key    = DEFAULT_API_KEY
end
test_mode() click to toggle source
# File lib/moip_v2/configuration.rb, line 30
def test_mode
  require "moip_v2/debug_requests"
  self.endpoint = DEFAULT_ENDPOINT
end