Sha256: 845cf22b70982a5556c594c9634260c1c8751f5920fd17049e579f934ff5e62a

Contents?: true

Size: 399 Bytes

Versions: 6

Compression:

Stored size: 399 Bytes

Contents

# frozen_string_literal: true

require "httparty"

# BlacklightApiFacets
class BlacklightApiFacets
  include HTTParty

  def initialize(request)
    @request = request
  end

  def fetch
    @fetch ||= self.class.get("#{@request}#{BLACKLIGHT_JSON_API_FACETS}", query: {})
  end

  def facets
    fetch["included"].filter_map { |s| s if s["type"] == "facet" } if fetch["included"].present?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
geoblacklight_admin-0.4.1 app/models/blacklight_api_facets.rb
geoblacklight_admin-0.4.0 app/models/blacklight_api_facets.rb
geoblacklight_admin-0.3.2 app/models/blacklight_api_facets.rb
geoblacklight_admin-0.3.1 app/models/blacklight_api_facets.rb
geoblacklight_admin-0.3.0 app/models/blacklight_api_facets.rb
geoblacklight_admin-0.2.1 app/models/blacklight_api_facets.rb