Class: PinterestSdkClient::CampaignResponse
- Inherits:
-
Object
- Object
- PinterestSdkClient::CampaignResponse
- Defined in:
- lib/pinterest_sdk/models/campaign_response.rb
Instance Attribute Summary collapse
-
#ad_account_id ⇒ Object
Campaign’s Advertiser ID.
-
#created_time ⇒ Object
Campaign creation time.
-
#daily_spend_cap ⇒ Object
Campaign daily spending cap.
-
#end_time ⇒ Object
Campaign end time.
-
#id ⇒ Object
Campaign ID.
-
#lifetime_spend_cap ⇒ Object
Campaign total spending cap.
-
#name ⇒ Object
Campaign name.
-
#objective_type ⇒ Object
Returns the value of attribute objective_type.
-
#order_line_id ⇒ Object
Order line ID that appears on the invoice.
-
#start_time ⇒ Object
Campaign start time.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tracking_urls ⇒ Object
Returns the value of attribute tracking_urls.
-
#type ⇒ Object
Always "campaign".
-
#updated_time ⇒ Object
UTC timestamp.
Class Method Summary collapse
-
.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_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.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.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CampaignResponse
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CampaignResponse
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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 125 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::CampaignResponse` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `PinterestSdkClient::CampaignResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'ad_account_id') self.ad_account_id = attributes[:'ad_account_id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = 'ACTIVE' end if attributes.key?(:'lifetime_spend_cap') self.lifetime_spend_cap = attributes[:'lifetime_spend_cap'] end if attributes.key?(:'daily_spend_cap') self.daily_spend_cap = attributes[:'daily_spend_cap'] end if attributes.key?(:'order_line_id') self.order_line_id = attributes[:'order_line_id'] end if attributes.key?(:'tracking_urls') if (value = attributes[:'tracking_urls']).is_a?(Hash) self.tracking_urls = value end self.tracking_urls = attributes[:'tracking_urls'] end if attributes.key?(:'start_time') self.start_time = attributes[:'start_time'] end if attributes.key?(:'end_time') self.end_time = attributes[:'end_time'] end if attributes.key?(:'objective_type') self.objective_type = attributes[:'objective_type'] end if attributes.key?(:'created_time') self.created_time = attributes[:'created_time'] end if attributes.key?(:'updated_time') self.updated_time = attributes[:'updated_time'] end if attributes.key?(:'type') self.type = attributes[:'type'] end end |
Instance Attribute Details
#ad_account_id ⇒ Object
Campaign’s Advertiser ID.
22 23 24 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 22 def ad_account_id @ad_account_id end |
#created_time ⇒ Object
Campaign creation time. Unix timestamp in seconds.
49 50 51 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 49 def created_time @created_time end |
#daily_spend_cap ⇒ Object
Campaign daily spending cap.
33 34 35 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 33 def daily_spend_cap @daily_spend_cap end |
#end_time ⇒ Object
Campaign end time. Unix timestamp in seconds. Only used for Campaign Budget Optimization (CBO) campaigns.
44 45 46 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 44 def end_time @end_time end |
#id ⇒ Object
Campaign ID.
19 20 21 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 19 def id @id end |
#lifetime_spend_cap ⇒ Object
Campaign total spending cap.
30 31 32 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 30 def lifetime_spend_cap @lifetime_spend_cap end |
#name ⇒ Object
Campaign name.
25 26 27 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 25 def name @name end |
#objective_type ⇒ Object
Returns the value of attribute objective_type.
46 47 48 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 46 def objective_type @objective_type end |
#order_line_id ⇒ Object
Order line ID that appears on the invoice.
36 37 38 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 36 def order_line_id @order_line_id end |
#start_time ⇒ Object
Campaign start time. Unix timestamp in seconds. Only used for Campaign Budget Optimization (CBO) campaigns.
41 42 43 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 41 def start_time @start_time end |
#status ⇒ Object
Returns the value of attribute status.
27 28 29 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 27 def status @status end |
#tracking_urls ⇒ Object
Returns the value of attribute tracking_urls.
38 39 40 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 38 def tracking_urls @tracking_urls end |
#type ⇒ Object
Always "campaign".
55 56 57 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 55 def type @type end |
#updated_time ⇒ Object
UTC timestamp. Last update time.
52 53 54 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 52 def updated_time @updated_time end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
78 79 80 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 78 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 58 def self.attribute_map { :'id' => :'id', :'ad_account_id' => :'ad_account_id', :'name' => :'name', :'status' => :'status', :'lifetime_spend_cap' => :'lifetime_spend_cap', :'daily_spend_cap' => :'daily_spend_cap', :'order_line_id' => :'order_line_id', :'tracking_urls' => :'tracking_urls', :'start_time' => :'start_time', :'end_time' => :'end_time', :'objective_type' => :'objective_type', :'created_time' => :'created_time', :'updated_time' => :'updated_time', :'type' => :'type' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
318 319 320 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 318 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
115 116 117 118 119 120 121 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 115 def self.openapi_all_of [ :'CampaignCommon', :'CampaignResponseAllOf', :'CampaignResponseAllOf1' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 103 def self.openapi_nullable Set.new([ :'lifetime_spend_cap', :'daily_spend_cap', :'order_line_id', :'tracking_urls', :'start_time', :'end_time', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 83 def self.openapi_types { :'id' => :'String', :'ad_account_id' => :'String', :'name' => :'String', :'status' => :'EntityStatus', :'lifetime_spend_cap' => :'Integer', :'daily_spend_cap' => :'Integer', :'order_line_id' => :'String', :'tracking_urls' => :'TrackingUrls', :'start_time' => :'Integer', :'end_time' => :'Integer', :'objective_type' => :'ObjectiveType', :'created_time' => :'Integer', :'updated_time' => :'Integer', :'type' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 284 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && ad_account_id == o.ad_account_id && name == o.name && status == o.status && lifetime_spend_cap == o.lifetime_spend_cap && daily_spend_cap == o.daily_spend_cap && order_line_id == o.order_line_id && tracking_urls == o.tracking_urls && start_time == o.start_time && end_time == o.end_time && objective_type == o.objective_type && created_time == o.created_time && updated_time == o.updated_time && type == o.type end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 348 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = PinterestSdkClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 419 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 325 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
305 306 307 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 305 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
311 312 313 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 311 def hash [id, ad_account_id, name, status, lifetime_spend_cap, daily_spend_cap, order_line_id, tracking_urls, start_time, end_time, objective_type, created_time, updated_time, type].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 202 def list_invalid_properties invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end pattern = Regexp.new(/^\d+$/) if @id !~ pattern invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") end if @ad_account_id.nil? invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.') end pattern = Regexp.new(/^\d+$/) if @ad_account_id !~ pattern invalid_properties.push("invalid value for \"ad_account_id\", must conform to the pattern #{pattern}.") end pattern = Regexp.new(/^\d+$/) if !@order_line_id.nil? && @order_line_id !~ pattern invalid_properties.push("invalid value for \"order_line_id\", must conform to the pattern #{pattern}.") end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
395 396 397 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 395 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 401 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 |
#to_s ⇒ String
Returns the string representation of the object
389 390 391 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 389 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
232 233 234 235 236 237 238 239 |
# File 'lib/pinterest_sdk/models/campaign_response.rb', line 232 def valid? return false if @id.nil? return false if @id !~ Regexp.new(/^\d+$/) return false if @ad_account_id.nil? return false if @ad_account_id !~ Regexp.new(/^\d+$/) return false if !@order_line_id.nil? && @order_line_id !~ Regexp.new(/^\d+$/) true end |