Class: FactPulse::SimplifiedInvoiceData
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- FactPulse::SimplifiedInvoiceData
- Defined in:
- lib/factpulse/models/simplified_invoice_data.rb
Overview
Simplified invoice data (minimal format for auto-enrichment).
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#contract_reference ⇒ Object
Returns the value of attribute contract_reference.
-
#date ⇒ Object
Returns the value of attribute date.
-
#due_days ⇒ Object
Due date in days (default: 30).
-
#invoice_type ⇒ Object
Document type (UNTDID 1001).
-
#invoicing_framework ⇒ Object
Returns the value of attribute invoicing_framework.
-
#lines ⇒ Object
Invoice lines.
-
#number ⇒ Object
Unique invoice number.
-
#operation_nature ⇒ Object
Returns the value of attribute operation_nature.
-
#preceding_invoice_reference ⇒ Object
Returns the value of attribute preceding_invoice_reference.
-
#purchase_order_reference ⇒ Object
Returns the value of attribute purchase_order_reference.
-
#recipient ⇒ Object
Recipient information (siret, …).
-
#supplier ⇒ Object
Supplier information (siret, iban, …).
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ SimplifiedInvoiceData
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ SimplifiedInvoiceData
Initializes the object
136 137 138 139 140 141 142 143 144 145 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 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 136 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::SimplifiedInvoiceData` 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::SimplifiedInvoiceData`. 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?(:'number') self.number = attributes[:'number'] else self.number = nil end if attributes.key?(:'supplier') if (value = attributes[:'supplier']).is_a?(Hash) self.supplier = value end else self.supplier = nil end if attributes.key?(:'recipient') if (value = attributes[:'recipient']).is_a?(Hash) self.recipient = value end else self.recipient = nil end if attributes.key?(:'lines') if (value = attributes[:'lines']).is_a?(Array) self.lines = value end else self.lines = nil end if attributes.key?(:'date') self.date = attributes[:'date'] end if attributes.key?(:'due_days') self.due_days = attributes[:'due_days'] else self.due_days = 30 end if attributes.key?(:'comment') self.comment = attributes[:'comment'] end if attributes.key?(:'purchase_order_reference') self.purchase_order_reference = attributes[:'purchase_order_reference'] end if attributes.key?(:'contract_reference') self.contract_reference = attributes[:'contract_reference'] end if attributes.key?(:'invoice_type') self.invoice_type = attributes[:'invoice_type'] end if attributes.key?(:'preceding_invoice_reference') self.preceding_invoice_reference = attributes[:'preceding_invoice_reference'] end if attributes.key?(:'operation_nature') self.operation_nature = attributes[:'operation_nature'] end if attributes.key?(:'invoicing_framework') self.invoicing_framework = attributes[:'invoicing_framework'] end end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
36 37 38 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 36 def comment @comment end |
#contract_reference ⇒ Object
Returns the value of attribute contract_reference.
40 41 42 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 40 def contract_reference @contract_reference end |
#date ⇒ Object
Returns the value of attribute date.
31 32 33 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 31 def date @date end |
#due_days ⇒ Object
Due date in days (default: 30)
34 35 36 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 34 def due_days @due_days end |
#invoice_type ⇒ Object
Document type (UNTDID 1001). Default: 380 (Invoice).
43 44 45 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 43 def invoice_type @invoice_type end |
#invoicing_framework ⇒ Object
Returns the value of attribute invoicing_framework.
49 50 51 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 49 def invoicing_framework @invoicing_framework end |
#lines ⇒ Object
Invoice lines
29 30 31 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 29 def lines @lines end |
#number ⇒ Object
Unique invoice number
20 21 22 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 20 def number @number end |
#operation_nature ⇒ Object
Returns the value of attribute operation_nature.
47 48 49 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 47 def operation_nature @operation_nature end |
#preceding_invoice_reference ⇒ Object
Returns the value of attribute preceding_invoice_reference.
45 46 47 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 45 def preceding_invoice_reference @preceding_invoice_reference end |
#purchase_order_reference ⇒ Object
Returns the value of attribute purchase_order_reference.
38 39 40 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 38 def purchase_order_reference @purchase_order_reference end |
#recipient ⇒ Object
Recipient information (siret, …)
26 27 28 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 26 def recipient @recipient end |
#supplier ⇒ Object
Supplier information (siret, iban, …)
23 24 25 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 23 def supplier @supplier end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
93 94 95 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 93 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
98 99 100 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 98 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 74 def self.attribute_map { :'number' => :'number', :'supplier' => :'supplier', :'recipient' => :'recipient', :'lines' => :'lines', :'date' => :'date', :'due_days' => :'dueDays', :'comment' => :'comment', :'purchase_order_reference' => :'purchaseOrderReference', :'contract_reference' => :'contractReference', :'invoice_type' => :'invoiceType', :'preceding_invoice_reference' => :'precedingInvoiceReference', :'operation_nature' => :'operationNature', :'invoicing_framework' => :'invoicingFramework' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 366 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
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 122 def self.openapi_nullable Set.new([ :'date', :'comment', :'purchase_order_reference', :'contract_reference', :'preceding_invoice_reference', :'operation_nature', :'invoicing_framework' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 103 def self.openapi_types { :'number' => :'String', :'supplier' => :'Hash<String, Object>', :'recipient' => :'Hash<String, Object>', :'lines' => :'Array<Hash<String, Object>>', :'date' => :'String', :'due_days' => :'Integer', :'comment' => :'String', :'purchase_order_reference' => :'String', :'contract_reference' => :'String', :'invoice_type' => :'InvoiceTypeCode', :'preceding_invoice_reference' => :'String', :'operation_nature' => :'OperationNature', :'invoicing_framework' => :'InvoicingFrameworkCode' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 333 def ==(o) return true if self.equal?(o) self.class == o.class && number == o.number && supplier == o.supplier && recipient == o.recipient && lines == o.lines && date == o.date && due_days == o.due_days && comment == o.comment && purchase_order_reference == o.purchase_order_reference && contract_reference == o.contract_reference && invoice_type == o.invoice_type && preceding_invoice_reference == o.preceding_invoice_reference && operation_nature == o.operation_nature && invoicing_framework == o.invoicing_framework end |
#eql?(o) ⇒ Boolean
353 354 355 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 353 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
359 360 361 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 359 def hash [number, supplier, recipient, lines, date, due_days, comment, purchase_order_reference, contract_reference, invoice_type, preceding_invoice_reference, operation_nature, invoicing_framework].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 221 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @number.nil? invalid_properties.push('invalid value for "number", number cannot be nil.') end if @supplier.nil? invalid_properties.push('invalid value for "supplier", supplier cannot be nil.') end if @recipient.nil? invalid_properties.push('invalid value for "recipient", recipient cannot be nil.') end if @lines.nil? invalid_properties.push('invalid value for "lines", lines cannot be nil.') end if @lines.length < 1 invalid_properties.push('invalid value for "lines", number of items must be greater than or equal to 1.') end if !@due_days.nil? && @due_days > 365 invalid_properties.push('invalid value for "due_days", must be smaller than or equal to 365.') end if !@due_days.nil? && @due_days < 0 invalid_properties.push('invalid value for "due_days", must be greater than or equal to 0.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 388 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
257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/factpulse/models/simplified_invoice_data.rb', line 257 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @number.nil? return false if @supplier.nil? return false if @recipient.nil? return false if @lines.nil? return false if @lines.length < 1 return false if !@due_days.nil? && @due_days > 365 return false if !@due_days.nil? && @due_days < 0 true end |