Class: GtmOnRails::DataLayer::Ecommerce::Promotion
- Defined in:
- lib/gtm_on_rails/models/data_layer/ecommerce/promotion.rb
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
-
#initialize(**args) ⇒ Promotion
constructor
A new instance of Promotion.
- #to_js ⇒ Object
Methods inherited from Object
#add, #as_json, #method_missing, #to_json
Constructor Details
#initialize(**args) ⇒ Promotion
Returns a new instance of Promotion.
4 5 6 7 8 9 10 11 12 13 |
# 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GtmOnRails::DataLayer::Object
Instance Method Details
#to_js ⇒ Object
15 16 17 |
# File 'lib/gtm_on_rails/models/data_layer/ecommerce/promotion.rb', line 15 def to_js to_json end |