Method: EPlat::Concerns::OverwriteInstanceMethods#to_eplat_json

Defined in:
lib/e_plat/resource/concerns/overwrite_instance_methods.rb

#to_eplat_json(options = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/e_plat/resource/concerns/overwrite_instance_methods.rb', line 51

def to_eplat_json(options = {})
	root_at_top_of_json = self.mapping.include_root_in_request_body?(self)
	options[:root] 		= self.element_name if root_at_top_of_json 

	result = '{'
	result << as_eplat_json.map do |key, value|
		"#{ActiveSupport::JSON.encode(key.to_s)}:#{ActiveSupport::JSON.encode(value, options)}"
	end * ','
	result << '}'
end