module RecurlyEvent

Constants

NAMESPACE
VERSION

Attributes

namespace[RW]
notifications[RW]
parser[RW]

Public Class Methods

all(callable=Proc.new {}) click to toggle source
# File lib/recurly_event.rb, line 18
def all(callable=Proc.new {})
  subscribe nil, callable
end
configure() { |self| ... } click to toggle source
# File lib/recurly_event.rb, line 13
def configure(&block)
  raise ArgumentError, "missing block" unless block_given?
  yield self
end
process_request(request) click to toggle source
# File lib/recurly_event.rb, line 22
def process_request(request)
  parsed_request = parser.parse(request)
  publish(parsed_request.event_name, parsed_request.payload)
end
publish(event_name, payload) click to toggle source
# File lib/recurly_event.rb, line 27
def publish(event_name, payload)
  notifications.instrument(namespace.parse_with_namespace(event_name), payload)
end
subscribe(event_name, callable=Proc.new {}) click to toggle source
# File lib/recurly_event.rb, line 31
def subscribe(event_name, callable=Proc.new {})
  notifications.subscribe namespace.regexp_wrap(event_name) do |*args|
    recurly_object = parser.from_payload(args.last)
    callable.call(recurly_object)
  end
end