module Ecko::Plugins::Sponsor

Constants

VERSION

Public Class Methods

add_gateway(checkout) click to toggle source

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

# File lib/ecko/plugins/sponsor.rb, line 20
def add_gateway(checkout)
  @@gateways << checkout
end
available_gateways() click to toggle source

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

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

THis will register the sponsor engine to the ecko plugin registry

# File lib/ecko/plugins/sponsor.rb, line 34
def register(schema)
  Ecko::Plugins.register(name: 'sponsor', schema: schema, engine: Ecko::Plugins::Sponsor::Engine)
end