Module: JsonapiCompliable::Scoping::Filterable Private
- Included in:
- DefaultFilter, Filter
- Defined in:
- lib/jsonapi_compliable/scoping/filterable.rb
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 Summary collapse
- #filter_param ⇒ Object private
- #find_filter(name) ⇒ Object private
- #find_filter!(name) ⇒ Object private
Instance Method Details
#filter_param ⇒ 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.
23 24 25 |
# File 'lib/jsonapi_compliable/scoping/filterable.rb', line 23 def filter_param query_hash[:filter] end |
#find_filter(name) ⇒ 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.
5 6 7 8 9 |
# File 'lib/jsonapi_compliable/scoping/filterable.rb', line 5 def find_filter(name) find_filter!(name) rescue JsonapiCompliable::Errors::BadFilter nil end |
#find_filter!(name) ⇒ 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.
12 13 14 15 16 17 18 19 20 |
# File 'lib/jsonapi_compliable/scoping/filterable.rb', line 12 def find_filter!(name) filter_name, filter_value = \ resource.filters.find { |_name, opts| opts[:aliases].include?(name.to_sym) } raise JsonapiCompliable::Errors::BadFilter unless filter_name if guard = filter_value[:if] raise JsonapiCompliable::Errors::BadFilter if resource.context.send(guard) == false end { filter_name => filter_value } end |