Class: Stall::Payments::Config

Inherits:
Object
  • Object
show all
Extended by:
Utils::ConfigDSL
Defined in:
lib/stall/payments/config.rb

Instance Method Summary collapse

Methods included from Utils::ConfigDSL

param

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/stall/payments/config.rb', line 24

def method_missing(name, *args)
  if (gateway = Stall::Payments::Gateway.for(name))
    if block_given?
      yield gateway
    else
      gateway
    end
  else
    super
  end
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



16
17
18
# File 'lib/stall/payments/config.rb', line 16

def configure
  yield self
end

#configure_urls(&block) ⇒ Object



20
21
22
# File 'lib/stall/payments/config.rb', line 20

def configure_urls(&block)
  Stall::Payments::UrlsConfig.config_block = block
end

#register_gateway(name, gateway) ⇒ Object

This mehtod allows for registering an in-app gateway that can be auto loaded without having to explicitly require it

Use a string representing the gateway name if the target class is auto-loaded by Rails



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

def register_gateway(name, gateway)
  Stall::Payments.gateways[name] = gateway
end