Class: FattureInCloud_Ruby_Sdk::ReceivedDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/fattureincloud_ruby_sdk/models/received_document.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ReceivedDocument

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 242

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

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = 'expense'
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#amortizationObject

Received document amortization value



50
51
52
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 50

def amortization
  @amortization
end

#amount_grossObject

Read Only

Received document total gross amount



47
48
49
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 47

def amount_gross
  @amount_gross
end

#amount_netObject

Received document total net amount



35
36
37
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 35

def amount_net
  @amount_net
end

#amount_other_withholding_taxObject

Received document other withholding tax amount



44
45
46
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 44

def amount_other_withholding_tax
  @amount_other_withholding_tax
end

#amount_vatObject

Received document total vat amount



38
39
40
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 38

def amount_vat
  @amount_vat
end

#amount_withholding_taxObject

Received document withholding tax amount



41
42
43
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 41

def amount_withholding_tax
  @amount_withholding_tax
end

#attachment_preview_urlObject

Temporary
Read Only

Received document url of the attachment preview



86
87
88
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 86

def attachment_preview_url
  @attachment_preview_url
end

#attachment_tokenObject

Write Only

Received document attachment token returned by POST /received_documents/attachment



92
93
94
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 92

def attachment_token
  @attachment_token
end

#attachment_urlObject

Temporary
Read Only

Received document url of the attached file



83
84
85
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 83

def attachment_url
  @attachment_url
end

#auto_calculateObject

Received document total items amount and total payments amount can differ if this field is set to false



89
90
91
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 89

def auto_calculate
  @auto_calculate
end

#categoryObject

Received document category



29
30
31
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 29

def category
  @category
end

#created_atObject

Received document creation date



98
99
100
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 98

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



70
71
72
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 70

def currency
  @currency
end

#dateObject

Received document date [defaults to today’s date]



26
27
28
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 26

def date
  @date
end

#descriptionObject

Received document description



32
33
34
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 32

def description
  @description
end

#e_invoiceObject

Read Only

Received document is an e-invoice



65
66
67
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 65

def e_invoice
  @e_invoice
end

#entityObject

Returns the value of attribute entity.



23
24
25
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 23

def entity
  @entity
end

#idObject

Received document id



19
20
21
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 19

def id
  @id
end

#invoice_numberObject

Received document invoice number



56
57
58
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 56

def invoice_number
  @invoice_number
end

#is_detailedObject

Received document has items



62
63
64
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 62

def is_detailed
  @is_detailed
end

#is_markedObject

Received document is marked



59
60
61
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 59

def is_marked
  @is_marked
end

#items_listObject

Returns the value of attribute items_list.



78
79
80
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 78

def items_list
  @items_list
end

#lockedObject

Received Document can’t be edited



95
96
97
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 95

def locked
  @locked
end

#next_due_dateObject

Read Only

Received document date of the next not paid payment



68
69
70
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 68

def next_due_date
  @next_due_date
end

#payments_listObject

Returns the value of attribute payments_list.



80
81
82
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 80

def payments_list
  @payments_list
end

#rc_centerObject

Received document revenue center



53
54
55
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 53

def rc_center
  @rc_center
end

#tax_deductibilityObject

Received document tax deducibility percentage



73
74
75
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 73

def tax_deductibility
  @tax_deductibility
end

#typeObject

Returns the value of attribute type.



21
22
23
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 21

def type
  @type
end

#updated_atObject

Received document last update date



101
102
103
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 101

def updated_at
  @updated_at
end

#vat_deductibilityObject

Received document vat deducibility percentage



76
77
78
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 76

def vat_deductibility
  @vat_deductibility
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



474
475
476
477
478
479
480
481
482
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
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 474

def self._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
  when :Hash
    value
  else # model
    # models (e.g. Pet) or oneOf
    klass = FattureInCloud_Ruby_Sdk.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



162
163
164
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 162

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



167
168
169
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 167

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 126

