Module: Fortnox::RailsSerialisation::ResourceMethods

Included in:
Fortnox::Resource
Defined in:
lib/fortnox/rails.rb

Overview

:only / :except are applied by Fortnox::Serialisation rather than by ActiveSupport, so they accept string and symbol names alike. The inner as_json is then called without options — it only needs to stringify keys and recurse into nested structs.

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object

Same representation to_json produces: model attribute names.



26
27
28
# File 'lib/fortnox/rails.rb', line 26

def as_json(options = nil)
  Serialisation.filter(model.attributes, options).as_json
end