class GtmOnRails::DataLayer::Ecommerce::Promotion

Public Class Methods

new(**args) click to toggle source
# File lib/gtm_on_rails/models/data_layer/ecommerce/promotion.rb, line 4
def initialize(**args)
  raise ArgumentError.new("required either 'id' or 'name', or both.") if args[:id].blank? && args[:name].blank?

  @data = {}

  @data[:id]       = args[:id]       if args[:id].present?
  @data[:name]     = args[:name]     if args[:name].present?
  @data[:creative] = args[:creative] if args[:creative].present?
  @data[:position] = args[:position] if args[:position].present?
end

Public Instance Methods

to_js() click to toggle source
# File lib/gtm_on_rails/models/data_layer/ecommerce/promotion.rb, line 15
def to_js
  to_json
end