def apply_filters(options)
      return unless options.key?(:only) || options.key?(:except)

      attributes_only_filters, associations_only_filters = resolve_filters(options, :only)
      attributes_except_filters, associations_except_filters = resolve_filters(options, :except)

      self.attributes = apply_attribute_filters(
        attributes,
        attributes_only_filters,
        attributes_except_filters
      )

      self.method_fields = apply_attribute_filters(
        method_fields,
        attributes_only_filters,
        attributes_except_filters
      )

      unless has_many_associations.empty?
        self.has_many_associations = apply_association_filters(
          has_many_associations,
          { attributes: attributes_only_filters, associations: associations_only_filters },
          attributes: attributes_except_filters, associations: associations_except_filters
        )
      end

      unless has_one_associations.empty?
        self.has_one_associations = apply_association_filters(
          has_one_associations,
          { attributes: attributes_only_filters, associations: associations_only_filters },
          attributes: attributes_except_filters, associations: associations_except_filters
        )
      end
    end
def apply_filters(options)
      return unless options.key?(:only) || options.key?(:except)

      attributes_only_filters, associations_only_filters = resolve_filters(options, :only)
      attributes_except_filters, associations_except_filters = resolve_filters(options, :except)

      self.attributes = apply_attribute_filters(
        attributes,
        attributes_only_filters,
        attributes_except_filters
      )

      self.method_fields = apply_attribute_filters(
        method_fields,
        attributes_only_filters,
        attributes_except_filters
      )

      unless has_many_associations.empty?
        self.has_many_associations = apply_association_filters(
          has_many_associations,
          { attributes: attributes_only_filters, associations: associations_only_filters },
          attributes: attributes_except_filters, associations: associations_except_filters
        )
      end

      unless has_one_associations.empty?
        self.has_one_associations = apply_association_filters(
          has_one_associations,
          { attributes: attributes_only_filters, associations: associations_only_filters },
          attributes: attributes_except_filters, associations: associations_except_filters
        )
      end
    end
Applies attributes and association filters