module EasyPost::Hooks

Public Class Methods

any_subscribers?(type) click to toggle source
# File lib/easypost/hooks.rb, line 22
def self.any_subscribers?(type)
  !subscribers[type].empty?
end
notify(type, context) click to toggle source
# File lib/easypost/hooks.rb, line 18
def self.notify(type, context)
  subscribers[type].each_value { |subscriber| subscriber.call(context) }
end
subscribe(type, name, block) click to toggle source
# File lib/easypost/hooks.rb, line 4
def self.subscribe(type, name, block)
  subscribers[type][name] = block

  name
end
unsubscribe(type, name) click to toggle source
# File lib/easypost/hooks.rb, line 10
def self.unsubscribe(type, name)
  subscribers[type].delete(name)
end
unsubscribe_all(type) click to toggle source
# File lib/easypost/hooks.rb, line 14
def self.unsubscribe_all(type)
  subscribers.delete(type)
end