Class: PinterestSdkClient::BillingInvoice

Inherits:
ApiModelBase show all
Defined in:
lib/pinterest_sdk/models/billing_invoice.rb

Overview

A billing invoice in the advertiser account.

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ BillingInvoice

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
213
214
215
216
217
218
219
220
221
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 148

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ad_account_idObject

The ID of the ad account this invoice belongs to



20
21
22
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 20

def 
  @ad_account_id
end

#ad_account_nameObject

The name of the ad account this invoice belongs to



23
24
25
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 23

def 
  @ad_account_name
end

#amount_billed_micro_currencyObject

The amount billed in this invoice. Denoted in micro currency



26
27
28
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 26

def amount_billed_micro_currency
  @amount_billed_micro_currency
end

#amount_discount_micro_currencyObject

The discount in this invoice. Denoted in micro currency



29
30
31
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 29

def amount_discount_micro_currency
  @amount_discount_micro_currency
end

#amount_net_micro_currencyObject

The net amount in this invoice. Denoted in micro currency



32
33
34
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 32

def amount_net_micro_currency
  @amount_net_micro_currency
end

#amount_tax_micro_currencyObject

The tax in this invoice. Denoted in micro currency



35
36
37
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 35

def amount_tax_micro_currency
  @amount_tax_micro_currency
end

#bill_to_countryObject

The country of the bill to address



38
39
40
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 38

def bill_to_country
  @bill_to_country
end

#billing_period_end_dateObject

The end date of the billing period. Format: YYYY-MM-DD



41
42
43
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 41

def billing_period_end_date
  @billing_period_end_date
end

#billing_period_start_dateObject

The start date of the billing period. Format: YYYY-MM-DD



44
45
46
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 44

def billing_period_start_date
  @billing_period_start_date
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#document_typeObject

The type of the document



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

def document_type
  @document_type
end

#idObject

Unique identifier for the billing invoice



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

def id
  @id
end

#invoice_due_dateObject

The date the invoice is due. Format: YYYY-MM-DD



55
56
57
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 55

def invoice_due_date
  @invoice_due_date
end

#payment_termsObject

The payment terms of the invoice



58
59
60
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 58

def payment_terms
  @payment_terms
end

#statusObject

The status of the invoice



61
62
63
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 61

def status
  @status
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 86

def self.attribute_map
  {
    :'ad_account_id' => :'ad_account_id',
    :'ad_account_name' => :'ad_account_name',
    :'amount_billed_micro_currency' => :'amount_billed_micro_currency',
    :'amount_discount_micro_currency' => :'amount_discount_micro_currency',
    :'amount_net_micro_currency' => :'amount_net_micro_currency',
    :'amount_tax_micro_currency' => :'amount_tax_micro_currency',
    :'bill_to_country' => :'bill_to_country',
    :'billing_period_end_date' => :'billing_period_end_date',
    :'billing_period_start_date' => :'billing_period_start_date',
    :'currency' => :'currency',
    :'document_type' => :'document_type',
    :'id' => :'id',
    :'invoice_due_date' => :'invoice_due_date',
    :'payment_terms' => :'payment_terms',
    :'status' => :'status'
  }
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



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 317

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



138
139
140
141
142
143
144
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 138

def self.openapi_nullable
  Set.new([
    :'amount_discount_micro_currency',
    :'amount_net_micro_currency',
    :'amount_tax_micro_currency',
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 117

def self.openapi_types
  {
    :'ad_account_id' => :'String',
    :'ad_account_name' => :'String',
    :'amount_billed_micro_currency' => :'Integer',
    :'amount_discount_micro_currency' => :'Integer',
    :'amount_net_micro_currency' => :'Integer',
    :'amount_tax_micro_currency' => :'Integer',
    :'bill_to_country' => :'String',
    :'billing_period_end_date' => :'Date',
    :'billing_period_start_date' => :'Date',
    :'currency' => :'Currency',
    :'document_type' => :'BillingInvoiceDocumentType',
    :'id' => :'String',
    :'invoice_due_date' => :'Date',
    :'payment_terms' => :'String',
    :'status' => :'BillingInvoiceStatus'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 282

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
       == o. &&
      amount_billed_micro_currency == o.amount_billed_micro_currency &&
      amount_discount_micro_currency == o.amount_discount_micro_currency &&
      amount_net_micro_currency == o.amount_net_micro_currency &&
      amount_tax_micro_currency == o.amount_tax_micro_currency &&
      bill_to_country == o.bill_to_country &&
      billing_period_end_date == o.billing_period_end_date &&
      billing_period_start_date == o.billing_period_start_date &&
      currency == o.currency &&
      document_type == o.document_type &&
      id == o.id &&
      invoice_due_date == o.invoice_due_date &&
      payment_terms == o.payment_terms &&
      status == o.status
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


304
305
306
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 304

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



310
311
312
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 310

def hash
  [, , amount_billed_micro_currency, amount_discount_micro_currency, amount_net_micro_currency, amount_tax_micro_currency, bill_to_country, billing_period_end_date, billing_period_start_date, currency, document_type, id, invoice_due_date, payment_terms, status].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 225

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^\d+$/)
  if !@ad_account_id.nil? && @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 !@id.nil? && @id !~ pattern
    invalid_properties.push("invalid value for \"id\", 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



339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 339

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



243
244
245
246
247
248
# File 'lib/pinterest_sdk/models/billing_invoice.rb', line 243

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@ad_account_id.nil? && @ad_account_id !~ Regexp.new(/^\d+$/)
  return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
  true
end