class FusionAuth::JSONBodyHandler

Attributes

body[RW]
length[RW]

Public Class Methods

new(body_object) click to toggle source
# File lib/fusionauth/rest_client.rb, line 345
def initialize(body_object)
  @body = JSON.generate(body_object)
end

Public Instance Methods

body_object() click to toggle source

Returns the body String for the request

@return [String] The body as a String

# File lib/fusionauth/rest_client.rb, line 353
def body_object
  @body
end
set_headers(headers) click to toggle source

Sets any headers necessary for the body to be processed.

@param headers [Hash] The headers hash to add any headers needed by this BodyHandler @return [Object] The object

# File lib/fusionauth/rest_client.rb, line 366
def set_headers(headers)
  headers['Length'] = body.bytesize.to_s
  headers['Content-Type'] = 'application/json'
  nil
end
type() click to toggle source
# File lib/fusionauth/rest_client.rb, line 357
def type
  "JSON"
end