Class: FattureInCloud_Ruby_Sdk::ReceivedDocument

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

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



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

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
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.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: " + self.class.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?(:'attachment_token')
    self.attachment_token = attributes[:'attachment_token']
  end
end

Instance Attribute Details

#amortizationObject

Amortization value



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

def amortization
  @amortization
end

#amount_grossObject

Read Only

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

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

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

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

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

Read Only

Attachment preview url.



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

def attachment_preview_url
  @attachment_preview_url
end

#attachment_tokenObject

Uploaded attachement token.



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

def attachment_token
  @attachment_token
end

#attachment_urlObject

Read Only

Attachment url.



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

def attachment_url
  @attachment_url
end

#categoryObject

Document category.



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

def category
  @category
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#dateObject

Date of the document [If not specified, today date is used].



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

def date
  @date
end

#descriptionObject

Document description.



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

def description
  @description
end

#e_invoiceObject

Read Only

Indicates if this is an e-invoice.



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

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

Unique identifier of the document.



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

def id
  @id
end

#invoice_numberObject

Invoice number



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

def invoice_number
  @invoice_number
end

#is_detailedObject

Returns the value of attribute is_detailed.



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

def is_detailed
  @is_detailed
end

#is_markedObject

Returns the value of attribute is_marked.



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

def is_marked
  @is_marked
end

#items_listObject

Returns the value of attribute items_list.



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

def items_list
  @items_list
end

#next_due_dateObject

Read Only

Next due date.



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

def next_due_date
  @next_due_date
end

#payments_listObject

Returns the value of attribute payments_list.



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

def payments_list
  @payments_list
end

#rc_centerObject

Revenue center.



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

def rc_center
  @rc_center
end

#tax_deductibilityObject

Tax deducibility percentage.



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

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

#vat_deductibilityObject

Vat deducibility percentage.



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

def vat_deductibility
  @vat_deductibility
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



122
123
124
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 122

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 90

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',
    :'attachment_token' => :'attachment_token'
  }
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



375
376
377
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 375

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



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

def self.openapi_nullable
  Set.new([
    :'id',
    :'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',
    :'tax_deductibility',
    :'vat_deductibility',
    :'items_list',
    :'payments_list',
    :'attachment_url',
    :'attachment_preview_url',
    :'attachment_token'
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'id' => :'Integer',
    :'type' => :'ReceivedDocumentType',
    :'entity' => :'ReceivedDocumentEntity',
    :'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',
    :'attachment_token' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

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 &&
      attachment_token == o.attachment_token
end

#_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



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
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 405

def _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_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
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



478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 478

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

#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



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 382

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


362
363
364
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 362

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



368
369
370
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 368

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, attachment_token].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



316
317
318
319
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 316

def list_invalid_properties
  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



454
455
456
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 454

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



460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 460

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



448
449
450
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 448

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



323
324
325
# File 'lib/fattureincloud_ruby_sdk/models/received_document.rb', line 323

def valid?
  true
end