Class: Lecter::FormatterPayload
- Inherits:
-
Object
- Object
- Lecter::FormatterPayload
- Defined in:
- lib/lecter/formatter_payload.rb
Constant Summary collapse
- WRONG_PARAMETERS_MSG =
'Wrong parameters'
Instance Attribute Summary collapse
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(payload) ⇒ FormatterPayload
constructor
A new instance of FormatterPayload.
Constructor Details
#initialize(payload) ⇒ FormatterPayload
Returns a new instance of FormatterPayload.
10 11 12 |
# File 'lib/lecter/formatter_payload.rb', line 10 def initialize(payload) @dirty_payload = payload end |
Instance Attribute Details
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
8 9 10 |
# File 'lib/lecter/formatter_payload.rb', line 8 def @error_message end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/lecter/formatter_payload.rb', line 8 def result @result end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 |
# File 'lib/lecter/formatter_payload.rb', line 14 def call @result = json_parse(dirty_payload).merge(lecter_enabled_parameter) rescue JSON::ParserError @error_message = WRONG_PARAMETERS_MSG false end |