Class: SearchSolrTools::Helpers::FacetConfiguration
- Inherits:
-
Object
- Object
- SearchSolrTools::Helpers::FacetConfiguration
- Includes:
- Singleton
- Defined in:
- lib/search_solr_tools/helpers/facet_configuration.rb
Overview
Singleton configuration class to get and parse the binning configuration from the catalog services endpoint
Class Method Summary collapse
Class Method Details
.get_facet_bin(facet_name) ⇒ Object
21 22 23 |
# File 'lib/search_solr_tools/helpers/facet_configuration.rb', line 21 def self.get_facet_bin(facet_name) @bin_configuration.select { |x| x['facet_name'] == facet_name }.sort_by! { |x| x['order_value'] } end |
.import_bin_configuration(env) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/search_solr_tools/helpers/facet_configuration.rb', line 13 def self.import_bin_configuration(env) return unless @bin_configuration.nil? @bin_configuration = JSON.parse( RestClient::Request.execute(method: :get, url: "#{SolrEnvironments[env][:nsidc_dataset_metadata_url]}binConfiguration", verify_ssl: OpenSSL::SSL::VERIFY_NONE) ) end |