Class: BankLink::Configuration
- Inherits:
-
Object
- Object
- BankLink::Configuration
- Includes:
- Singleton
- Defined in:
- lib/bank_link/configuration.rb
Instance Attribute Summary collapse
-
#banks(name = nil, &block) ⇒ Object
Returns the value of attribute banks.
-
#default_encoding ⇒ Object
Returns the value of attribute default_encoding.
-
#mac_fields(&block) ⇒ Object
Returns the value of attribute mac_fields.
Instance Method Summary collapse
- #authorization_links(&block) ⇒ Object
- #each_link(type, &block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #payment_links(&block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 36 37 38 |
# File 'lib/bank_link/configuration.rb', line 32 def initialize file_data = YAML.load(File.read(File.dirname(__FILE__) + "/../../mac_fields.yml")) file_data.each do |type, versions| mac_fields { |mf| mf[type] = Hashie::Mash.new(versions) } end @banks ||= Hashie::Mash.new end |
Instance Attribute Details
#banks(name = nil, &block) ⇒ Object
Returns the value of attribute banks.
8 9 10 |
# File 'lib/bank_link/configuration.rb', line 8 def banks @banks end |
#default_encoding ⇒ Object
Returns the value of attribute default_encoding.
8 9 10 |
# File 'lib/bank_link/configuration.rb', line 8 def default_encoding @default_encoding end |
#mac_fields(&block) ⇒ Object
Returns the value of attribute mac_fields.
8 9 10 |
# File 'lib/bank_link/configuration.rb', line 8 def mac_fields @mac_fields end |
Instance Method Details
#authorization_links(&block) ⇒ Object
20 21 22 |
# File 'lib/bank_link/configuration.rb', line 20 def &block each_link :authorization_link, &block end |
#each_link(type, &block) ⇒ Object
40 41 42 |
# File 'lib/bank_link/configuration.rb', line 40 def each_link type, &block banks.collect { |name, bank| bank.method(type).call() }.compact.each(&block) end |
#payment_links(&block) ⇒ Object
24 25 26 |
# File 'lib/bank_link/configuration.rb', line 24 def payment_links &block each_link :payment_link, &block end |