Class: JsonapiCompliable::Util::RenderOptions Private
- Inherits:
-
Object
- Object
- JsonapiCompliable::Util::RenderOptions
- Defined in:
- lib/jsonapi_compliable/util/render_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.
Generate the options we end up passing to jsonapi-rb}
Class Method Summary collapse
Class Method Details
.generate(object, query_hash, overrides = {}) ⇒ 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.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jsonapi_compliable/util/render_options.rb', line 6 def self.generate(object, query_hash, overrides = {}) resolved = object.respond_to?(:resolve) ? object.resolve : object = {} [:include] = query_hash[:include] [:jsonapi] = resolved [:fields] = query_hash[:fields] .merge!(overrides) [:meta] ||= {} [:expose] ||= {} [:expose][:extra_fields] = query_hash[:extra_fields] if object.respond_to?(:resolve_stats) stats = object.resolve_stats [:meta][:stats] = stats unless stats.empty? end end |