Module: FmRest::Spyke::Model::Serialization

Extended by:
ActiveSupport::Concern
Included in:
FmRest::Spyke::Model
Defined in:
lib/fmrest/spyke/model/serialization.rb

Instance Method Summary collapse

Instance Method Details

#to_paramsObject

Spyke override -- Return FM Data API's expected JSON format, including only modified fields.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fmrest/spyke/model/serialization.rb', line 20

def to_params
  params = {
    fieldData: serialize_values!(changed_params_not_embedded_in_url).merge(serialize_portal_deletions)
  }

  params[:modId] = __mod_id.to_s if __mod_id && !ignore_mod_id?

  portal_data = serialize_portals

  params[:portalData] = portal_data unless portal_data.empty?

  params
end