Class: FactPulse::InvoiceLine

Inherits:
ApiModelBase show all
Defined in:
lib/factpulse/models/invoice_line.rb

Overview

Represents an invoice line item (BG-25).

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
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
386
387
388
389
# File 'lib/factpulse/models/invoice_line.rb', line 228

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

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

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

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

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

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

  if attributes.key?(:'item_name')
    self.item_name = attributes[:'item_name']
  else
    self.item_name = nil
  end

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

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

  if attributes.key?(:'characteristics')
    if (value = attributes[:'characteristics']).is_a?(Array)
      self.characteristics = value
    end
  end

  if attributes.key?(:'classifications')
    if (value = attributes[:'classifications']).is_a?(Array)
      self.classifications = value
    end
  end

  if attributes.key?(:'quantity')
    self.quantity = attributes[:'quantity']
  else
    self.quantity = nil
  end

  if attributes.key?(:'unit')
    self.unit = attributes[:'unit']
  else
    self.unit = nil
  end

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

  if attributes.key?(:'unit_net_price')
    self.unit_net_price = attributes[:'unit_net_price']
  else
    self.unit_net_price = nil
  end

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

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

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

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

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

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

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

  if attributes.key?(:'allowances_charges')
    if (value = attributes[:'allowances_charges']).is_a?(Array)
      self.allowances_charges = value
    end
  end

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

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

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

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

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

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

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

  if attributes.key?(:'additional_documents')
    if (value = attributes[:'additional_documents']).is_a?(Array)
      self.additional_documents = value
    end
  end

  if attributes.key?(:'line_notes')
    if (value = attributes[:'line_notes']).is_a?(Array)
      self.line_notes = value
    end
  end
end

Instance Attribute Details

#accounting_account ⇒ Object

Returns the value of attribute accounting_account.



80
81
82
# File 'lib/factpulse/models/invoice_line.rb', line 80

def 
  @accounting_account
end

#additional_documents ⇒ Object

Returns the value of attribute additional_documents.



82
83
84
# File 'lib/factpulse/models/invoice_line.rb', line 82

def additional_documents
  @additional_documents
end

#allowance_amount ⇒ Object

Returns the value of attribute allowance_amount.



60
61
62
# File 'lib/factpulse/models/invoice_line.rb', line 60

def allowance_amount
  @allowance_amount
end

#allowance_reason ⇒ Object

Returns the value of attribute allowance_reason.



64
65
66
# File 'lib/factpulse/models/invoice_line.rb', line 64

def allowance_reason
  @allowance_reason
end

#allowance_reason_code ⇒ Object

Returns the value of attribute allowance_reason_code.



62
63
64
# File 'lib/factpulse/models/invoice_line.rb', line 62

def allowance_reason_code
  @allowance_reason_code
end

#allowances_charges ⇒ Object

Returns the value of attribute allowances_charges.



66
67
68
# File 'lib/factpulse/models/invoice_line.rb', line 66

def allowances_charges
  @allowances_charges
end

#buyer_assigned_id ⇒ Object

Returns the value of attribute buyer_assigned_id.



26
27
28
# File 'lib/factpulse/models/invoice_line.rb', line 26

def buyer_assigned_id
  @buyer_assigned_id
end

#characteristics ⇒ Object

Returns the value of attribute characteristics.



39
40
41
# File 'lib/factpulse/models/invoice_line.rb', line 39

def characteristics
  @characteristics
end

#classifications ⇒ Object

Returns the value of attribute classifications.



41
42
43
# File 'lib/factpulse/models/invoice_line.rb', line 41

def classifications
  @classifications
end

#gross_unit_price ⇒ Object

Returns the value of attribute gross_unit_price.



48
49
50
# File 'lib/factpulse/models/invoice_line.rb', line 48

def gross_unit_price
  @gross_unit_price
end

#item_description ⇒ Object

Returns the value of attribute item_description.



35
36
37
# File 'lib/factpulse/models/invoice_line.rb', line 35

