Module: Jat::Plugins::JsonApi::Map::ClassMethods

Included in:
Jat::Plugins::JsonApi::Map
Defined in:
lib/jat/plugins/json_api/lib/map.rb

Instance Method Summary collapse

Instance Method Details

#call(context) ⇒ Object

Returns structure like {

type1 => {
  attributes: [attr1, attr2, ...],
  relationships: [rel1, rel2, ...]
},
type2 => { ... }

}



16
17
18
19
20
21
22
# File 'lib/jat/plugins/json_api/lib/map.rb', line 16

def call(context)
  exposed = context[:exposed]&.to_sym || :default
  fields = context[:fields]
  includes = context[:include]

  construct_map(exposed, fields, includes)
end