class Apress::Api::Callbacks::Config

Public Instance Methods

add_client(access_id) click to toggle source
# File lib/apress/api/callbacks/config.rb, line 25
def add_client(access_id)
  clients << access_id
end
add_handler(service:, event:, handler:) click to toggle source
# File lib/apress/api/callbacks/config.rb, line 21
def add_handler(service:, event:, handler:)
  (handlers_config[service][event] ||= []) << handler
end
add_service(event:, service:) click to toggle source
# File lib/apress/api/callbacks/config.rb, line 17
def add_service(event:, service:)
  events[event] << service
end
allowed_client?(client) click to toggle source
# File lib/apress/api/callbacks/config.rb, line 29
def allowed_client?(client)
  clients.include?(client.access_id)
end
handlers(service:, event:) click to toggle source
# File lib/apress/api/callbacks/config.rb, line 37
def handlers(service:, event:)
  handlers_config.fetch(service).fetch(event)
end
services(event) click to toggle source
# File lib/apress/api/callbacks/config.rb, line 33
def services(event)
  events[event]
end

Private Instance Methods

clients() click to toggle source
# File lib/apress/api/callbacks/config.rb, line 51
def clients
  @clients ||= Set.new
end
events() click to toggle source
# File lib/apress/api/callbacks/config.rb, line 47
def events
  @events ||= ::Hash.new { |hash, key| hash[key] = [] }
end
handlers_config() click to toggle source
# File lib/apress/api/callbacks/config.rb, line 43
def handlers_config
  @handlers_config ||= ::Hash.new { |hash, key| hash[key] = {} }
end