Class: Apress::Api::Callbacks::Config
- Inherits:
-
Object
- Object
- Apress::Api::Callbacks::Config
- Includes:
- Singleton
- Defined in:
- lib/apress/api/callbacks/config.rb
Instance Method Summary collapse
- #add_client(access_id) ⇒ Object
- #add_handler(service:, event:, handler:) ⇒ Object
- #add_service(event:, service:) ⇒ Object
- #allowed_client?(client) ⇒ Boolean
- #handlers(service:, event:) ⇒ Object
- #services(event) ⇒ Object
Instance Method Details
#add_client(access_id) ⇒ Object
25 26 27 |
# File 'lib/apress/api/callbacks/config.rb', line 25 def add_client(access_id) clients << access_id end |
#add_handler(service:, event:, handler:) ⇒ Object
21 22 23 |
# 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:) ⇒ Object
17 18 19 |
# File 'lib/apress/api/callbacks/config.rb', line 17 def add_service(event:, service:) events[event] << service end |
#allowed_client?(client) ⇒ Boolean
29 30 31 |
# File 'lib/apress/api/callbacks/config.rb', line 29 def allowed_client?(client) clients.include?(client.access_id) end |
#handlers(service:, event:) ⇒ Object
37 38 39 |
# File 'lib/apress/api/callbacks/config.rb', line 37 def handlers(service:, event:) handlers_config.fetch(service).fetch(event) end |
#services(event) ⇒ Object
33 34 35 |
# File 'lib/apress/api/callbacks/config.rb', line 33 def services(event) events[event] end |