module EasyPost::Hooks
Public Class Methods
Source
# File lib/easypost/hooks.rb, line 22 def self.any_subscribers?(type) !subscribers[type].empty? end
Source
# File lib/easypost/hooks.rb, line 18 def self.notify(type, context) subscribers[type].each_value { |subscriber| subscriber.call(context) } end
Source
# File lib/easypost/hooks.rb, line 4 def self.subscribe(type, name, block) subscribers[type][name] = block name end
Source
# File lib/easypost/hooks.rb, line 10 def self.unsubscribe(type, name) subscribers[type].delete(name) end
Source
# File lib/easypost/hooks.rb, line 14 def self.unsubscribe_all(type) subscribers.delete(type) end