Class: Invoicetronic_Sdk::Update

Inherits:
ApiModelBase show all
Defined in:
lib/invoicetronic_sdk/models/update.rb

Overview

An SDI status update for a sent invoice.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Update

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/invoicetronic_sdk/models/update.rb', line 138

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

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

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

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

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

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

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

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

Instance Attribute Details

#_sendObject

Returns the value of attribute _send.



55
56
57
# File 'lib/invoicetronic_sdk/models/update.rb', line 55

def _send
  @_send
end

#company_idObject

Company id.



32
33
34
# File 'lib/invoicetronic_sdk/models/update.rb', line 32

def company_id
  @company_id
end

#createdObject

Creation date. It is set automatically.



23
24
25
# File 'lib/invoicetronic_sdk/models/update.rb', line 23

def created
  @created
end

#descriptionObject

Description for the state.



44
45
46
# File 'lib/invoicetronic_sdk/models/update.rb', line 44

def description
  @description
end

#errorsObject

SDI errors, if any.



50
51
52
# File 'lib/invoicetronic_sdk/models/update.rb', line 50

def errors
  @errors
end

#idObject

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/update.rb', line 20

def id
  @id
end

#is_readObject

Whether the item has been read at least once.



53
54
55
# File 'lib/invoicetronic_sdk/models/update.rb', line 53

def is_read
  @is_read
end

#last_updateObject

Last update from SDI.



38
39
40
# File 'lib/invoicetronic_sdk/models/update.rb', line 38

def last_update
  @last_update
end

#message_idObject

SDI message id.



47
48
49
# File 'lib/invoicetronic_sdk/models/update.rb', line 47

def message_id
  @message_id
end

#send_idObject

Send id. This is the id of the sent invoice to which this update refers to.



35
36
37
# File 'lib/invoicetronic_sdk/models/update.rb', line 35

def send_id
  @send_id
end

#stateObject

State of the document. These are the possible values, as per the SDI documentation:



41
42
43
# File 'lib/invoicetronic_sdk/models/update.rb', line 41

def state
  @state
end

#user_idObject

User id.



29
30
31
# File 'lib/invoicetronic_sdk/models/update.rb', line 29

def user_id
  @user_id
end

#versionObject

Row version, for optimistic concurrency. It is set automatically.



26
27
28
# File 'lib/invoicetronic_sdk/models/update.rb', line 26

def version
  @version
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



99
100
101
# File 'lib/invoicetronic_sdk/models/update.rb', line 99

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



104
105
106
# File 'lib/invoicetronic_sdk/models/update.rb', line 104

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/invoicetronic_sdk/models/update.rb', line 80

def self.attribute_map
  {
    :'id' => :'id',
    :'created' => :'created',
    :'version' => :'version',
    :'user_id' => :'user_id',
    :'company_id' => :'company_id',
    :'send_id' => :'send_id',
    :'last_update' => :'last_update',
    :'state' => :'state',
    :'description' => :'description',
    :'message_id' => :'message_id',
    :'errors' => :'errors',
    :'is_read' => :'is_read',
    :'_send' => :'send'
  }
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



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/invoicetronic_sdk/models/update.rb', line 269

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



128
129
130
131
132
133
134
# File 'lib/invoicetronic_sdk/models/update.rb', line 128

def self.openapi_nullable
  Set.new([
    :'description',
    :'message_id',
    :'errors',
  ])
end

.openapi_typesObject

Attribute type mapping.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/invoicetronic_sdk/models/update.rb', line 109

def self.openapi_types
  {
    :'id' => :'Integer',
    :'created' => :'Time',
    :'version' => :'Integer',
    :'user_id' => :'Integer',
    :'company_id' => :'Integer',
    :'send_id' => :'Integer',
    :'last_update' => :'Time',
    :'state' => :'String',
    :'description' => :'String',
    :'message_id' => :'String',
    :'errors' => :'Array<Error>',
    :'is_read' => :'Boolean',
    :'_send' => :'SendReduced'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/invoicetronic_sdk/models/update.rb', line 236

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 &&
      send_id == o.send_id &&
      last_update == o.last_update &&
      state == o.state &&
      description == o.description &&
      message_id == o.message_id &&
      errors == o.errors &&
      is_read == o.is_read &&
      _send == o._send
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


256
257
258
# File 'lib/invoicetronic_sdk/models/update.rb', line 256

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



262
263
264
# File 'lib/invoicetronic_sdk/models/update.rb', line 262

def hash
  [id, created, version, user_id, company_id, send_id, last_update, state, description, message_id, errors, is_read, _send].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



209
210
211
212
213
# File 'lib/invoicetronic_sdk/models/update.rb', line 209

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/invoicetronic_sdk/models/update.rb', line 291

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

Returns:

  • (Boolean)

    true if the model is valid



217
218
219
220
221
222
# File 'lib/invoicetronic_sdk/models/update.rb', line 217

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  state_validator = EnumAttributeValidator.new('String', ["Inviato", "Consegnato", "NonConsegnato", "Scartato", "AccettatoDalDestinatario", "RifiutatoDalDestinatario", "ImpossibilitaDiRecapito", "DecorrenzaTermini", "AttestazioneTrasmissioneFattura"])
  return false unless state_validator.valid?(@state)
  true
end