def item_description
  @item_description
end

#item_name ⇒ Object

Item name (BT-153).



33
34
35
# File 'lib/factpulse/models/invoice_line.rb', line 33

def item_name
  @item_name
end

#line_net_amount ⇒ Object

Returns the value of attribute line_net_amount.



58
59
60
# File 'lib/factpulse/models/invoice_line.rb', line 58

def line_net_amount
  @line_net_amount
end

#line_note ⇒ Object

Returns the value of attribute line_note.



22
23
24
# File 'lib/factpulse/models/invoice_line.rb', line 22

def line_note
  @line_note
end

#line_notes ⇒ Object

Returns the value of attribute line_notes.



84
85
86
# File 'lib/factpulse/models/invoice_line.rb', line 84

def line_notes
  @line_notes
end

#line_number ⇒ Object

Invoice line identifier (BT-126).



20
21
22
# File 'lib/factpulse/models/invoice_line.rb', line 20

def line_number
  @line_number
end

#manual_vat_rate ⇒ Object

Returns the value of attribute manual_vat_rate.



70
71
72
# File 'lib/factpulse/models/invoice_line.rb', line 70

def manual_vat_rate
  @manual_vat_rate
end

#origin_country ⇒ Object

Returns the value of attribute origin_country.



37
38
39
# File 'lib/factpulse/models/invoice_line.rb', line 37

def origin_country
  @origin_country
end

#period_end_date ⇒ Object

Returns the value of attribute period_end_date.



76
77
78
# File 'lib/factpulse/models/invoice_line.rb', line 76

def period_end_date
  @period_end_date
end

#period_start_date ⇒ Object

Returns the value of attribute period_start_date.



74
75
76
# File 'lib/factpulse/models/invoice_line.rb', line 74

def period_start_date
  @period_start_date
end

#price_allowance_amount ⇒ Object

Returns the value of attribute price_allowance_amount.



56
57
58
# File 'lib/factpulse/models/invoice_line.rb', line 56

def price_allowance_amount
  @price_allowance_amount
end

#price_basis_quantity ⇒ Object

Returns the value of attribute price_basis_quantity.



52
53
54
# File 'lib/factpulse/models/invoice_line.rb', line 52

def price_basis_quantity
  @price_basis_quantity
end

#price_basis_unit ⇒ Object

Returns the value of attribute price_basis_unit.



54
55
56
# File 'lib/factpulse/models/invoice_line.rb', line 54

def price_basis_unit
  @price_basis_unit
end

#product_global_id ⇒ Object

Returns the value of attribute product_global_id.



28
29
30
# File 'lib/factpulse/models/invoice_line.rb', line 28

def product_global_id
  @product_global_id
end

#product_global_id_scheme ⇒ Object

Returns the value of attribute product_global_id_scheme.



30
31
32
# File 'lib/factpulse/models/invoice_line.rb', line 30

def product_global_id_scheme
  @product_global_id_scheme
end

#purchase_order_line_ref ⇒ Object

Returns the value of attribute purchase_order_line_ref.



78
79
80
# File 'lib/factpulse/models/invoice_line.rb', line 78

def purchase_order_line_ref
  @purchase_order_line_ref
end

#quantity ⇒ Object

Returns the value of attribute quantity.



43
44
45
# File 'lib/factpulse/models/invoice_line.rb', line 43

def quantity
  @quantity
end

#reference ⇒ Object

Returns the value of attribute reference.



24
25
26
# File 'lib/factpulse/models/invoice_line.rb', line 24

def reference
  @reference
end

#unit ⇒ Object

Invoiced quantity unit of measure code (BT-130).



46
47
48
# File 'lib/factpulse/models/invoice_line.rb', line 46

def unit
  @unit
end

#unit_net_price ⇒ Object

Returns the value of attribute unit_net_price.



50
51
52
# File 'lib/factpulse/models/invoice_line.rb', line 50

def unit_net_price
  @unit_net_price
end

#vat_category ⇒ Object

Returns the value of attribute vat_category.



