Class: Ecfr::VersionerService::Title

Inherits:
Base show all
Extended by:
ResponseHelper
Defined in:
lib/ecfr/versioner_service/title.rb,
lib/ecfr/testing/extensions/versioner_service/title_extenstions.rb

Overview

The titles API endpoint provides information about the status of each title and the overall system processing status.

At most times the up_to_date_as_of date will be the same for all titles. Only when the system import is in process (each evening) or if reprocessing is being performed will these dates differ.

If any title is currently importing or being reprocessed the processing_in_progress attribute will be set.

The lastest_amended_on indicates the last time the Title has a substantive change occur. The latest_issue_date is the most recent date that we received the title for processing. These two attributes will generally only differ when we receive non-sunstantive updates (changes to fix minor spelling, punctuation, etc.).

Constant Summary collapse

TITLES_PATH =
"v1/titles"

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 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

Constructor Details

This class inherits a constructor from Ecfr::Base

Instance Attribute Details

#dateDate (readonly)

the max up to date value of all Titles

Returns:

  • (Date)


51
52
53
# File 'lib/ecfr/versioner_service/title.rb', line 51

 :date,
type: :date,
desc: "the max up to date value of all Titles"

#import_in_progressBoolean (readonly)

whether any Title is undergoing processing

Returns:

  • (Boolean)


54
55
56
# File 'lib/ecfr/versioner_service/title.rb', line 54

 :import_in_progress,
type: :boolean,
desc: "whether any Title is undergoing processing"

#latest_amended_onDate (readonly)

the most recent date that the Title has been amended on

Returns:

  • (Date)


39
40
41
# File 'lib/ecfr/versioner_service/title.rb', line 39

attribute :latest_amended_on,
type: :date,
desc: "the most recent date that the Title has been amended on"

#latest_issue_dateDate (readonly)

the most recent issue of the Title

Returns:

  • (Date)


42
43
44
# File 'lib/ecfr/versioner_service/title.rb', line 42

attribute :latest_issue_date,
type: :date,
desc: "the most recent issue of the Title"

#nameString (readonly)

name of Title

Returns:

  • (String)


25
26
# File 'lib/ecfr/versioner_service/title.rb', line 25

attribute :name,
desc: "name of Title"

#numberInteger (readonly)

Title number

Returns:

  • (Integer)


28
29
30
# File 'lib/ecfr/versioner_service/title.rb', line 28

attribute :number,
type: :integer,
desc: "Title number"

#processing_in_progressBoolean (readonly)

whether the Title is currently being processed

Returns:

  • (Boolean)


32
33
34
# File 'lib/ecfr/versioner_service/title.rb', line 32

attribute :processing_in_progress,
type: :boolean,
desc: "whether the Title is currently being processed"

#reservedBoolean (readonly)

whether the Title is Reserved

Returns:

  • (Boolean)


35
36
37
# File 'lib/ecfr/versioner_service/title.rb', line 35

attribute :reserved,
type: :boolean,
desc: "whether the Title is Reserved"

#up_to_date_as_ofDate (readonly)

the date through which the Title considered curent

Returns:

  • (Date)


45
46
47
# File 'lib/ecfr/versioner_service/title.rb', line 45

attribute :up_to_date_as_of,
type: :date,
desc: "the date through which the Title considered curent"

Class Method Details

.all(options = {}) ⇒ <Title>

Retreive the list of all Titles

Parameters:

  • options (<Hash>) (defaults to: {})

Options Hash (options):

  • :build_id (String)

    internal use only - used to retreive data about a specific build

Returns:

  • (<Title>)

    array of Titles with data



69
70
71
72
73
74
75
# File 'lib/ecfr/versioner_service/title.rb', line 69

def self.all(options = {})
  perform(
    :get,
    TITLES_PATH,
    params: options.compact
  )
end

.response_for(titles) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ecfr/testing/extensions/versioner_service/title_extenstions.rb', line 4

def self.response_for(titles)
  titles = titles.is_a?(Array) ? titles : [titles]

  results = {
    titles: titles,
    meta: titles.first.fetch("meta", nil)
  }.compact

  build(
    response: stubbed_response(results.to_json)
  )
end