Module: Pont::Attribution
- Defined in:
- lib/pont/attribution.rb
Overview
A module for manipulating request-parameter attribution values
Class Method Summary collapse
-
.clean(input, logger = nil) ⇒ Hash
clean is a shared method for cleaning up attribution values to ensure our Prospects#attribution column contains only the data we choose.
Class Method Details
.clean(input, logger = nil) ⇒ Hash
clean is a shared method for cleaning up attribution values to ensure our Prospects#attribution column contains only the data we choose.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pont/attribution.rb', line 13 def self.clean(input, logger = nil) parsed_input = input.is_a?(String) ? JSON.parse(input) : input return {} if parsed_input.nil? parsed_input.slice(*permitted_keys) rescue JSON::ParserError, TypeError => e logger&.error("#{e.class}: #{e.} input: (#{input})") {} end |