Class: Queries::Download::Filter

Inherits:
Query::Filter show all
Defined in:
lib/queries/download/filter.rb

Constant Summary collapse

PARAMS =
[
  :download_id,
  :download_type,
  download_id: [],
  download_type: [],
].freeze

Constants inherited from Query::Filter

Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES

Instance Attribute Summary collapse

Attributes inherited from Query::Filter

#api, #asserted_distribution_query, #biological_association_query, #biological_associations_graph_query, #collecting_event_query, #collection_object_query, #content_query, #controlled_vocabulary_term_query, #data_attribute_query, #descriptor_query, #extract_query, #field_occurrence_query, #image_query, #loan_query, #object_global_id, #observation_query, #otu_query, #page, #paginate, #params, #per, #person_query, #project_id, #recent, #taxon_name_query, #venn, #venn_mode

Attributes inherited from Query

#query_string, #terms

Instance Method Summary collapse

Methods inherited from Query::Filter

#all, #all_and_clauses, #all_merge_clauses, #annotator_and_clauses, #annotator_merge_clauses, annotator_params, api_except_params, api_excluded_params, #apply_venn, #attribute_exact_facet, base_filter, #deep_permit, included_annotator_facets, inverted_subqueries, #merge_clauses, #model_id_facet, #object_global_id_facet, params, #permitted_params, #process_url_into_params, #project_id_facet, query_name, #query_name, #set_nested_queries, #shared_and_clauses, #subquery_vector, #venn_query

Methods inherited from Query

#alphabetic_strings, #alphanumeric_strings, base_name, #base_name, #base_query, #build_terms, #cached_facet, #end_wildcard, #levenshtein_distance, #match_ordered_wildcard_pieces_in_cached, #no_terms?, referenced_klass, #referenced_klass, #referenced_klass_except, #referenced_klass_intersection, #referenced_klass_union, #start_and_end_wildcard, #start_wildcard, #table, #wildcard_pieces

Constructor Details

#initialize(query_params) ⇒ Filter

Returns a new instance of Filter.



21
22
23
24
25
# File 'lib/queries/download/filter.rb', line 21

def initialize(query_params)
  super
  @download_type = params[:download_type]
  @download_Id = params[:download_id]
end

Instance Attribute Details

#download_idObject

TODO: Add date/expiry facets



14
15
16
# File 'lib/queries/download/filter.rb', line 14

def download_id
  @download_id
end

#download_typeObject

Parameters:

  • download_type (Array. String)

    like ‘Download::DwcArchive’, one of the models in app/models/download



18
19
20
# File 'lib/queries/download/filter.rb', line 18

def download_type
  @download_type
end

Instance Method Details

#and_clausesObject



40
41
42
43
44
# File 'lib/queries/download/filter.rb', line 40

def and_clauses
  [
    download_type_facet
  ]
end

#download_type_facetObject



35
36
37
38
# File 'lib/queries/download/filter.rb', line 35

def download_type_facet
  return nil if download_type.nil?
  table[:type].in(download_type)
end