Class: Ecfr::RendererService::Content
- Defined in:
- lib/ecfr/renderer_service/content.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#html ⇒ String
readonly
HTML document.
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
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 |