def self.attribute_map
  {
    :'id' => :'id',
    :'type' => :'type',
    :'entity' => :'entity',
    :'date' => :'date',
    :'category' => :'category',
    :'description' => :'description',
    :'amount_net' => :'amount_net',
    :'amount_vat' => :'amount_vat',
    :'amount_withholding_tax' => :'amount_withholding_tax',
    :'amount_other_withholding_tax' => :'amount_other_withholding_tax',
    :'amount_gross' => :'amount_gross',
    :'amortization' => :'amortization',
    :'rc_center' => :'rc_center',
    :'invoice_number' => :'invoice_number',
    :'is_marked' => :'is_marked',
    :'is_detailed' => :'is_detailed',
    :'e_invoice' => :'e_invoice',
    :'next_due_date' => :'next_due_date',
    :'currency' => :'currency',
    :'tax_deductibility' => :'tax_deductibility',
    :'vat_deductibility' => :'vat_deductibility',
    :'items_list' => :'items_list',
    :'payments_list' => :'payments_list',
    :'attachment_url' => :'attachment_url',
    :'attachment_preview_url' => :'attachment_preview_url',
    :'auto_calculate' => :'auto_calculate',
    :'attachment_token' => :'attachment_token',
    :'locked' => :'locked',
    :'created_at' => :'created_at',
    :'updated_at' => :'updated_at'
  }
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



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 450

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



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
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 208

def self.openapi_nullable
  Set.new([
    :'id',
    :'date',
    :'category',
    :'description',
    :'amount_net',
    :'amount_vat',
    :'amount_withholding_tax',
    :'amount_other_withholding_tax',
    :'amount_gross',
    :'amortization',
    :'rc_center',
    :'invoice_number',
    :'is_marked',
    :'is_detailed',
    :'e_invoice',
    :'next_due_date',
    :'tax_deductibility',
    :'vat_deductibility',
    :'items_list',
    :'payments_list',
    :'attachment_url',
    :'attachment_preview_url',
    :'auto_calculate',
    :'attachment_token',
    :'locked',
    :'created_at',
    :'updated_at'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 172

def self.openapi_types
  {
    :'id' => :'Integer',
    :'type' => :'ReceivedDocumentType',
    :'entity' => :'Entity',
    :'date' => :'Date',
    :'category' => :'String',
    :'description' => :'String',
    :'amount_net' => :'Float',
    :'amount_vat' => :'Float',
    :'amount_withholding_tax' => :'Float',
    :'amount_other_withholding_tax' => :'Float',
    :'amount_gross' => :'Float',
    :'amortization' => :'Float',
    :'rc_center' => :'String',
    :'invoice_number' => :'String',
    :'is_marked' => :'Boolean',
    :'is_detailed' => :'Boolean',
    :'e_invoice' => :'Boolean',
    :'next_due_date' => :'Date',
    :'currency' => :'Currency',
    :'tax_deductibility' => :'Float',
    :'vat_deductibility' => :'Float',
    :'items_list' => :'Array<ReceivedDocumentItemsListItem>',
    :'payments_list' => :'Array<ReceivedDocumentPaymentsListItem>',
    :'attachment_url' => :'String',
    :'attachment_preview_url' => :'String',
    :'auto_calculate' => :'Boolean',
    :'attachment_token' => :'String',
    :'locked' => :'Boolean',
    :'created_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 400

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      type == o.type &&
      entity == o.entity &&
      date == o.date &&
      category == o.category &&
      description == o.description &&
      amount_net == o.amount_net &&
      amount_vat == o.amount_vat &&
      amount_withholding_tax == o.amount_withholding_tax &&
      amount_other_withholding_tax == o.amount_other_withholding_tax &&
      amount_gross == o.amount_gross &&
      amortization == o.amortization &&
      rc_center == o.rc_center &&
      invoice_number == o.invoice_number &&
      is_marked == o.is_marked &&
      is_detailed == o.is_detailed &&
      e_invoice == o.e_invoice &&
      next_due_date == o.next_due_date &&
      currency == o.currency &&
      tax_deductibility == o.tax_deductibility &&
      vat_deductibility == o.vat_deductibility &&
      items_list == o.items_list &&
      payments_list == o.payments_list &&
      attachment_url == o.attachment_url &&
      attachment_preview_url == o.attachment_preview_url &&
      auto_calculate == o.auto_calculate &&
      attachment_token == o.attachment_token &&
      locked == o.locked &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 547

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


437
438
439
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 437

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



443
444
445
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 443

def hash
  [id, type, entity, date, category, description, amount_net, amount_vat, amount_withholding_tax, amount_other_withholding_tax, amount_gross, amortization, rc_center, invoice_number, is_marked, is_detailed, e_invoice, next_due_date, currency, tax_deductibility, vat_deductibility, items_list, payments_list, attachment_url, attachment_preview_url, auto_calculate, attachment_token, locked, created_at, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



385
386
387
388
389
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 385

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



523
524
525
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 523

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 529

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



517
518
519
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 517

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



393
394
395
396
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 393

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end