Class: Invoicetronic_Sdk::ModelSend
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Invoicetronic_Sdk::ModelSend
- Defined in:
- lib/invoicetronic_sdk/models/model_send.rb
Overview
A sent invoice.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#committente ⇒ Object
VAT number of the Cessionario/Committente (customer).
-
#company ⇒ Object
Returns the value of attribute company.
-
#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.
-
#last_update ⇒ Object
Last update from SDI.
-
#latest_state ⇒ Object
Current SDI state of the invoice.
-
#meta_data ⇒ Object
Optional metadata, as json.
-
#nome_committente ⇒ Object
Business name of the committente (client/buyer) 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 = {}) ⇒ ModelSend
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 = {}) ⇒ ModelSend
Initializes the object
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 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 176 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Invoicetronic_Sdk::ModelSend` 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::ModelSend`. 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_committente') self.nome_committente = attributes[:'nome_committente'] end if attributes.key?(:'meta_data') if (value = attributes[:'meta_data']).is_a?(Hash) self. = value end end if attributes.key?(:'latest_state') self.latest_state = attributes[:'latest_state'] end if attributes.key?(:'company') self.company = attributes[:'company'] 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/model_send.rb', line 35 def committente @committente end |
#company ⇒ Object
Returns the value of attribute company.
73 74 75 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 73 def company @company 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/model_send.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/model_send.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/model_send.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/model_send.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/model_send.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/model_send.rb', line 44 def file_name @file_name end |
#format ⇒ Object
SDI format (FPA12, FPR12, FSM10, …)
47 48 49 |
# File 'lib/invoicetronic_sdk/models/model_send.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/model_send.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/model_send.rb', line 41 def identifier @identifier end |
#last_update ⇒ Object
Last update from SDI.
53 54 55 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 53 def last_update @last_update end |
#latest_state ⇒ Object
Current SDI state of the invoice. Reflects the most recent update received from SDI. Null when no update has been received yet.
71 72 73 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 71 def latest_state @latest_state end |
#meta_data ⇒ Object
Optional metadata, as json.
68 69 70 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 68 def @meta_data end |
#nome_committente ⇒ Object
Business name of the committente (client/buyer) extracted from the invoice XML.
65 66 67 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 65 def nome_committente @nome_committente 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/model_send.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/model_send.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/model_send.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/model_send.rb', line 26 def version @version end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
123 124 125 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 123 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
128 129 130 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 128 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 98 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_committente' => :'nome_committente', :'meta_data' => :'meta_data', :'latest_state' => :'latest_state', :'company' => :'company' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 377 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
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 158 def self.openapi_nullable Set.new([ :'committente', :'prestatore', :'identifier', :'file_name', :'format', :'last_update', :'date_sent', :'documents', :'nome_committente', :'meta_data', :'latest_state', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 133 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_committente' => :'String', :'meta_data' => :'Hash<String, String>', :'latest_state' => :'String', :'company' => :'Company' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 338 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_committente == o.nome_committente && == o. && latest_state == o.latest_state && company == o.company end |
#eql?(o) ⇒ Boolean
364 365 366 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 364 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
370 371 372 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 370 def hash [id, created, version, user_id, company_id, committente, prestatore, identifier, file_name, format, payload, last_update, date_sent, documents, encoding, nome_committente, , latest_state, company].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 275 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
399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 399 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
291 292 293 294 295 296 297 298 299 300 |
# File 'lib/invoicetronic_sdk/models/model_send.rb', line 291 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) latest_state_validator = EnumAttributeValidator.new('String', ["Inviato", "Consegnato", "NonConsegnato", "Scartato", "AccettatoDalDestinatario", "RifiutatoDalDestinatario", "ImpossibilitaDiRecapito", "DecorrenzaTermini", "AttestazioneTrasmissioneFattura"]) return false unless latest_state_validator.valid?(@latest_state) true end |