Class: PuntoPagos::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/puntopagos/config.rb

Overview

Public: Manage configurations variables like production and sandbox URLs and puntopagos.yml config file

Constant Summary collapse

PUNTOPAGOS_BASE_URL =
{
  :production => "https://www.puntopagos.com/",
  :sandbox => "https://sandbox.puntopagos.com/"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env = nil, config_override = nil) ⇒ Config

Public: Loads the configuration file puntopagos.yml If it’s a rails application it will take the file from the config/ directory

env - Environment.

Returns a Config object.



20
21
22
23
24
25
26
27
28
29
# File 'lib/puntopagos/config.rb', line 20

def initialize env = nil, config_override = nil
  if env
    # For non-rails apps
    @config_filepath = File.join(File.dirname(__FILE__), "..", "..", "config", "puntopagos.yml")
    load(env)
  else
    @config_filepath = File.join(Rails.root, "config", "puntopagos.yml")
    load(Rails.env)
  end
end

Instance Attribute Details

#config_filepathObject

Returns the value of attribute config_filepath.



12
13
14
# File 'lib/puntopagos/config.rb', line 12

def config_filepath
  @config_filepath
end

#puntopagos_base_urlObject

Returns the value of attribute puntopagos_base_url.



12
13
14
# File 'lib/puntopagos/config.rb', line 12

def puntopagos_base_url
  @puntopagos_base_url
end

#puntopagos_keyObject

Returns the value of attribute puntopagos_key.



12
13
14
# File 'lib/puntopagos/config.rb', line 12

def puntopagos_key
  @puntopagos_key
end

#puntopagos_secretObject

Returns the value of attribute puntopagos_secret.



12
13
14
# File 'lib/puntopagos/config.rb', line 12

def puntopagos_secret
  @puntopagos_secret
end