Class: Ecfr::RendererService::Origin
- Extended by:
- ResponseHelper
- Defined in:
- lib/ecfr/renderer_service/origin.rb,
lib/ecfr/testing/extensions/renderer_service/origin_extensions.rb
Overview
The Origin API endpoint returns metadata about Source and Authority for the requested hierachy. This metadata is provided for each part in the requested hierarchy as well as any subpart and section/appendix if there are any specific to those levels.
Constant Summary collapse
- ORIGIN_PATH =
"v1/origin"
Constants inherited from Base
Constants inherited from Base
Base::SUPPORTED_ARRAY_ACCESSORS
Instance Attribute Summary collapse
-
#authority ⇒ [:string]
readonly
the Authority content for the level.
-
#current ⇒ Boolean
readonly
whether this is the hierarchy level requested (instead of an ancestor or descendant).
- #hierarchy ⇒ Ecfr::Common::Hierarchy readonly
-
#identifier ⇒ String
readonly
the identifier portion of the level (ex. ‘121’).
-
#label_level ⇒ String
readonly
the full identifier and label (ex. ‘Part 121’).
-
#level ⇒ String
readonly
the level being represented (ex. ‘part’).
-
#link ⇒ String
readonly
the path portion of a link to the content for the hierarchy provided.
-
#source ⇒ [:string]
readonly
the Source content for the level.
-
#title ⇒ String
readonly
the description of the level.
Attributes inherited from Base
#metadata, #request_data, #response_status, #results
Class Method Summary collapse
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 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
#authority ⇒ [:string] (readonly)
the Authority content for the level
24 25 26 |
# File 'lib/ecfr/renderer_service/origin.rb', line 24 attribute :authority, type: Array(:string), desc: "the Authority content for the level" |
#current ⇒ Boolean (readonly)
whether this is the hierarchy level requested (instead of an ancestor or descendant)
31 32 33 |
# File 'lib/ecfr/renderer_service/origin.rb', line 31 attribute :current, type: :boolean, desc: "whether this is the hierarchy level requested (instead of an ancestor or descendant)" |
#hierarchy ⇒ Ecfr::Common::Hierarchy (readonly)
35 36 |
# File 'lib/ecfr/renderer_service/origin.rb', line 35 attribute :hierarchy, type: Ecfr::Common::Hierarchy |
#identifier ⇒ String (readonly)
the identifier portion of the level (ex. ‘121’)
13 14 |
# File 'lib/ecfr/renderer_service/origin.rb', line 13 attribute :identifier, desc: "the identifier portion of the level (ex. '121')" |
#label_level ⇒ String (readonly)
the full identifier and label (ex. ‘Part 121’)
15 16 |
# File 'lib/ecfr/renderer_service/origin.rb', line 15 attribute :label_level, desc: "the full identifier and label (ex. 'Part 121')" |
#level ⇒ String (readonly)
the level being represented (ex. ‘part’)
17 18 |
# File 'lib/ecfr/renderer_service/origin.rb', line 17 attribute :level, desc: "the level being represented (ex. 'part')" |
#link ⇒ String (readonly)
the path portion of a link to the content for the hierarchy provided
19 20 |
# File 'lib/ecfr/renderer_service/origin.rb', line 19 attribute :link, desc: "the path portion of a link to the content for the hierarchy provided" |
#source ⇒ [:string] (readonly)
the Source content for the level
27 28 29 |
# File 'lib/ecfr/renderer_service/origin.rb', line 27 attribute :source, type: Array(:string), desc: "the Source content for the level" |
#title ⇒ String (readonly)
the description of the level
21 22 |
# File 'lib/ecfr/renderer_service/origin.rb', line 21 attribute :title, desc: "the description of the level" |
Class Method Details
.find(date, title_number, params = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ecfr/renderer_service/origin.rb', line 40 def self.find(date, title_number, params = {}) supported_params = ( Ecfr::Constants::Hierarchy::HIERARCHY_LEVELS[1, 8] + [:build_id] ).map(&:to_sym) perform( :get, origin_path(date, title_number), params: params.slice(*supported_params) ) end |
.response_for(origins) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/ecfr/testing/extensions/renderer_service/origin_extensions.rb', line 4 def self.response_for(origins) results = { origins: origins.is_a?(Array) ? origins : [origins] } build( response: stubbed_response(results.to_json) ) end |