Class: Ecfr::SearchService::DateFacet

Inherits:
FacetBase show all
Extended by:
ResponseHelper
Includes:
FacetAttributeMethodDefinition
Defined in:
lib/ecfr/search_service/date_facet.rb,
lib/ecfr/testing/extensions/search_service/date_facet_extensions.rb

Constant Summary

Constants inherited from FacetBase

FacetBase::COUNTS_PATH, FacetBase::VALID_SEARCH_OPTIONS

Constants inherited from Base

Base::SUPPORTED_ARRAY_ACCESSORS

Instance Attribute Summary collapse

Attributes inherited from Base

#metadata, #request_data, #response_status, #results

Class Method Summary collapse

Methods included from ResponseHelper

stubbed_response

Methods included from FacetAttributeMethodDefinition

#count_for, included, #initialize

Methods inherited from Base

base_url, service_name, service_path

Methods inherited from Base

basic_auth_client_options, #each, #initialize, metadata, metadata_key, result_key

Methods included from Extensible

#inherited

Methods included from AttributeMethodDefinition

included, #initialize

Methods inherited from Client

build, cache_key, client, client_pool, delete, execute, get, handle_response, perform, post, purge

Methods included from ParallelClient

included

Instance Attribute Details

#countString (readonly)

Returns:

  • (String)


8
# File 'lib/ecfr/search_service/date_facet.rb', line 8

attribute :count, as: :value

#dateDate (readonly)

Returns:

  • (Date)


9
# File 'lib/ecfr/search_service/date_facet.rb', line 9

attribute :date, type: :date, as: :key

Class Method Details

.response_for(date_facets) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/ecfr/testing/extensions/search_service/date_facet_extensions.rb', line 4

def self.response_for(date_facets)
  results = {
    dates: date_facets
  }.to_json

  build(
    response: stubbed_response(results)
  )
end

.search(type, options = {}) ⇒ <DateFacet>

Returns counts by date.

Parameters:

  • type (<Symbol, String>)

    currently only supports :daily

Returns:



13
14
15
16
# File 'lib/ecfr/search_service/date_facet.rb', line 13

def self.search(type, options = {})
  # no-op documentation only
  super(type, options)
end