Class: Slanger::Api::RequestValidation
- Inherits:
-
Struct
- Object
- Struct
- Slanger::Api::RequestValidation
- Defined in:
- lib/slanger/api/request_validation.rb
Instance Attribute Summary collapse
-
#path_info ⇒ Object
Returns the value of attribute path_info.
-
#raw_body ⇒ Object
Returns the value of attribute raw_body.
-
#raw_params ⇒ Object
Returns the value of attribute raw_params.
Instance Method Summary collapse
- #auth_params ⇒ Object
- #body ⇒ Object
- #channels ⇒ Object
- #data ⇒ Object
-
#initialize(*args) ⇒ RequestValidation
constructor
A new instance of RequestValidation.
- #params ⇒ Object
- #socket_id ⇒ Object
Constructor Details
#initialize(*args) ⇒ RequestValidation
Returns a new instance of RequestValidation.
6 7 8 9 10 11 12 |
# File 'lib/slanger/api/request_validation.rb', line 6 def initialize(*args) super(*args) validate! authenticate! parse_body! end |
Instance Attribute Details
#path_info ⇒ Object
Returns the value of attribute path_info
5 6 7 |
# File 'lib/slanger/api/request_validation.rb', line 5 def path_info @path_info end |
#raw_body ⇒ Object
Returns the value of attribute raw_body
5 6 7 |
# File 'lib/slanger/api/request_validation.rb', line 5 def raw_body @raw_body end |
#raw_params ⇒ Object
Returns the value of attribute raw_params
5 6 7 |
# File 'lib/slanger/api/request_validation.rb', line 5 def raw_params @raw_params end |
Instance Method Details
#auth_params ⇒ Object
22 23 24 |
# File 'lib/slanger/api/request_validation.rb', line 22 def auth_params params.except("channel_id", "app_id") end |
#body ⇒ Object
18 19 20 |
# File 'lib/slanger/api/request_validation.rb', line 18 def body @body ||= validate_body! end |
#channels ⇒ Object
34 35 36 |
# File 'lib/slanger/api/request_validation.rb', line 34 def channels @channels ||= Array(body["channels"] || params["channels"]) end |
#data ⇒ Object
14 15 16 |
# File 'lib/slanger/api/request_validation.rb', line 14 def data @data ||= Oj.strict_load(body["data"] || params["data"]) end |
#params ⇒ Object
30 31 32 |
# File 'lib/slanger/api/request_validation.rb', line 30 def params @params ||= validate_raw_params! end |
#socket_id ⇒ Object
26 27 28 |
# File 'lib/slanger/api/request_validation.rb', line 26 def socket_id @socket_id ||= determine_valid_socket_id end |