Module: Roar::JSON::JSONAPI::ResourceCollection Private
- Defined in:
- lib/roar/json/json_api/resource_collection.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance method API for JSON API Documents representing an array of Resources
Instance Method Summary collapse
- #to_hash(options = {}) ⇒ Object private
Instance Method Details
#to_hash(options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/roar/json/json_api/resource_collection.rb', line 9 def to_hash( = {}) document = super(to_a: , user_options: [:user_options]) # [{data: {..}, data: {..}}] links = Renderer::Links.new.(document, ) = () included = [] document['data'].each do |single| included += single.delete('included') || [] end HashUtils.store_if_any(document, 'included', Fragment::Included.(included, )) HashUtils.store_if_any(document, 'links', links) HashUtils.store_if_any(document, 'meta', ) document end |