72
73
74
# File 'lib/factpulse/models/invoice_line.rb', line 72

def vat_category
  @vat_category
end

#vat_rate ⇒ Object

Returns the value of attribute vat_rate.



68
69
70
# File 'lib/factpulse/models/invoice_line.rb', line 68

def vat_rate
  @vat_rate
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



147
148
149
# File 'lib/factpulse/models/invoice_line.rb', line 147

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



152
153
154
# File 'lib/factpulse/models/invoice_line.rb', line 152

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



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
# File 'lib/factpulse/models/invoice_line.rb', line 109

def self.attribute_map
  {
    :'line_number' => :'line_number',
    :'line_note' => :'line_note',
    :'reference' => :'reference',
    :'buyer_assigned_id' => :'buyer_assigned_id',
    :'product_global_id' => :'product_global_id',
    :'product_global_id_scheme' => :'product_global_id_scheme',
    :'item_name' => :'item_name',
    :'item_description' => :'item_description',
    :'origin_country' => :'origin_country',
    :'characteristics' => :'characteristics',
    :'classifications' => :'classifications',
    :'quantity' => :'quantity',
    :'unit' => :'unit',
    :'gross_unit_price' => :'gross_unit_price',
    :'unit_net_price' => :'unit_net_price',
    :'price_basis_quantity' => :'price_basis_quantity',
    :'price_basis_unit' => :'price_basis_unit',
    :'price_allowance_amount' => :'price_allowance_amount',
    :'line_net_amount' => :'lineNetAmount',
    :'allowance_amount' => :'allowanceAmount',
    :'allowance_reason_code' => :'allowanceReasonCode',
    :'allowance_reason' => :'allowanceReason',
    :'allowances_charges' => :'allowances_charges',
    :'vat_rate' => :'vat_rate',
    :'manual_vat_rate' => :'manual_vat_rate',
    :'vat_category' => :'vat_category',
    :'period_start_date' => :'period_start_date',
    :'period_end_date' => :'period_end_date',
    :'purchase_order_line_ref' => :'purchase_order_line_ref',
    :'accounting_account' => :'accounting_account',
    :'additional_documents' => :'additional_documents',
    :'line_notes' => :'line_notes'
  }
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



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/factpulse/models/invoice_line.rb', line 535

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



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
222
223
224
# File 'lib/factpulse/models/invoice_line.rb', line 195

