Class: PinterestSdkClient::ConversionMSOTEvents
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- PinterestSdkClient::ConversionMSOTEvents
- Defined in:
- lib/pinterest_sdk/models/conversion_msot_events.rb
Overview
Object containing the MSOT conversion events.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#action_timestamps ⇒ Object
Timestamp(s) when the ad action(s) happened.
-
#ad_group_id ⇒ Object
The ID of the ad group that was attributed to the conversion event.
-
#attribution_model ⇒ Object
The attribution model used to attribute the conversion event.
-
#attribution_scope ⇒ Object
Ad event type.
-
#attribution_score ⇒ Object
Credit given to the attributed ad actions.
-
#campaign_id ⇒ Object
The ID of the campaign that was attributed to the conversion event.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#event_id ⇒ Object
A unique id string that identifies this event.
-
#event_name ⇒ Object
Type of user event.
-
#event_timestamp ⇒ Object
The time when the event occurred.
-
#total_event_touchpoints ⇒ Object
Total number of ad events including other non-Pinterest ad platforms.
-
#total_events ⇒ Object
Total number of conversion events that are reported in one API call.
-
#value ⇒ Object
Order value of the conversion event.
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 = {}) ⇒ ConversionMSOTEvents
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 = {}) ⇒ ConversionMSOTEvents
Initializes the object
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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 135 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::ConversionMSOTEvents` 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::ConversionMSOTEvents`. 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?(:'action_timestamps') if (value = attributes[:'action_timestamps']).is_a?(Array) self. = value end end if attributes.key?(:'ad_group_id') self.ad_group_id = attributes[:'ad_group_id'] else self.ad_group_id = nil end if attributes.key?(:'attribution_model') self.attribution_model = attributes[:'attribution_model'] end if attributes.key?(:'attribution_scope') self.attribution_scope = attributes[:'attribution_scope'] else self.attribution_scope = nil end if attributes.key?(:'attribution_score') self.attribution_score = attributes[:'attribution_score'] end if attributes.key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'event_id') self.event_id = attributes[:'event_id'] else self.event_id = nil end if attributes.key?(:'event_name') self.event_name = attributes[:'event_name'] else self.event_name = nil end if attributes.key?(:'event_timestamp') self. = attributes[:'event_timestamp'] else self. = nil end if attributes.key?(:'total_event_touchpoints') self.total_event_touchpoints = attributes[:'total_event_touchpoints'] end if attributes.key?(:'total_events') self.total_events = attributes[:'total_events'] end if attributes.key?(:'value') self.value = attributes[:'value'] end end |
Instance Attribute Details
#action_timestamps ⇒ Object
Timestamp(s) when the ad action(s) happened. Unix timestamp in seconds.
20 21 22 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 20 def @action_timestamps end |
#ad_group_id ⇒ Object
The ID of the ad group that was attributed to the conversion event.
23 24 25 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 23 def ad_group_id @ad_group_id end |
#attribution_model ⇒ Object
The attribution model used to attribute the conversion event.
26 27 28 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 26 def attribution_model @attribution_model end |
#attribution_scope ⇒ Object
Ad event type.
29 30 31 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 29 def attribution_scope @attribution_scope end |
#attribution_score ⇒ Object
Credit given to the attributed ad actions. Allowed values are > 0 and <= 1.
32 33 34 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 32 def attribution_score @attribution_score end |
#campaign_id ⇒ Object
The ID of the campaign that was attributed to the conversion event.
35 36 37 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 35 def campaign_id @campaign_id end |
#currency ⇒ Object
Returns the value of attribute currency.
37 38 39 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 37 def currency @currency end |
#event_id ⇒ Object
A unique id string that identifies this event. If you are already sending us events through Conversions API, then this id should match the event_id sent through Conversions API.
40 41 42 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 40 def event_id @event_id end |
#event_name ⇒ Object
Type of user event.
43 44 45 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 43 def event_name @event_name end |
#event_timestamp ⇒ Object
The time when the event occurred. Unix timestamp in seconds.
46 47 48 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 46 def @event_timestamp end |
#total_event_touchpoints ⇒ Object
Total number of ad events including other non-Pinterest ad platforms.
49 50 51 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 49 def total_event_touchpoints @total_event_touchpoints end |
#total_events ⇒ Object
Total number of conversion events that are reported in one API call. <p>If you are sending one API request for one attributed conversion event then this value should be 1.</p> <p>If you are sending multiple attributed conversion events in one API request then this value should be the total number of attributed conversion events in the request.</p>
52 53 54 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 52 def total_events @total_events end |
#value ⇒ Object
Order value of the conversion event. Required if event_name is ‘add_to_cart’ or ‘checkout’.
55 56 57 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 55 def value @value end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
99 100 101 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 99 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
104 105 106 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 104 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 80 def self.attribute_map { :'action_timestamps' => :'action_timestamps', :'ad_group_id' => :'ad_group_id', :'attribution_model' => :'attribution_model', :'attribution_scope' => :'attribution_scope', :'attribution_score' => :'attribution_score', :'campaign_id' => :'campaign_id', :'currency' => :'currency', :'event_id' => :'event_id', :'event_name' => :'event_name', :'event_timestamp' => :'event_timestamp', :'total_event_touchpoints' => :'total_event_touchpoints', :'total_events' => :'total_events', :'value' => :'value' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 462 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
128 129 130 131 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 128 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 109 def self.openapi_types { :'action_timestamps' => :'Array<Integer>', :'ad_group_id' => :'String', :'attribution_model' => :'String', :'attribution_scope' => :'String', :'attribution_score' => :'Float', :'campaign_id' => :'String', :'currency' => :'Currency', :'event_id' => :'String', :'event_name' => :'String', :'event_timestamp' => :'Integer', :'total_event_touchpoints' => :'Integer', :'total_events' => :'Integer', :'value' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 429 def ==(o) return true if self.equal?(o) self.class == o.class && == o. && ad_group_id == o.ad_group_id && attribution_model == o.attribution_model && attribution_scope == o.attribution_scope && attribution_score == o.attribution_score && campaign_id == o.campaign_id && currency == o.currency && event_id == o.event_id && event_name == o.event_name && == o. && total_event_touchpoints == o.total_event_touchpoints && total_events == o.total_events && value == o.value end |
#eql?(o) ⇒ Boolean
449 450 451 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 449 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
455 456 457 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 455 def hash [, ad_group_id, attribution_model, attribution_scope, attribution_score, campaign_id, currency, event_id, event_name, , total_event_touchpoints, total_events, value].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 216 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @ad_group_id.nil? invalid_properties.push('invalid value for "ad_group_id", ad_group_id cannot be nil.') end pattern = Regexp.new(/^\d+$/) if @ad_group_id !~ pattern invalid_properties.push("invalid value for \"ad_group_id\", must conform to the pattern #{pattern}.") end if @attribution_scope.nil? invalid_properties.push('invalid value for "attribution_scope", attribution_scope cannot be nil.') end if !@attribution_score.nil? && @attribution_score > 1 invalid_properties.push('invalid value for "attribution_score", must be smaller than or equal to 1.') end if !@attribution_score.nil? && @attribution_score <= 0 invalid_properties.push('invalid value for "attribution_score", must be greater than 0.') end pattern = Regexp.new(/^\d+$/) if !@campaign_id.nil? && @campaign_id !~ pattern invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.") end if @event_id.nil? invalid_properties.push('invalid value for "event_id", event_id cannot be nil.') end if @event_id.to_s.length > 256 invalid_properties.push('invalid value for "event_id", the character length must be smaller than or equal to 256.') end if @event_name.nil? invalid_properties.push('invalid value for "event_name", event_name cannot be nil.') end if @event_timestamp.nil? invalid_properties.push('invalid value for "event_timestamp", event_timestamp cannot be nil.') end if !@total_event_touchpoints.nil? && @total_event_touchpoints < 1 invalid_properties.push('invalid value for "total_event_touchpoints", must be greater than or equal to 1.') end if !@total_events.nil? && @total_events < 1 invalid_properties.push('invalid value for "total_events", must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 484 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
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/pinterest_sdk/models/conversion_msot_events.rb', line 274 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @ad_group_id.nil? return false if @ad_group_id !~ Regexp.new(/^\d+$/) attribution_model_validator = EnumAttributeValidator.new('String', ["first_touch", "last_touch", "multi_touch"]) return false unless attribution_model_validator.valid?(@attribution_model) return false if @attribution_scope.nil? attribution_scope_validator = EnumAttributeValidator.new('String', ["view", "engagement", "click"]) return false unless attribution_scope_validator.valid?(@attribution_scope) return false if !@attribution_score.nil? && @attribution_score > 1 return false if !@attribution_score.nil? && @attribution_score <= 0 return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/^\d+$/) return false if @event_id.nil? return false if @event_id.to_s.length > 256 return false if @event_name.nil? event_name_validator = EnumAttributeValidator.new('String', ["add_to_cart", "checkout", "lead", "signup"]) return false unless event_name_validator.valid?(@event_name) return false if @event_timestamp.nil? return false if !@total_event_touchpoints.nil? && @total_event_touchpoints < 1 return false if !@total_events.nil? && @total_events < 1 true end |