Class: FactPulse::InvoiceInput

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

Overview

Invoice for B2B international reporting (flux 10.1). Used for unitary declaration of international B2B invoices.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/factpulse/models/invoice_input.rb', line 146

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#buyer_country ⇒ Object

Returns the value of attribute buyer_country.



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

def buyer_country
  @buyer_country
end

#buyer_id ⇒ Object

Returns the value of attribute buyer_id.



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

def buyer_id
  @buyer_id
end

#buyer_vat_id ⇒ Object

Returns the value of attribute buyer_vat_id.



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

def buyer_vat_id
  @buyer_vat_id
end

#currency ⇒ Object

Returns the value of attribute currency.



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

def currency
  @currency
end

#due_date ⇒ Object

Returns the value of attribute due_date.



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

def due_date
  @due_date
end

#invoice_id ⇒ Object

Invoice identifier



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

def invoice_id
  @invoice_id
end

#issue_date ⇒ Object

Invoice issue date



23
24
25
# File 'lib/factpulse/models/invoice_input.rb', line 23

def issue_date
  @issue_date
end

#referenced_invoice_date ⇒ Object

Returns the value of attribute referenced_invoice_date.



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

def referenced_invoice_date
  @referenced_invoice_date
end

#referenced_invoice_id ⇒ Object

Returns the value of attribute referenced_invoice_id.



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

def referenced_invoice_id
  @referenced_invoice_id
end

#seller_country ⇒ Object

Returns the value of attribute seller_country.



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

def seller_country
  @seller_country
end

#seller_siren ⇒ Object

Seller SIREN/SIRET



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

def seller_siren
  @seller_siren
end

#seller_vat_id ⇒ Object

Returns the value of attribute seller_vat_id.



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

def seller_vat_id
  @seller_vat_id
end

#tax_amount ⇒ Object

Returns the value of attribute tax_amount.



47
48
49
# File 'lib/factpulse/models/invoice_input.rb', line 47

def tax_amount
  @tax_amount
end

#tax_breakdown ⇒ Object

VAT breakdown



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

def tax_breakdown
  @tax_breakdown
end

#tax_exclusive_amount ⇒ Object

Returns the value of attribute tax_exclusive_amount.



45
46
47
# File 'lib/factpulse/models/invoice_input.rb', line 45

def tax_exclusive_amount
  @tax_exclusive_amount
end

#type_code ⇒ Object

Invoice type code



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

def type_code
  @type_code
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



101
102
103
# File 'lib/factpulse/models/invoice_input.rb', line 101

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



106
107
108
# File 'lib/factpulse/models/invoice_input.rb', line 106

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/factpulse/models/invoice_input.rb', line 79

def self.attribute_map
  {
    :'invoice_id' => :'invoiceId',
    :'issue_date' => :'issueDate',
    :'type_code' => :'typeCode',
    :'currency' => :'currency',
    :'due_date' => :'dueDate',
    :'seller_siren' => :'sellerSiren',
    :'seller_vat_id' => :'sellerVatId',
    :'seller_country' => :'sellerCountry',
    :'buyer_id' => :'buyerId',
    :'buyer_vat_id' => :'buyerVatId',
    :'buyer_country' => :'buyerCountry',
    :'tax_exclusive_amount' => :'taxExclusiveAmount',
    :'tax_amount' => :'taxAmount',
    :'tax_breakdown' => :'taxBreakdown',
    :'referenced_invoice_id' => :'referencedInvoiceId',
    :'referenced_invoice_date' => :'referencedInvoiceDate'
  }
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



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/factpulse/models/invoice_input.rb', line 408

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



133
134
135
136
137
138
139
140
141
142
# File 'lib/factpulse/models/invoice_input.rb', line 133

def self.openapi_nullable
  Set.new([
    :'due_date',
    :'seller_vat_id',
    :'buyer_id',
    :'buyer_vat_id',
    :'referenced_invoice_id',
    :'referenced_invoice_date'
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/factpulse/models/invoice_input.rb', line 111

def self.openapi_types
  {
    :'invoice_id' => :'String',
    :'issue_date' => :'Date',
    :'type_code' => :'InvoiceTypeCode',
    :'currency' => :'Currency',
    :'due_date' => :'Date',
    :'seller_siren' => :'String',
    :'seller_vat_id' => :'String',
    :'seller_country' => :'Sellercountry',
    :'buyer_id' => :'String',
    :'buyer_vat_id' => :'String',
    :'buyer_country' => :'Buyercountry',
    :'tax_exclusive_amount' => :'Taxexclusiveamount1',
    :'tax_amount' => :'Taxamount1',
    :'tax_breakdown' => :'Array<TaxBreakdownInput>',
    :'referenced_invoice_id' => :'String',
    :'referenced_invoice_date' => :'Date'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/factpulse/models/invoice_input.rb', line 372

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      invoice_id == o.invoice_id &&
      issue_date == o.issue_date &&
      type_code == o.type_code &&
      currency == o.currency &&
      due_date == o.due_date &&
      seller_siren == o.seller_siren &&
      seller_vat_id == o.seller_vat_id &&
      seller_country == o.seller_country &&
      buyer_id == o.buyer_id &&
      buyer_vat_id == o.buyer_vat_id &&
      buyer_country == o.buyer_country &&
      tax_exclusive_amount == o.tax_exclusive_amount &&
      tax_amount == o.tax_amount &&
      tax_breakdown == o.tax_breakdown &&
      referenced_invoice_id == o.referenced_invoice_id &&
      referenced_invoice_date == o.referenced_invoice_date
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


395
396
397
# File 'lib/factpulse/models/invoice_input.rb', line 395

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



401
402
403
# File 'lib/factpulse/models/invoice_input.rb', line 401

def hash
  [invoice_id, issue_date, type_code, currency, due_date, seller_siren, seller_vat_id, seller_country, buyer_id, buyer_vat_id, buyer_country, tax_exclusive_amount, tax_amount, tax_breakdown, referenced_invoice_id, referenced_invoice_date].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



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

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

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

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

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

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

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

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

  if @tax_breakdown.length < 1
    invalid_properties.push('invalid value for "tax_breakdown", number of items must be greater than or equal to 1.')
  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



430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/factpulse/models/invoice_input.rb', line 430

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



283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/factpulse/models/invoice_input.rb', line 283

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @invoice_id.nil?
  return false if @issue_date.nil?
  return false if @seller_siren.nil?
  return false if @buyer_country.nil?
  return false if @tax_exclusive_amount.nil?
  return false if @tax_amount.nil?
  return false if @tax_breakdown.nil?
  return false if @tax_breakdown.length < 1
  true
end