Class: Invoicetronic_Sdk::Receive
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Invoicetronic_Sdk::Receive
- Defined in:
- lib/invoicetronic_sdk/models/receive.rb
Overview
A received invoice.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#committente ⇒ Object
VAT number of the Cessionario/Committente (customer).
-
#company_id ⇒ Object
Company id.
-
#created ⇒ Object
Creation date.
-
#date_sent ⇒ Object
When the invoice was sent to SDI.
-
#documents ⇒ Object
The invoices included in the payload.
-
#encoding ⇒ Object
Whether the payload is Base64 encoded or a plain XML (text).
-
#file_name ⇒ Object
Xml file name.
-
#format ⇒ Object
SDI format (FPA12, FPR12, FSM10, …).
-
#id ⇒ Object
Unique identifier.
-
#identifier ⇒ Object
SDI identifier.
-
#is_read ⇒ Object
Whether the invoice has been read at least once.
-
#last_update ⇒ Object
Last update from SDI.
-
#message_id ⇒ Object
SDI message id.
-
#nome_prestatore ⇒ Object
Business name of the prestatore (supplier/seller) extracted from the invoice XML.
-
#payload ⇒ Object
Xml payload.
-
#prestatore ⇒ Object
VAT number of the Cedente/Prestatore (vendor).
-
#user_id ⇒ Object
User id.
-
#version ⇒ Object
Row version, for optimistic concurrency.
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 = {}) ⇒ Receive
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 = {}) ⇒ Receive
Initializes the object
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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 171 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Invoicetronic_Sdk::Receive` 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 `Invoicetronic_Sdk::Receive`. 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?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'version') self.version = attributes[:'version'] end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'company_id') self.company_id = attributes[:'company_id'] end if attributes.key?(:'committente') self.committente = attributes[:'committente'] end if attributes.key?(:'prestatore') self.prestatore = attributes[:'prestatore'] end if attributes.key?(:'identifier') self.identifier = attributes[:'identifier'] end if attributes.key?(:'file_name') self.file_name = attributes[:'file_name'] end if attributes.key?(:'format') self.format = attributes[:'format'] end if attributes.key?(:'payload') self.payload = attributes[:'payload'] else self.payload = nil end if attributes.key?(:'last_update') self.last_update = attributes[:'last_update'] end if attributes.key?(:'date_sent') self.date_sent = attributes[:'date_sent'] end if attributes.key?(:'documents') if (value = attributes[:'documents']).is_a?(Array) self.documents = value end end if attributes.key?(:'encoding') self.encoding = attributes[:'encoding'] end if attributes.key?(:'nome_prestatore') self.nome_prestatore = attributes[:'nome_prestatore'] end if attributes.key?(:'is_read') self.is_read = attributes[:'is_read'] end if attributes.key?(:'message_id') self. = attributes[:'message_id'] end end |
Instance Attribute Details
#committente ⇒ Object
VAT number of the Cessionario/Committente (customer). This is automatically set based on the recipient’s VAT number.
35 36 37 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 35 def committente @committente end |
#company_id ⇒ Object
Company id. It is set automatically based on the VAT number extracted from the invoice payload (the sender for ‘send`, the recipient for `receive`).
32 33 34 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 32 def company_id @company_id end |
#created ⇒ Object
Creation date. It is set automatically.
23 24 25 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 23 def created @created end |
#date_sent ⇒ Object
When the invoice was sent to SDI.
56 57 58 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 56 def date_sent @date_sent end |
#documents ⇒ Object
The invoices included in the payload. This is set by the system, based on the xml content.
59 60 61 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 59 def documents @documents end |
#encoding ⇒ Object
Whether the payload is Base64 encoded or a plain XML (text).
62 63 64 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 62 def encoding @encoding end |
#file_name ⇒ Object
Xml file name. If not provided on send, it will be auto-generated.
44 45 46 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 44 def file_name @file_name end |
#format ⇒ Object
SDI format (FPA12, FPR12, FSM10, …)
47 48 49 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 47 def format @format end |
#id ⇒ Object
Unique identifier. For POST requests, leave it at ‘0` — the server will assign one automatically. For PUT requests, set it to the id of the record you want to update.
20 21 22 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 20 def id @id end |
#identifier ⇒ Object
SDI identifier. This is set by the SDI and is guaranteed to be unique within the SDI system.
41 42 43 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 41 def identifier @identifier end |
#is_read ⇒ Object
Whether the invoice has been read at least once. Set to true only when the invoice is requested with include_payload=true.
68 69 70 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 68 def is_read @is_read end |
#last_update ⇒ Object
Last update from SDI.
53 54 55 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 53 def last_update @last_update end |
#message_id ⇒ Object
SDI message id.
71 72 73 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 71 def @message_id end |
#nome_prestatore ⇒ Object
Business name of the prestatore (supplier/seller) extracted from the invoice XML.
65 66 67 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 65 def nome_prestatore @nome_prestatore end |
#payload ⇒ Object
Xml payload. This is the actual xml content, as string. On send, it can be base64 encoded. If it’s not, it will be encoded before sending. It is guaranteed to be encrypted at rest.
50 51 52 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 50 def payload @payload end |
#prestatore ⇒ Object
VAT number of the Cedente/Prestatore (vendor). This is automatically set based on the sender’s VAT number.
38 39 40 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 38 def prestatore @prestatore end |
#user_id ⇒ Object
User id. It is set automatically based on the authenticated user.
29 30 31 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 29 def user_id @user_id end |
#version ⇒ Object
Row version, for optimistic concurrency. It is set automatically.
26 27 28 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 26 def version @version end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
120 121 122 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 120 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
125 126 127 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 125 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 96 def self.attribute_map { :'id' => :'id', :'created' => :'created', :'version' => :'version', :'user_id' => :'user_id', :'company_id' => :'company_id', :'committente' => :'committente', :'prestatore' => :'prestatore', :'identifier' => :'identifier', :'file_name' => :'file_name', :'format' => :'format', :'payload' => :'payload', :'last_update' => :'last_update', :'date_sent' => :'date_sent', :'documents' => :'documents', :'encoding' => :'encoding', :'nome_prestatore' => :'nome_prestatore', :'is_read' => :'is_read', :'message_id' => :'message_id' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 353 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
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 154 def self.openapi_nullable Set.new([ :'committente', :'prestatore', :'identifier', :'file_name', :'format', :'last_update', :'date_sent', :'documents', :'nome_prestatore', :'message_id' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 130 def self.openapi_types { :'id' => :'Integer', :'created' => :'Time', :'version' => :'Integer', :'user_id' => :'Integer', :'company_id' => :'Integer', :'committente' => :'String', :'prestatore' => :'String', :'identifier' => :'String', :'file_name' => :'String', :'format' => :'String', :'payload' => :'String', :'last_update' => :'Time', :'date_sent' => :'Time', :'documents' => :'Array<DocumentData>', :'encoding' => :'String', :'nome_prestatore' => :'String', :'is_read' => :'Boolean', :'message_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 315 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && created == o.created && version == o.version && user_id == o.user_id && company_id == o.company_id && committente == o.committente && prestatore == o.prestatore && identifier == o.identifier && file_name == o.file_name && format == o.format && payload == o.payload && last_update == o.last_update && date_sent == o.date_sent && documents == o.documents && encoding == o.encoding && nome_prestatore == o.nome_prestatore && is_read == o.is_read && == o. end |
#eql?(o) ⇒ Boolean
340 341 342 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 340 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
346 347 348 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 346 def hash [id, created, version, user_id, company_id, committente, prestatore, identifier, file_name, format, payload, last_update, date_sent, documents, encoding, nome_prestatore, is_read, ].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 264 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @payload.nil? invalid_properties.push('invalid value for "payload", payload cannot be nil.') end if @payload.to_s.length < 1 invalid_properties.push('invalid value for "payload", the character length must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 375 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
280 281 282 283 284 285 286 287 |
# File 'lib/invoicetronic_sdk/models/receive.rb', line 280 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @payload.nil? return false if @payload.to_s.length < 1 encoding_validator = EnumAttributeValidator.new('String', ["Xml", "Base64"]) return false unless encoding_validator.valid?(@encoding) true end |