Sha256: 09fce47d75f8d4d94118e033d03b432d38b5b22a7025ec9c08430b484aff0bd4
Contents?: true
Size: 841 Bytes
Versions: 30
Compression:
Stored size: 841 Bytes
Contents
module JsonapiCompliable module Util # Generate the options we end up passing to {{http://jsonapi-rb.org jsonapi-rb}} # @api private class RenderOptions def self.generate(object, query_hash, overrides = {}) resolved = object.respond_to?(:resolve) ? object.resolve : object options = {} options[:include] = query_hash[:include] options[:jsonapi] = resolved options[:fields] = query_hash[:fields] options.merge!(overrides) options[:meta] ||= {} options[:expose] ||= {} options[:expose][:extra_fields] = query_hash[:extra_fields] if object.respond_to?(:resolve_stats) stats = object.resolve_stats options[:meta][:stats] = stats unless stats.empty? end options end end end end
Version data entries
30 entries across 30 versions & 1 rubygems