Method: ApiResource::Serializer#to_hash

Defined in:
lib/api_resource/serializer.rb

#to_hashHashWithIndifferentAccess

Return our serialized object as a Hash

Returns:

  • (HashWithIndifferentAccess)


45
46
47
48
49
50
51
52
# File 'lib/api_resource/serializer.rb', line 45

def to_hash
  ret = HashWithIndifferentAccess.new
  ret.merge!(self.attributes_for_hash)
  ret.merge!(self.associations_for_hash)
  ret.merge!(self.add_on_data_for_hash)
  ret.merge!(self.association_foreign_keys_for_hash)
  ret
end