Class: Reynard::SerializedBody
- Inherits:
-
Object
- Object
- Reynard::SerializedBody
- Defined in:
- lib/reynard/serialized_body.rb
Overview
Serializes a request body and returns headers appropriate for the request.
Instance Method Summary collapse
- #content_type ⇒ Object
- #headers ⇒ Object
-
#initialize(content, data) ⇒ SerializedBody
constructor
A new instance of SerializedBody.
- #to_s ⇒ Object
Constructor Details
#initialize(content, data) ⇒ SerializedBody
Returns a new instance of SerializedBody.
6 7 8 9 |
# File 'lib/reynard/serialized_body.rb', line 6 def initialize(content, data) @content = content @data = data end |
Instance Method Details
#content_type ⇒ Object
11 12 13 |
# File 'lib/reynard/serialized_body.rb', line 11 def content_type 'application/json' end |
#headers ⇒ Object
15 16 17 |
# File 'lib/reynard/serialized_body.rb', line 15 def headers { 'Content-Type' => content_type } end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/reynard/serialized_body.rb', line 19 def to_s MultiJson.dump(@data) end |