Class: Codebot::Payload
- Inherits:
-
Object
- Object
- Codebot::Payload
- Defined in:
- lib/codebot/payload.rb
Overview
A JSON request payload.
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
The JSON object parsed from the request payload.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Payload
constructor
Constructs a new payload.
-
#to_json ⇒ Object
Returns the JSON payload.
-
#to_s ⇒ String
Returns the JSON string corresponding to the payload.
Constructor Details
#initialize(payload) ⇒ Payload
Constructs a new payload.
14 15 16 |
# File 'lib/codebot/payload.rb', line 14 def initialize(payload) @json = JSON.parse payload end |
Instance Attribute Details
#json ⇒ Object (readonly)
9 10 11 |
# File 'lib/codebot/payload.rb', line 9 def json @json end |
Instance Method Details
#to_json ⇒ Object
Returns the JSON payload.
21 22 23 |
# File 'lib/codebot/payload.rb', line 21 def to_json @json end |
#to_s ⇒ String
Returns the JSON string corresponding to the payload.
28 29 30 |
# File 'lib/codebot/payload.rb', line 28 def to_s @json.to_s end |