Class: Freemium::Gateways::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/freemium/gateways/base.rb

Overview

:nodoc:

Direct Known Subclasses

BrainTree, Test

Instance Method Summary collapse

Instance Method Details

#cancel(billing_key) ⇒ Object

cancels the subscription identified by the given billing key. this might mean removing it from the remote system, or halting the remote recurring billing.

should return a Freemium::Response

Raises:

  • (MethodNotImplemented)


15
16
17
# File 'lib/freemium/gateways/base.rb', line 15

def cancel(billing_key)
  raise MethodNotImplemented
end

#charge(billing_key, amount) ⇒ Object

charges money against the given billing key. should return a Freemium::Transaction

Raises:

  • (MethodNotImplemented)


60
61
62
# File 'lib/freemium/gateways/base.rb', line 60

def charge(billing_key, amount)
  raise MethodNotImplemented
end

#store(credit_card, address = nil) ⇒ Object

stores a credit card with the gateway. should return a Freemium::Response

Raises:

  • (MethodNotImplemented)


21
22
23
# File 'lib/freemium/gateways/base.rb', line 21

def store(credit_card, address = nil)
  raise MethodNotImplemented
end

#transactions(options = {}) ⇒ Object

only needed to support an ARB module. otherwise, the manual billing process will take care of processing transaction information as it happens.

concrete classes need to support these options:

:billing_key : - only retrieve transactions for this specific billing key
:after :       - only retrieve transactions after this datetime (non-inclusive)
:before :      - only retrieve transactions before this datetime (non-inclusive)

return value should be a collection of Freemium::Transaction objects.

Raises:

  • (MethodNotImplemented)


50
51
52
# File 'lib/freemium/gateways/base.rb', line 50

def transactions(options = {})
  raise MethodNotImplemented
end

#update(billing_key, credit_card = nil, address = nil) ⇒ Object

updates a credit card in the gateway. should return a Freemium::Response

Raises:

  • (MethodNotImplemented)


27
28
29
# File 'lib/freemium/gateways/base.rb', line 27

def update(billing_key, credit_card = nil, address = nil)
  raise MethodNotImplemented
end

#validate(credit_card, address = nil) ⇒ Object

validates a credit card with the gateway. should return a Freemium::Response

Raises:

  • (MethodNotImplemented)


33
34
35
# File 'lib/freemium/gateways/base.rb', line 33

def validate(credit_card, address = nil)
  raise MethodNotImplemented
end