class Ecko::Plugins::Sponsor::Configurations

Attributes

schema[RW]

Public Instance Methods

gateways() click to toggle source
# 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) click to toggle source

Need to validate schema structure here

# 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