Class: Ecko::Plugins::Sponsor::Configurations
- Inherits:
-
Object
- Object
- Ecko::Plugins::Sponsor::Configurations
- Includes:
- Singleton
- Defined in:
- lib/ecko/plugins/sponsor/configurations.rb
Instance Attribute Summary collapse
-
#schema ⇒ Object
Returns the value of attribute schema.
Instance Method Summary collapse
- #gateways ⇒ Object
-
#setup(schema) ⇒ Object
Need to validate schema structure here.
Instance Attribute Details
#schema ⇒ Object
Returns the value of attribute schema.
11 12 13 |
# File 'lib/ecko/plugins/sponsor/configurations.rb', line 11 def schema @schema end |
Instance Method Details
#gateways ⇒ Object
27 28 29 30 31 |
# File 'lib/ecko/plugins/sponsor/configurations.rb', line 27 def gateways return { run: 'default', default: schema[:gateways].first } if schema[:gateways].length == 1 { run: 'choice', choices: schema[:gateways] } end |
#setup(schema) ⇒ Object
Need to validate schema structure here
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ecko/plugins/sponsor/configurations.rb', line 14 def setup(schema) # Check any gateways where configured raise NoGatewaysConfiguredError if schema[:gateways].blank? # Validate configurations schema[:gateways].each do |gateway| Ecko::Plugins::Sponsor::SchemaValidator::GatewayValidator.validate(gateway) Ecko::Plugins::Sponsor.add_gateway(gateway) end @schema = schema end |