Class: FusionAuth::JSONBodyHandler
- Inherits:
-
Object
- Object
- FusionAuth::JSONBodyHandler
- Defined in:
- lib/fusionauth/rest_client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#length ⇒ Object
Returns the value of attribute length.
Instance Method Summary collapse
-
#body_object ⇒ String
Returns the body String for the request.
-
#initialize(body_object) ⇒ JSONBodyHandler
constructor
A new instance of JSONBodyHandler.
-
#set_headers(headers) ⇒ Object
Sets any headers necessary for the body to be processed.
- #type ⇒ Object
Constructor Details
#initialize(body_object) ⇒ JSONBodyHandler
Returns a new instance of JSONBodyHandler.
345 346 347 |
# File 'lib/fusionauth/rest_client.rb', line 345 def initialize(body_object) @body = JSON.generate(body_object) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
343 344 345 |
# File 'lib/fusionauth/rest_client.rb', line 343 def body @body end |
#length ⇒ Object
Returns the value of attribute length.
343 344 345 |
# File 'lib/fusionauth/rest_client.rb', line 343 def length @length end |
Instance Method Details
#body_object ⇒ String
Returns the body String for the request
353 354 355 |
# File 'lib/fusionauth/rest_client.rb', line 353 def body_object @body end |
#set_headers(headers) ⇒ Object
Sets any headers necessary for the body to be processed.
366 367 368 369 370 |
# 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 ⇒ Object
357 358 359 |
# File 'lib/fusionauth/rest_client.rb', line 357 def type "JSON" end |