Sha256: d72353aaa4b37d5373b1b4c615305c6ab0fcb0bc088eb7978d7f2d1f271e15d3
Contents?: true
Size: 1007 Bytes
Versions: 8
Compression:
Stored size: 1007 Bytes
Contents
module Landable module Traffic class Attribution < ActiveRecord::Base include Landable::Traffic::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