Class: PinterestSdkClient::EventData
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PinterestSdkClient::EventData
- Defined in:
- lib/pinterest_sdk/models/event_data.rb
Overview
Optional for VISITOR audience_type. With the Pinterest tag, you can use event data to capture event details from your website. This object lists all the available predefined event data fields in the Pinterest tag. You can include these event data fields as part of a VISITOR audience’s rule; however, you must specify an event for the event_data fields to be evaluated. Besides what’s listed, you can also create your own set of event_data fields and define their usages or purposes according to your website needs. However, the benefit of using the predefined event data fields is that we can provide various metrics based on those fields’ data. Examples per event type: pagevisit "event_data": { "page_name": "My online store 123 | view items | shoe" } signup "event_data": { "lead_type": "New release promotion" } checkout "event_data": { "value": 116, "order_quantity": 2, "currency": "USD", "line_items": [ { "product_name": "Pillows (Set of 2)", "product_id": "11", "product_price": 48, "product_quantity": 1 }, { "product_name": "Pillows, Large (Set of 2)", "product_id": "15", "product_price": 68, "product_quantity": 1 } ] } addtocart "event_data": { "value": 499, "order_quantity": 1, "currency": "USD", "line_items": [ { "product_name": "Red leather boots", "product_id": "3486", "product_category": "shoe", "product_variant_id": "JB11103000", "product_price": 499, "product_quantity": "1", "product_brand": "My brand" }]} watchvideo "event_data": { "video_title": "My Product Video 01" } lead "event_data": { "lead_type": "Newsletter" }
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#currency ⇒ Object
Currency.
-
#lead_type ⇒ Object
Promotion code.
-
#line_items ⇒ Object
Returns the value of attribute line_items.
-
#order_id ⇒ Object
Order ID.
-
#order_quantity ⇒ Object
Order quantity.
-
#page_name ⇒ Object
Page name.
-
#promo_code ⇒ Object
Promotion code.
-
#property ⇒ Object
Property.
-
#search_query ⇒ Object
Search query string.
-
#value ⇒ Object
Product value.
-
#video_title ⇒ Object
Video title.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ EventData
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ EventData
Initializes the object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 125 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::EventData` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `PinterestSdkClient::EventData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'lead_type') self.lead_type = attributes[:'lead_type'] end if attributes.key?(:'line_items') self.line_items = attributes[:'line_items'] end if attributes.key?(:'order_id') self.order_id = attributes[:'order_id'] end if attributes.key?(:'order_quantity') self.order_quantity = attributes[:'order_quantity'] end if attributes.key?(:'page_name') self.page_name = attributes[:'page_name'] end if attributes.key?(:'promo_code') self.promo_code = attributes[:'promo_code'] end if attributes.key?(:'property') self.property = attributes[:'property'] end if attributes.key?(:'search_query') self.search_query = attributes[:'search_query'] end if attributes.key?(:'value') self.value = attributes[:'value'] end if attributes.key?(:'video_title') self.video_title = attributes[:'video_title'] end end |
Instance Attribute Details
#currency ⇒ Object
Currency. For example, ‘USD’.
20 21 22 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 20 def currency @currency end |
#lead_type ⇒ Object
Promotion code. For example, ‘Newsletter’.
23 24 25 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 23 def lead_type @lead_type end |
#line_items ⇒ Object
Returns the value of attribute line_items.
25 26 27 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 25 def line_items @line_items end |
#order_id ⇒ Object
Order ID. For example, ‘X-151481’.
28 29 30 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 28 def order_id @order_id end |
#order_quantity ⇒ Object
Order quantity. For example, 1.
31 32 33 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 31 def order_quantity @order_quantity end |
#page_name ⇒ Object
Page name. For example, ‘Our Favorite Pins on Pinterest’.
34 35 36 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 34 def page_name @page_name end |
#promo_code ⇒ Object
Promotion code. For example, ‘WINTER10’.
37 38 39 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 37 def promo_code @promo_code end |
#property ⇒ Object
Property. For example, ‘Athleta’.
40 41 42 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 40 def property @property end |
#search_query ⇒ Object
Search query string. For example, ‘boots’.
43 44 45 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 43 def search_query @search_query end |
#value ⇒ Object
Product value. For example, ‘199.98’.
46 47 48 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 46 def value @value end |
#video_title ⇒ Object
Video title. For example, ‘How to style your Parker Boots’.
49 50 51 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 49 def video_title @video_title end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
91 92 93 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 91 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
96 97 98 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 96 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 74 def self.attribute_map { :'currency' => :'currency', :'lead_type' => :'lead_type', :'line_items' => :'line_items', :'order_id' => :'order_id', :'order_quantity' => :'order_quantity', :'page_name' => :'page_name', :'promo_code' => :'promo_code', :'property' => :'property', :'search_query' => :'search_query', :'value' => :'value', :'video_title' => :'video_title' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 232 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
118 119 120 121 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 118 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 101 def self.openapi_types { :'currency' => :'Currency', :'lead_type' => :'String', :'line_items' => :'LineItem', :'order_id' => :'String', :'order_quantity' => :'Integer', :'page_name' => :'String', :'promo_code' => :'String', :'property' => :'String', :'search_query' => :'String', :'value' => :'String', :'video_title' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 201 def ==(o) return true if self.equal?(o) self.class == o.class && currency == o.currency && lead_type == o.lead_type && line_items == o.line_items && order_id == o.order_id && order_quantity == o.order_quantity && page_name == o.page_name && promo_code == o.promo_code && property == o.property && search_query == o.search_query && value == o.value && video_title == o.video_title end |
#eql?(o) ⇒ Boolean
219 220 221 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 219 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
225 226 227 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 225 def hash [currency, lead_type, line_items, order_id, order_quantity, page_name, promo_code, property, search_query, value, video_title].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
186 187 188 189 190 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 186 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 254 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
194 195 196 197 |
# File 'lib/pinterest_sdk/models/event_data.rb', line 194 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |