Class: Reynard::SerializedBody

Inherits:
Object
  • Object
show all
Defined in:
lib/reynard/serialized_body.rb

Overview

Serializes a request body and returns headers appropriate for the request.

Instance Method Summary collapse

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_typeObject



11
12
13
# File 'lib/reynard/serialized_body.rb', line 11

def content_type
  'application/json'
end

#headersObject



15
16
17
# File 'lib/reynard/serialized_body.rb', line 15

def headers
  { 'Content-Type' => content_type }
end

#to_sObject



19
20
21
# File 'lib/reynard/serialized_body.rb', line 19

def to_s
  MultiJson.dump(@data)
end