Class: Banacle::InteractiveMessage::Handler
- Inherits:
-
Object
- Object
- Banacle::InteractiveMessage::Handler
- Defined in:
- lib/banacle/interactive_message/handler.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#request ⇒ Object
Returns the value of attribute request.
Instance Method Summary collapse
- #handle(raw_request) ⇒ Object
-
#initialize(config, auth: nil) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(config, auth: nil) ⇒ Handler
Returns a new instance of Handler.
10 11 12 13 |
# File 'lib/banacle/interactive_message/handler.rb', line 10 def initialize(config, auth: nil) @config = config @auth = auth end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/banacle/interactive_message/handler.rb', line 15 def config @config end |
#request ⇒ Object
Returns the value of attribute request.
16 17 18 |
# File 'lib/banacle/interactive_message/handler.rb', line 16 def request @request end |
Instance Method Details
#handle(raw_request) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/banacle/interactive_message/handler.rb', line 18 def handle(raw_request) unless slack_validator.valid_signature?(raw_request) return [401, {}, "invalid signagure"] end self.request = Request.new(raw_request) json = if request.action.approved? handle_approval elsif request.action.rejected? handle_reject elsif request.action.cancelled? handle_cancellation end puts json json end |