Class: Roar::JSON::JSONAPI::Options::Include Private
- Inherits:
-
Object
- Object
- Roar::JSON::JSONAPI::Options::Include
- Defined in:
- lib/roar/json/json_api/options.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Transforms field:
and include:
` options to their internal
equivalents.
Constant Summary collapse
- DEFAULT_INTERNAL_INCLUDES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[:attributes, :relationships].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(options, mappings) ⇒ 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.
13 14 15 |
# File 'lib/roar/json/json_api/options.rb', line 13 def self.call(, mappings) new.(, mappings) end |
Instance Method Details
#call(options, mappings) ⇒ 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.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/roar/json/json_api/options.rb', line 17 def call(, mappings) include, fields = *.values_at(:include, :fields) return if [:_json_api_parsed] || !(include || fields) = {} rewrite_include_option!(, include, mappings.fetch(:id, :id)) rewrite_fields!(, fields, mappings.fetch(:relationships, {})) .reject { |key, _| [:include, :fields].include?(key) } .merge() end |