module PlaidRails::Event
Attributes
adapter[RW]
backend[RW]
namespace[RW]
Public Class Methods
all(callable = Proc.new)
click to toggle source
# File lib/plaid_rails/event.rb, line 36 def all(callable = Proc.new) subscribe nil, callable end
configure() { |self| ... }
click to toggle source
# File lib/plaid_rails/event.rb, line 8 def configure(&block) raise ArgumentError, "must provide a block" unless block_given? block.arity.zero? ? instance_eval(&block) : yield(self) end
Also aliased as: setup
instrument(event)
click to toggle source
# File lib/plaid_rails/event.rb, line 14 def instrument(event) name = case event.webhook_code when 'INITIAL_UPDATE' "transactions.initial" when 'HISTORICAL_UPDATE' "transactions.new" when 'DEFAULT_UPDATE' "transactions.interval" when 'TRANSACTIONS_REMOVED' "transactions.removed" when 'WEBHOOK_UPDATE_ACKNOWLEDGED' "webhook.updated" else "plaid.error" end backend.instrument namespace.call(name), event if event end
listening?(name)
click to toggle source
# File lib/plaid_rails/event.rb, line 40 def listening?(name) namespaced_name = namespace.call(name) backend.notifier.listening?(namespaced_name) end
subscribe(name, callable = Proc.new)
click to toggle source
# File lib/plaid_rails/event.rb, line 32 def subscribe(name, callable = Proc.new) backend.subscribe namespace.to_regexp(name), adapter.call(callable) end