Sha256: fb15df560b68f42a13847fdff4348089bc4059170664b31e40f471b924265a66
Contents?: true
Size: 999 Bytes
Versions: 8
Compression:
Stored size: 999 Bytes
Contents
module Landable module Traffic class Attribution < ActiveRecord::Base include Landable::TableName KEYS = %w[ad_type ad_group bid_match_type campaign content creative device_type experiment keyword match_type medium network placement position search_term source target] self.record_timestamps = false KEYS.each do |key| lookup_for key.to_sym, class_name: "Landable::Traffic::#{key.classify}".constantize end has_many :visits class << self def transform(parameters) hash = parameters.slice(*KEYS) filter = {} hash.each do |k, v| filter[k.foreign_key] = "Landable::Traffic::#{k.classify}".constantize[v] end filter end def lookup(parameters) where(transform(parameters)).first_or_create end def digest(parameters) Digest::SHA2.base64digest transform(parameters).values.join end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems