Class: Getto::Roda::Decode::Post
- Inherits:
-
Object
- Object
- Getto::Roda::Decode::Post
- Defined in:
- lib/getto/roda/decode.rb
Instance Method Summary collapse
-
#initialize(content_type, body) ⇒ Post
constructor
A new instance of Post.
- #to_h ⇒ Object
Constructor Details
#initialize(content_type, body) ⇒ Post
Returns a new instance of Post.
8 9 10 11 |
# File 'lib/getto/roda/decode.rb', line 8 def initialize(content_type, body) @content_type = content_type @body = body end |
Instance Method Details
#to_h ⇒ Object
13 14 15 16 17 18 |
# File 'lib/getto/roda/decode.rb', line 13 def to_h return unless @content_type == "application/json" ::JSON.parse @body rescue ::JSON::ParserError nil end |