Class: Ecfr::AdminService::EcfrCorrection

Inherits:
Base
  • Object
show all
Extended by:
ResponseHelper
Defined in:
lib/ecfr/admin_service/ecfr_correction.rb,
lib/ecfr/admin_service/ecfr_correction/cfr_reference.rb,
lib/ecfr/testing/extensions/admin_service/ecfr_correction_extensions.rb

Defined Under Namespace

Classes: CfrReference

Constant Summary collapse

CORRECTIONS_PATH =
"v1/corrections.json"

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from ResponseHelper

stubbed_response

Methods inherited from Base

base_url, service_name, service_path

Instance Attribute Details

#cfr_references[CfrReference] (readonly)

the portions of the CFR this correction applies to

Returns:



35
36
37
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 35

attribute :cfr_references,
type: Array(CfrReference),
desc: "the portions of the CFR this correction applies to"

#corrective_actionString (readonly)

description of action taken

Returns:

  • (String)


8
9
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 8

attribute :corrective_action,
desc: "description of action taken"

#display_in_tocBoolean (readonly)

whether this correction should be displayed on table of contents pages

Returns:

  • (Boolean)


39
40
41
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 39

attribute :display_in_toc,
type: :boolean,
desc: "whether this correction should be displayed on table of contents pages"

#error_correctedDate (readonly)

date error was corrected

Returns:

  • (Date)


25
26
27
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 25

attribute :error_corrected,
type: :date,
desc: "date error was corrected"

#error_occurredDate (readonly)

date error first occured

Returns:

  • (Date)


28
29
30
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 28

attribute :error_occurred,
type: :date,
desc: "date error first occured"

#fr_citationString (readonly)

Federal Register citation in form of '80 FR 12345'

Returns:

  • (String)


10
11
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 10

attribute :fr_citation,
desc: "Federal Register citation in form of '80 FR 12345'"

#idInteger (readonly)

Returns:

  • (Integer)


13
14
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 13

attribute :id,
type: :integer

#last_modifiedDate (readonly)

date this correction was last modified

Returns:

  • (Date)


31
32
33
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 31

attribute :last_modified,
type: :date,
desc: "date this correction was last modified"

#positionInteger (readonly)

position of correction in list

Returns:

  • (Integer)


15
16
17
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 15

attribute :position,
type: :integer,
desc: "position of correction in list"

#titleInteger (readonly)

CFR Title

Returns:

  • (Integer)


18
19
20
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 18

attribute :title,
type: :integer,
desc: "CFR Title"

#yearInteger (readonly)

year of corrective action

Returns:

  • (Integer)


21
22
23
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 21

attribute :year,
type: :integer,
desc: "year of corrective action"

Class Method Details

.all[<EcfrCorrection>]

Retrieve the list of all corrections

Returns:



50
51
52
53
54
55
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 50

def self.all
  perform(
    :get,
    CORRECTIONS_PATH
  )
end

.response_for(corrections) ⇒ Object



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

def self.response_for(corrections)
  results = {
    ecfr_corrections: corrections.is_a?(Array) ? corrections : [corrections]
  }.to_json

  build(
    response: stubbed_response(results)
  )
end

.where(args) ⇒ [<EcfrCorrection>]

Retrieve a list of corrections filtered by the provided parameters

Parameters:

  • args (<Hash>)

    parameters by which to filter the results; supported args:

    • :date
    • :error_corrected_date
    • :title

Returns:



67
68
69
70
71
72
73
74
75
# File 'lib/ecfr/admin_service/ecfr_correction.rb', line 67

def self.where(args)
  args.slice!(:date, :error_corrected_date, :title)

  perform(
    :get,
    CORRECTIONS_PATH,
    params: args
  )
end