Module: Asaas::Configuration

Defined in:
lib/asaas/configuration.rb

Constant Summary collapse

ENDPOINT_PRODUCTION =
{
  v2: 'https://api.asaas.com/v2',
  v3: 'https://api.asaas.com/v3',
}
ENDPOINT_HOMOLOG =
{
  v2: 'https://sandbox.asaas.com/api/v2',
  v3: 'https://sandbox.asaas.com/api/v3',
}

Class Method Summary collapse

Class Method Details

.get_endpoint(api_version = nil) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/asaas/configuration.rb', line 43

def get_endpoint(api_version = nil)
  api_version ||= Asaas::Configuration.api_version
  if production
    ENDPOINT_PRODUCTION[:"v#{api_version}"]
  else
    ENDPOINT_HOMOLOG[:"v#{api_version}"]
  end
end

.get_environmentObject



52
53
54
55
56
57
58
# File 'lib/asaas/configuration.rb', line 52

def get_environment
  if production
    :production
  else
    :homolog
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



38
39
40
41
# File 'lib/asaas/configuration.rb', line 38

def setup(&block)
  yield self if block_given?
  self
end