def self.openapi_nullable
  Set.new([
    :'line_note',
    :'reference',
    :'buyer_assigned_id',
    :'product_global_id',
    :'product_global_id_scheme',
    :'item_description',
    :'origin_country',
    :'characteristics',
    :'classifications',
    :'gross_unit_price',
    :'price_basis_quantity',
    :'price_basis_unit',
    :'price_allowance_amount',
    :'line_net_amount',
    :'allowance_amount',
    :'allowance_reason_code',
    :'allowance_reason',
    :'allowances_charges',
    :'vat_rate',
    :'vat_category',
    :'period_start_date',
    :'period_end_date',
    :'purchase_order_line_ref',
    :'accounting_account',
    :'additional_documents',
    :'line_notes'
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



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
# File 'lib/factpulse/models/invoice_line.rb', line 157

def self.openapi_types
  {
    :'line_number' => :'Integer',
    :'line_note' => :'String',
    :'reference' => :'String',
    :'buyer_assigned_id' => :'String',
    :'product_global_id' => :'String',
    :'product_global_id_scheme' => :'String',
    :'item_name' => :'String',
    :'item_description' => :'String',
    :'origin_country' => :'String',
    :'characteristics' => :'Array<ProductCharacteristic>',
    :'classifications' => :'Array<ProductClassification>',
    :'quantity' => :'Quantity',
    :'unit' => :'UnitOfMeasure',
    :'gross_unit_price' => :'GrossUnitPrice',
    :'unit_net_price' => :'UnitNetPrice',
    :'price_basis_quantity' => :'PriceBasisQuantity',
    :'price_basis_unit' => :'String',
    :'price_allowance_amount' => :'PriceAllowanceAmount',
    :'line_net_amount' => :'LineNetAmount',
    :'allowance_amount' => :'InvoiceLineAllowanceAmount',
    :'allowance_reason_code' => :'AllowanceReasonCode',
    :'allowance_reason' => :'String',
    :'allowances_charges' => :'Array<AllowanceCharge>',
    :'vat_rate' => :'String',
    :'manual_vat_rate' => :'ManualVatRate',
    :'vat_category' => :'VATCategory',
    :'period_start_date' => :'String',
    :'period_end_date' => :'String',
    :'purchase_order_line_ref' => :'String',
    :'accounting_account' => :'String',
    :'additional_documents' => :'Array<AdditionalDocument>',
    :'line_notes' => :'Array<InvoiceNote>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/factpulse/models/invoice_line.rb', line 483

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      line_number == o.line_number &&
      line_note == o.line_note &&
      reference == o.reference &&
      buyer_assigned_id == o.buyer_assigned_id &&
      product_global_id == o.product_global_id &&
      product_global_id_scheme == o.product_global_id_scheme &&
      item_name == o.item_name &&
      item_description == o.item_description &&
      origin_country == o.origin_country &&
      characteristics == o.characteristics &&
      classifications == o.classifications &&
      quantity == o.quantity &&
      unit == o.unit &&
      gross_unit_price == o.gross_unit_price &&
      unit_net_price == o.unit_net_price &&
      price_basis_quantity == o.price_basis_quantity &&
      price_basis_unit == o.price_basis_unit &&
      price_allowance_amount == o.price_allowance_amount &&
      line_net_amount == o.line_net_amount &&
      allowance_amount == o.allowance_amount &&
      allowance_reason_code == o.allowance_reason_code &&
      allowance_reason == o.allowance_reason &&
      allowances_charges == o.allowances_charges &&
      vat_rate == o.vat_rate &&
      manual_vat_rate == o.manual_vat_rate &&
      vat_category == o.vat_category &&
      period_start_date == o.period_start_date &&
      period_end_date == o.period_end_date &&
      purchase_order_line_ref == o.purchase_order_line_ref &&
       == o. &&
      additional_documents == o.additional_documents &&
      line_notes == o.line_notes
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


522
523
524
# File 'lib/factpulse/models/invoice_line.rb', line 522

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



528
529
530
# File 'lib/factpulse/models/invoice_line.rb', line 528

def hash
  [line_number, line_note, reference, buyer_assigned_id, product_global_id, product_global_id_scheme, item_name, item_description, origin_country, characteristics, classifications, quantity, unit, gross_unit_price, unit_net_price, price_basis_quantity, price_basis_unit, price_allowance_amount, line_net_amount, allowance_amount, allowance_reason_code, allowance_reason, allowances_charges, vat_rate, manual_vat_rate, vat_category, period_start_date, period_end_date, purchase_order_line_ref, , additional_documents, line_notes].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/factpulse/models/invoice_line.rb', line 393

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @line_number.nil?
    invalid_properties.push('invalid value for "line_number", line_number cannot be nil.')
  end

  if @item_name.nil?
    invalid_properties.push('invalid value for "item_name", item_name cannot be nil.')
  end

  if @quantity.nil?
    invalid_properties.push('invalid value for "quantity", quantity cannot be nil.')
  end

  if @unit.nil?
    invalid_properties.push('invalid value for "unit", unit cannot be nil.')
  end

  if @unit_net_price.nil?
    invalid_properties.push('invalid value for "unit_net_price", unit_net_price cannot be nil.')
  end

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/factpulse/models/invoice_line.rb', line 557

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



421
422
423
424
425
426
427
428
429
# File 'lib/factpulse/models/invoice_line.rb', line 421

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @line_number.nil?
  return false if @item_name.nil?
  return false if @quantity.nil?
  return false if @unit.nil?
  return false if @unit_net_price.nil?
  true
end