Module: Ecko::Plugins::Sponsor

Defined in:
lib/ecko/plugins/sponsor.rb,
lib/ecko/plugins/sponsor/engine.rb,
lib/ecko/plugins/sponsor/donated.rb,
lib/ecko/plugins/sponsor/process.rb,
lib/ecko/plugins/sponsor/version.rb,
lib/ecko/plugins/sponsor/parser/stripe.rb,
lib/ecko/plugins/sponsor/configurations.rb,
lib/ecko/plugins/sponsor/schema_validator.rb,
lib/ecko/plugins/sponsor/generator/donation_package_generator.rb

Defined Under Namespace

Modules: Parser, SchemaValidator Classes: Configurations, Donated, DonationPackageGenerator, Engine, Error, InvalidGatewayCheckout, InvalidGatewayName, NoGatewaysConfiguredError, Process

Constant Summary collapse

VERSION =
"0.1.0"
@@gateways =
[]

Class Method Summary collapse

Class Method Details

.add_gateway(checkout) ⇒ Object

It will add all the gateways here to be able to redirect when someone tries to donate If none of the gateways are configured there are no ways to donate Therefore an error will be thrown



20
21
22
# File 'lib/ecko/plugins/sponsor.rb', line 20

def add_gateway(checkout)
  @@gateways << checkout
end

.available_gatewaysObject

We can get all the available gateways that we can use to donate.



25
26
27
28
29
30
31
# File 'lib/ecko/plugins/sponsor.rb', line 25

def available_gateways
  return { run: 'default', default: @@gateways.first } if @@gateways.length == 1

  # The choice runner will help in setting up a UI for the users to
  # choose which gateway do they prefer.
  { run: 'choice', choices: @@gateways }
end

.register(schema) ⇒ Object

THis will register the sponsor engine to the ecko plugin registry



34
35
36
# File 'lib/ecko/plugins/sponsor.rb', line 34

def register(schema)
  Ecko::Plugins.register(name: 'sponsor', schema: schema, engine: Ecko::Plugins::Sponsor::Engine)
end