Module: Podium::PodletHelpers
- Defined in:
- lib/podium/podlet_helpers.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #manifest ⇒ Object
- #podium_header_params ⇒ Object
- #podium_params ⇒ Object
- #set_podium_headers ⇒ Object
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 |
# File 'lib/podium/podlet_helpers.rb', line 3 def self.included(base) base.layout false base.extend(ClassMethods) base.before_action :set_podium_headers, only: [:content, :fallback] end |
Instance Method Details
#manifest ⇒ Object
9 10 11 |
# File 'lib/podium/podlet_helpers.rb', line 9 def manifest render json: self.class.podlet_manifest.to_json end |
#podium_header_params ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/podium/podlet_helpers.rb', line 21 def podium_header_params request.headers .select { |(k)| k.start_with?("HTTP_PODIUM_") } .reduce({}) do |acc, (header, value)| key = header.gsub("HTTP_PODIUM_", "").underscore acc[key] = value acc end end |
#podium_params ⇒ Object
17 18 19 |
# File 'lib/podium/podlet_helpers.rb', line 17 def podium_params @podium_params ||= ActionController::Parameters.new(podium_header_params) end |
#set_podium_headers ⇒ Object
13 14 15 |
# File 'lib/podium/podlet_helpers.rb', line 13 def set_podium_headers response.set_header("podlet-version", self.class.version) end |