Class: ALGOSEC_SDK::AdvancedJSONClient

Inherits:
JSONClient
  • Object
show all
Defined in:
lib/algosec-sdk/rest.rb

Overview

Adds the ability for httpclient to set proper content-type for Hash AND Array body

Instance Method Summary collapse

Instance Method Details

#argument_to_hash_for_json(args) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/algosec-sdk/rest.rb', line 12

def argument_to_hash_for_json(args)
  hash = argument_to_hash(args, :body, :header, :follow_redirect)
  if hash[:body].is_a?(Hash) || hash[:body].is_a?(Array)
    hash[:header] = json_header(hash[:header])
    hash[:body] = JSON.generate(hash[:body])
  end
  hash
end