Class: Ecfr::AdminService::Issue
- Extended by:
- ResponseHelper
- Defined in:
- lib/ecfr/admin_service/issue.rb,
lib/ecfr/admin_service/issue/change.rb,
lib/ecfr/testing/extensions/admin_service/issue_extensions.rb
Defined Under Namespace
Classes: Change
Constant Summary collapse
- ISSUES_PATH =
"v1/issues"
Constants inherited from Base
Base::SUPPORTED_ARRAY_ACCESSORS
Instance Attribute Summary collapse
-
#changes ⇒ [Change]
readonly
array of change types and CFR reference data.
-
#description ⇒ String
readonly
US standard date description.
-
#end_date ⇒ Date
readonly
end date of issue.
-
#issue_date ⇒ Date
readonly
date of issue.
- #next ⇒ String? readonly
- #previous ⇒ String? readonly
-
#start_date ⇒ Date
readonly
start date of issue.
-
#titles ⇒ [:integer]
readonly
array of CFR title numbers affected in this issue.
Attributes inherited from Base
#metadata, #request_data, #response_status, #results
Class Method Summary collapse
-
.all ⇒ [<Issue>]
Retrieves a summary of all available issues.
-
.find(date:) ⇒ [<Issue>]
Retrieves detailed issue data for the specified date.
- .issues_path(date) ⇒ Object
- .response_for(issues) ⇒ Object
Methods included from ResponseHelper
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
Methods included from Ecfr::AttributeMethodDefinition
Methods inherited from Client
build, cache_key, client, client_pool, delete, execute, get, handle_response, perform, post, purge
Methods included from ParallelClient
Constructor Details
This class inherits a constructor from Ecfr::Base
Instance Attribute Details
#changes ⇒ [Change] (readonly)
array of change types and CFR reference data
25 26 27 |
# File 'lib/ecfr/admin_service/issue.rb', line 25 attribute :changes, type: Array(Change), desc: "array of change types and CFR reference data" |
#description ⇒ String (readonly)
US standard date description
8 9 |
# File 'lib/ecfr/admin_service/issue.rb', line 8 attribute :description, desc: "US standard date description" |
#end_date ⇒ Date (readonly)
end date of issue
15 16 17 |
# File 'lib/ecfr/admin_service/issue.rb', line 15 attribute :end_date, type: :date, desc: "end date of issue" |
#issue_date ⇒ Date (readonly)
date of issue
18 19 20 |
# File 'lib/ecfr/admin_service/issue.rb', line 18 attribute :issue_date, type: :date, desc: "date of issue" |
#next ⇒ String? (readonly)
32 33 |
# File 'lib/ecfr/admin_service/issue.rb', line 32 :next, desc: "date of next issue in ISO format" |
#previous ⇒ String? (readonly)
35 36 |
# File 'lib/ecfr/admin_service/issue.rb', line 35 :previous, desc: "date of previous issue in ISO format" |
#start_date ⇒ Date (readonly)
start date of issue
21 22 23 |
# File 'lib/ecfr/admin_service/issue.rb', line 21 attribute :start_date, type: :date, desc: "start date of issue" |
#titles ⇒ [:integer] (readonly)
array of CFR title numbers affected in this issue
11 12 13 |
# File 'lib/ecfr/admin_service/issue.rb', line 11 attribute :titles, type: Array(:integer), desc: "array of CFR title numbers affected in this issue" |
Class Method Details
.all ⇒ [<Issue>]
Retrieves a summary of all available issues
45 46 47 48 49 50 |
# File 'lib/ecfr/admin_service/issue.rb', line 45 def self.all perform( :get, "#{ISSUES_PATH}.json" ) end |
.find(date:) ⇒ [<Issue>]
Retrieves detailed issue data for the specified date. If the isssue spans multiple days and date in that timespan will return the issue
60 61 62 63 64 65 |
# File 'lib/ecfr/admin_service/issue.rb', line 60 def self.find(date:) perform( :get, issues_path(date) ) end |
.issues_path(date) ⇒ Object
67 68 69 |
# File 'lib/ecfr/admin_service/issue.rb', line 67 def self.issues_path(date) "#{ISSUES_PATH}/#{date_slug_for(date)}" end |
.response_for(issues) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/ecfr/testing/extensions/admin_service/issue_extensions.rb', line 4 def self.response_for(issues) results = { issues: issues.is_a?(Array) ? issues : [issues] }.to_json build( response: stubbed_response(results) ) end |