Class: PinterestSdkClient::SSIOInsertionOrderCommon

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/ssio_insertion_order_common.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ SSIOInsertionOrderCommon

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 108

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::SSIOInsertionOrderCommon` 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::SSIOInsertionOrderCommon`. 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?(:'agency_link')
    self.agency_link = attributes[:'agency_link']
  end

  if attributes.key?(:'billing_contact_email')
    self.billing_contact_email = attributes[:'billing_contact_email']
  end

  if attributes.key?(:'billing_contact_firstname')
    self.billing_contact_firstname = attributes[:'billing_contact_firstname']
  end

  if attributes.key?(:'billing_contact_lastname')
    self.billing_contact_lastname = attributes[:'billing_contact_lastname']
  end

  if attributes.key?(:'budget_amount')
    self.budget_amount = attributes[:'budget_amount']
  end

  if attributes.key?(:'end_date')
    self.end_date = attributes[:'end_date']
  end

  if attributes.key?(:'media_contact_email')
    self.media_contact_email = attributes[:'media_contact_email']
  end

  if attributes.key?(:'media_contact_firstname')
    self.media_contact_firstname = attributes[:'media_contact_firstname']
  end

  if attributes.key?(:'media_contact_lastname')
    self.media_contact_lastname = attributes[:'media_contact_lastname']
  end

  if attributes.key?(:'po_number')
    self.po_number = attributes[:'po_number']
  end

  if attributes.key?(:'start_date')
    self.start_date = attributes[:'start_date']
  end

  if attributes.key?(:'user_email')
    self.user_email = attributes[:'user_email']
  end
end

Instance Attribute Details

URL link for agency



19
20
21
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 19

def agency_link
  @agency_link
end

#billing_contact_emailObject

The billing contact email



22
23
24
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 22

def billing_contact_email
  @billing_contact_email
end

#billing_contact_firstnameObject

The billing contact first name



25
26
27
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 25

def billing_contact_firstname
  @billing_contact_firstname
end

#billing_contact_lastnameObject

The billing contact last name



28
29
30
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 28

def billing_contact_lastname
  @billing_contact_lastname
end

#budget_amountObject

If Budget order line, the budget amount.



31
32
33
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 31

def budget_amount
  @budget_amount
end

#end_dateObject

End date of time period. Format: YYYY-MM-DD



34
35
36
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 34

def end_date
  @end_date
end

#media_contact_emailObject

The media contact email



37
38
39
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 37

def media_contact_email
  @media_contact_email
end

#media_contact_firstnameObject

The media contact first name



40
41
42
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 40

def media_contact_firstname
  @media_contact_firstname
end

#media_contact_lastnameObject

The media contact last name



43
44
45
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 43

def media_contact_lastname
  @media_contact_lastname
end

#po_numberObject

The po number



46
47
48
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 46

def po_number
  @po_number
end

#start_dateObject

Starting date of time period. Format: YYYY-MM-DD



49
50
51
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 49

def start_date
  @start_date
end

#user_emailObject

The email of user submitting the insertion order



52
53
54
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 52

def user_email
  @user_email
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



73
74
75
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 73

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



78
79
80
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 78

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 55

def self.attribute_map
  {
    :'agency_link' => :'agency_link',
    :'billing_contact_email' => :'billing_contact_email',
    :'billing_contact_firstname' => :'billing_contact_firstname',
    :'billing_contact_lastname' => :'billing_contact_lastname',
    :'budget_amount' => :'budget_amount',
    :'end_date' => :'end_date',
    :'media_contact_email' => :'media_contact_email',
    :'media_contact_firstname' => :'media_contact_firstname',
    :'media_contact_lastname' => :'media_contact_lastname',
    :'po_number' => :'po_number',
    :'start_date' => :'start_date',
    :'user_email' => :'user_email'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 262

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_nullableObject

List of attributes with nullable: true



101
102
103
104
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 101

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 83

def self.openapi_types
  {
    :'agency_link' => :'String',
    :'billing_contact_email' => :'String',
    :'billing_contact_firstname' => :'String',
    :'billing_contact_lastname' => :'String',
    :'budget_amount' => :'Float',
    :'end_date' => :'String',
    :'media_contact_email' => :'String',
    :'media_contact_firstname' => :'String',
    :'media_contact_lastname' => :'String',
    :'po_number' => :'String',
    :'start_date' => :'String',
    :'user_email' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 230

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      agency_link == o.agency_link &&
      billing_contact_email == o.billing_contact_email &&
      billing_contact_firstname == o.billing_contact_firstname &&
      billing_contact_lastname == o.billing_contact_lastname &&
      budget_amount == o.budget_amount &&
      end_date == o.end_date &&
      media_contact_email == o.media_contact_email &&
      media_contact_firstname == o.media_contact_firstname &&
      media_contact_lastname == o.media_contact_lastname &&
      po_number == o.po_number &&
      start_date == o.start_date &&
      user_email == o.user_email
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


249
250
251
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 249

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



255
256
257
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 255

def hash
  [agency_link, billing_contact_email, billing_contact_firstname, billing_contact_lastname, budget_amount, end_date, media_contact_email, media_contact_firstname, media_contact_lastname, po_number, start_date, user_email].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 173

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  if !@end_date.nil? && @end_date !~ pattern
    invalid_properties.push("invalid value for \"end_date\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  if !@start_date.nil? && @start_date !~ pattern
    invalid_properties.push("invalid value for \"start_date\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 284

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

Returns:

  • (Boolean)

    true if the model is valid



191
192
193
194
195
196
# File 'lib/pinterest_sdk/models/ssio_insertion_order_common.rb', line 191

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@end_date.nil? && @end_date !~ Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  return false if !@start_date.nil? && @start_date !~ Regexp.new(/^(\d{4})-(\d{2})-(\d{2})$/)
  true
end