Class: Ecfr::RendererService::Content
- Defined in:
- lib/ecfr/renderer_service/content.rb
Constant Summary
Constants inherited from Base
Constants inherited from Base
Base::SUPPORTED_ARRAY_ACCESSORS
Instance Attribute Summary collapse
-
#html ⇒ String
readonly
HTML document.
Attributes inherited from Base
#metadata, #request_data, #response_status, #results
Class Method Summary collapse
- .find(date, hierarchy, options = {}, client_options: {}) ⇒ Object
- .url_for(date, title_number, view_mode: "enhanced", params: {}) ⇒ Object
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
#html ⇒ String (readonly)
HTML document
4 5 |
# File 'lib/ecfr/renderer_service/content.rb', line 4 attribute :html, desc: "HTML document" |
Class Method Details
.find(date, hierarchy, options = {}, client_options: {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ecfr/renderer_service/content.rb', line 7 def self.find(date, hierarchy, = {}, client_options: {}) hierarchy = hierarchy.dup title = hierarchy.delete(:title) view_mode = .delete(:view_mode) complete = hierarchy.delete(:complete) [:skip_ancestry_checks] = 1 if complete new( { html: get( content_path(date, title, view_mode: view_mode), hierarchy.merge(), ).body }.stringify_keys ) end |
.url_for(date, title_number, view_mode: "enhanced", params: {}) ⇒ Object
27 28 29 30 31 |
# File 'lib/ecfr/renderer_service/content.rb', line 27 def self.url_for(date, title_number, view_mode: "enhanced", params: {}) path = content_path(date, title_number, view_mode: view_mode) client.build_url(path, params).to_s end |