trevol 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/GENERADO.md +1 -1
  4. data/README.md +29 -4
  5. data/lib/trevol/client.rb +71 -9
  6. data/lib/trevol/llave.rb +30 -7
  7. data/lib/trevol/transporte.rb +44 -4
  8. data/lib/trevol_generado/api/account_api.rb +752 -0
  9. data/lib/trevol_generado/api/balance_api.rb +2 -2
  10. data/lib/trevol_generado/api/general_api.rb +2 -2
  11. data/lib/trevol_generado/api/requests_api.rb +2 -2
  12. data/lib/trevol_generado/models/account_api_key.rb +312 -0
  13. data/lib/trevol_generado/models/account_api_key_input.rb +254 -0
  14. data/lib/trevol_generado/models/account_api_key_list.rb +191 -0
  15. data/lib/trevol_generado/models/account_api_key_revocation.rb +181 -0
  16. data/lib/trevol_generado/models/account_company.rb +285 -0
  17. data/lib/trevol_generado/models/account_company_api_key_counts.rb +170 -0
  18. data/lib/trevol_generado/models/account_company_input.rb +209 -0
  19. data/lib/trevol_generado/models/account_company_list.rb +191 -0
  20. data/lib/trevol_generado/models/account_company_onboarding.rb +173 -0
  21. data/lib/trevol_generado/models/account_company_reference.rb +183 -0
  22. data/lib/trevol_generado/models/account_dian_counterpart.rb +193 -0
  23. data/lib/trevol_generado/models/account_dian_document.rb +348 -0
  24. data/lib/trevol_generado/models/account_dian_document_list.rb +191 -0
  25. data/lib/trevol_generado/models/account_key.rb +234 -0
  26. data/lib/trevol_generado/models/account_key_info.rb +181 -0
  27. data/lib/trevol_generado/models/account_key_info_account.rb +161 -0
  28. data/lib/trevol_generado/models/account_key_scope.rb +174 -0
  29. data/lib/trevol_generado/models/account_radian_event.rb +369 -0
  30. data/lib/trevol_generado/models/account_radian_event_list.rb +191 -0
  31. data/lib/trevol_generado/models/account_request_log.rb +262 -0
  32. data/lib/trevol_generado/models/account_request_log_list.rb +191 -0
  33. data/lib/trevol_generado/models/problem.rb +35 -5
  34. data/lib/trevol_generado/models/radian_summary.rb +183 -0
  35. data/lib/trevol_generado/models/radian_summary_event.rb +201 -0
  36. data/lib/trevol_generado/tablas.rb +166 -151
  37. data/lib/trevol_generado/version.rb +1 -1
  38. data/lib/trevol_generado.rb +24 -0
  39. metadata +25 -1
@@ -91,7 +91,7 @@ module TrevolGenerado
91
91
  end
92
92
 
93
93
  # Los movimientos del saldo de la cuenta
94
- # Los movimientos del saldo de la cuenta (de todas sus empresas), del más nuevo al más viejo: lo mismo que «Saldo y recargas» en la app. Un documento es UNA fila (`type: document`) con su `status`: `pending` (apartado mientras la DIAN lo valida), `charged` (validado y cobrado) o `released` (la DIAN lo rechazó: no se cobró y `amount` es 0); `company` dice qué empresa lo emitió. Lo demás es una fila por movimiento: `top_up` (recarga, con su `reference`), `top_up_reversal`, `bonus`, `adjustment`, `license_fee`, `expiration` u `other`. Una operación de la API que se cobra (una sincronización o una de numeración, ver `operation_prices` en `GET /v1/balance`) es también UNA fila (`type: operation`) con el mismo `status` que un documento (`released`: no terminó y no se cobró) y `operation: {type, id}` (el id de la sincronización, la asociación o la solicitud; null en una lectura de numeraciones). `amount` es lo que el movimiento hizo con el disponible, con signo; `available_after`, el disponible justo después. Filtro `type`: `all` (por defecto), `documents`, `funding` (todo lo que no es un documento, también las operaciones), `top_ups` u `operations`. Paginación por cursor: `limit` (1 a 100, 25 por defecto) y `starting_after` (el `id` de la última fila que tienes).
94
+ # Los movimientos del saldo de la cuenta (de todas sus empresas), del más nuevo al más viejo: lo mismo que «Saldo y recargas» en la app. Un documento es UNA fila (`type: document`) con su `status`: `pending` (apartado mientras la DIAN lo valida), `charged` (validado y cobrado) o `released` (la DIAN lo rechazó: no se cobró y `amount` es 0); `company` dice qué empresa lo emitió. Lo demás es una fila por movimiento: `top_up` (recarga, con su `reference`), `top_up_reversal`, `bonus`, `adjustment`, `license_fee`, `expiration` u `other`. Una operación de la API que se cobra (una sincronización o una de numeración, ver `operation_prices` en `GET /v1/balance`) es también UNA fila (`type: operation`) con el mismo `status` que un documento (`released`: no terminó y no se cobró) y `operation: {type, id}` (el id de la sincronización, la asociación o la solicitud; null en una lectura de numeraciones). `amount` es lo que el movimiento hizo con el disponible, con signo; `available_after`, el disponible justo después. Filtro `type`: `all` (por defecto), `documents`, `funding` (todo lo que no es un documento, también las operaciones), `top_ups` u `operations`. Paginación por cursor: `limit` (1 a 100, 25 por defecto) y `starting_after` (el `id` de la última fila que tienes). Con una llave de administración con alcance de lista, lo de una empresa que la llave no alcanza sale con su monto, su `status` y `available_after`, pero sin `company`, `document` ni `reference`, y con la descripción «Movimiento de otra empresa de la cuenta».
95
95
  # @param [Hash] opts the optional parameters
96
96
  # @option opts [Integer] :limit (default to 25)
97
97
  # @option opts [String] :starting_after
@@ -103,7 +103,7 @@ module TrevolGenerado
103
103
  end
104
104
 
105
105
  # Los movimientos del saldo de la cuenta
106
- # Los movimientos del saldo de la cuenta (de todas sus empresas), del más nuevo al más viejo: lo mismo que «Saldo y recargas» en la app. Un documento es UNA fila (`type: document`) con su `status`: `pending` (apartado mientras la DIAN lo valida), `charged` (validado y cobrado) o `released` (la DIAN lo rechazó: no se cobró y `amount` es 0); `company` dice qué empresa lo emitió. Lo demás es una fila por movimiento: `top_up` (recarga, con su `reference`), `top_up_reversal`, `bonus`, `adjustment`, `license_fee`, `expiration` u `other`. Una operación de la API que se cobra (una sincronización o una de numeración, ver `operation_prices` en `GET /v1/balance`) es también UNA fila (`type: operation`) con el mismo `status` que un documento (`released`: no terminó y no se cobró) y `operation: {type, id}` (el id de la sincronización, la asociación o la solicitud; null en una lectura de numeraciones). `amount` es lo que el movimiento hizo con el disponible, con signo; `available_after`, el disponible justo después. Filtro `type`: `all` (por defecto), `documents`, `funding` (todo lo que no es un documento, también las operaciones), `top_ups` u `operations`. Paginación por cursor: `limit` (1 a 100, 25 por defecto) y `starting_after` (el `id` de la última fila que tienes).
106
+ # Los movimientos del saldo de la cuenta (de todas sus empresas), del más nuevo al más viejo: lo mismo que «Saldo y recargas» en la app. Un documento es UNA fila (`type: document`) con su `status`: `pending` (apartado mientras la DIAN lo valida), `charged` (validado y cobrado) o `released` (la DIAN lo rechazó: no se cobró y `amount` es 0); `company` dice qué empresa lo emitió. Lo demás es una fila por movimiento: `top_up` (recarga, con su `reference`), `top_up_reversal`, `bonus`, `adjustment`, `license_fee`, `expiration` u `other`. Una operación de la API que se cobra (una sincronización o una de numeración, ver `operation_prices` en `GET /v1/balance`) es también UNA fila (`type: operation`) con el mismo `status` que un documento (`released`: no terminó y no se cobró) y `operation: {type, id}` (el id de la sincronización, la asociación o la solicitud; null en una lectura de numeraciones). `amount` es lo que el movimiento hizo con el disponible, con signo; `available_after`, el disponible justo después. Filtro `type`: `all` (por defecto), `documents`, `funding` (todo lo que no es un documento, también las operaciones), `top_ups` u `operations`. Paginación por cursor: `limit` (1 a 100, 25 por defecto) y `starting_after` (el `id` de la última fila que tienes). Con una llave de administración con alcance de lista, lo de una empresa que la llave no alcanza sale con su monto, su `status` y `available_after`, pero sin `company`, `document` ni `reference`, y con la descripción «Movimiento de otra empresa de la cuenta».
107
107
  # @param [Hash] opts the optional parameters
108
108
  # @option opts [Integer] :limit (default to 25)
109
109
  # @option opts [String] :starting_after
@@ -73,7 +73,7 @@ module TrevolGenerado
73
73
  end
74
74
 
75
75
  # La empresa de la llave
76
- # La empresa de la llave: NIT, razón social, ambiente y numeraciones activas. Desde la fase 3 trae `capabilities`, un resumen de lo que ESTA llave puede emitir ahora: documento soporte (con su numeración), documento equivalente (con los prefijos POS), nómina (`status`: `enabled`, `testing`, `not_registered` o `not_enabled`, según el ambiente de la llave) y eventos RADIAN (representante legal). Es informativo: si una lectura falla, esa clave no aparece.
76
+ # La empresa de la llave: NIT, razón social, ambiente y numeraciones activas. Desde la fase 3 trae `capabilities`, un resumen de lo que ESTA llave puede emitir ahora: documento soporte (con su numeración), documento equivalente (con los prefijos POS), nómina (`status`: `enabled`, `testing`, `not_registered` o `not_enabled`, según el ambiente de la llave) y eventos RADIAN (representante legal). Es informativo: si una lectura falla, esa clave no aparece. Con una llave de administración, la empresa es la de `Trevol-Company` y `key` es la identidad con que esa llave trabaja en la empresa (un `key_…` que no sale en `GET /v1/account/companies/{id}/api_keys`).
77
77
  # @param [Hash] opts the optional parameters
78
78
  # @return [Company]
79
79
  def retrieve_company(opts = {})
@@ -82,7 +82,7 @@ module TrevolGenerado
82
82
  end
83
83
 
84
84
  # La empresa de la llave
85
- # La empresa de la llave: NIT, razón social, ambiente y numeraciones activas. Desde la fase 3 trae `capabilities`, un resumen de lo que ESTA llave puede emitir ahora: documento soporte (con su numeración), documento equivalente (con los prefijos POS), nómina (`status`: `enabled`, `testing`, `not_registered` o `not_enabled`, según el ambiente de la llave) y eventos RADIAN (representante legal). Es informativo: si una lectura falla, esa clave no aparece.
85
+ # La empresa de la llave: NIT, razón social, ambiente y numeraciones activas. Desde la fase 3 trae `capabilities`, un resumen de lo que ESTA llave puede emitir ahora: documento soporte (con su numeración), documento equivalente (con los prefijos POS), nómina (`status`: `enabled`, `testing`, `not_registered` o `not_enabled`, según el ambiente de la llave) y eventos RADIAN (representante legal). Es informativo: si una lectura falla, esa clave no aparece. Con una llave de administración, la empresa es la de `Trevol-Company` y `key` es la identidad con que esa llave trabaja en la empresa (un `key_…` que no sale en `GET /v1/account/companies/{id}/api_keys`).
86
86
  # @param [Hash] opts the optional parameters
87
87
  # @return [Array<(Company, Integer, Hash)>] Company data, response status code and response headers
88
88
  def retrieve_company_with_http_info(opts = {})
@@ -20,7 +20,7 @@ module TrevolGenerado
20
20
  @api_client = api_client
21
21
  end
22
22
  # El registro de peticiones de la empresa y el ambiente de la llave (30 días)
23
- # Cada petición que pasó la autenticación de una llave, aunque terminara en 403, 422 o 429. Sin cuerpos, consultas, IP ni llaves; `path` es la plantilla.
23
+ # Cada petición que pasó la autenticación de una llave, aunque terminara en 403, 422 o 429. Sin cuerpos, consultas, IP ni llaves; `path` es la plantilla. Lo que hizo una llave de administración en la empresa sale con el `key_…` de su identidad en la empresa (el de `GET /v1/company`); su propio registro, con la IP, está en `GET /v1/account/requests`.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [Integer] :limit
26
26
  # @option opts [String] :starting_after
@@ -35,7 +35,7 @@ module TrevolGenerado
35
35
  end
36
36
 
37
37
  # El registro de peticiones de la empresa y el ambiente de la llave (30 días)
38
- # Cada petición que pasó la autenticación de una llave, aunque terminara en 403, 422 o 429. Sin cuerpos, consultas, IP ni llaves; &#x60;path&#x60; es la plantilla.
38
+ # Cada petición que pasó la autenticación de una llave, aunque terminara en 403, 422 o 429. Sin cuerpos, consultas, IP ni llaves; &#x60;path&#x60; es la plantilla. Lo que hizo una llave de administración en la empresa sale con el &#x60;key_…&#x60; de su identidad en la empresa (el de &#x60;GET /v1/company&#x60;); su propio registro, con la IP, está en &#x60;GET /v1/account/requests&#x60;.
39
39
  # @param [Hash] opts the optional parameters
40
40
  # @option opts [Integer] :limit
41
41
  # @option opts [String] :starting_after
@@ -0,0 +1,312 @@
1
+ =begin
2
+ #API de Trevol
3
+
4
+ #Trevol API. Documentación: https://platform.trevol.si/docs
5
+
6
+ The version of the OpenAPI document: 2026-11-18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrevolGenerado
17
+ # Una llave `tvl_` de una empresa (solo metadatos; el token sale una sola vez, al crearla).
18
+ class AccountApiKey < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ # Valores conocidos: `api_key`.
22
+ attr_accessor :object
23
+
24
+ attr_accessor :company
25
+
26
+ attr_accessor :name
27
+
28
+ # El de la llave de administración que la ve o la creó. Valores conocidos: `test`, `live`.
29
+ attr_accessor :environment
30
+
31
+ # `read`: solo lee; `write`: emite y lee. Valores conocidos: `read`, `write`.
32
+ attr_accessor :permissions
33
+
34
+ # Si tiene el permiso `customers:read` (los datos personales de los clientes).
35
+ attr_accessor :customers_read
36
+
37
+ # Las direcciones IP o redes CIDR desde donde sirve; vacía, desde cualquiera.
38
+ attr_accessor :allowed_ips
39
+
40
+ # Valores conocidos: `2026-10-21`, `2026-10-22`, `2026-11-18`.
41
+ attr_accessor :api_version
42
+
43
+ # Los primeros 14 caracteres del token (`tvl_test_ab12c`), para reconocerla.
44
+ attr_accessor :prefix
45
+
46
+ # Valores conocidos: `active`, `revoked`.
47
+ attr_accessor :status
48
+
49
+ attr_accessor :created_at
50
+
51
+ attr_accessor :last_used_at
52
+
53
+ attr_accessor :revoked_at
54
+
55
+ # `app`: en la app; `account_key`: con una llave de administración; `connected_app`: la creó una app conectada (no se revoca por aquí). Valores conocidos: `app`, `account_key`, `connected_app`.
56
+ attr_accessor :created_via
57
+
58
+ # Solo en la respuesta de crearla: el token completo (`tvl_test_…` o `tvl_live_…`), UNA vez. Guárdalo en un lugar seguro: Trevol solo guarda su hash. Si repites la petición con la misma `Idempotency-Key` viene en null; si lo perdiste, revoca la llave y crea otra.
59
+ attr_accessor :token
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'id' => :'id',
65
+ :'object' => :'object',
66
+ :'company' => :'company',
67
+ :'name' => :'name',
68
+ :'environment' => :'environment',
69
+ :'permissions' => :'permissions',
70
+ :'customers_read' => :'customers_read',
71
+ :'allowed_ips' => :'allowed_ips',
72
+ :'api_version' => :'api_version',
73
+ :'prefix' => :'prefix',
74
+ :'status' => :'status',
75
+ :'created_at' => :'created_at',
76
+ :'last_used_at' => :'last_used_at',
77
+ :'revoked_at' => :'revoked_at',
78
+ :'created_via' => :'created_via',
79
+ :'token' => :'token'
80
+ }
81
+ end
82
+
83
+ # Returns attribute mapping this model knows about
84
+ def self.acceptable_attribute_map
85
+ attribute_map
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ acceptable_attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.openapi_types
95
+ {
96
+ :'id' => :'String',
97
+ :'object' => :'String',
98
+ :'company' => :'String',
99
+ :'name' => :'String',
100
+ :'environment' => :'String',
101
+ :'permissions' => :'String',
102
+ :'customers_read' => :'Boolean',
103
+ :'allowed_ips' => :'Array<String>',
104
+ :'api_version' => :'String',
105
+ :'prefix' => :'String',
106
+ :'status' => :'String',
107
+ :'created_at' => :'Time',
108
+ :'last_used_at' => :'Time',
109
+ :'revoked_at' => :'Time',
110
+ :'created_via' => :'String',
111
+ :'token' => :'String'
112
+ }
113
+ end
114
+
115
+ # List of attributes with nullable: true
116
+ def self.openapi_nullable
117
+ Set.new([
118
+ :'api_version',
119
+ :'last_used_at',
120
+ :'revoked_at',
121
+ :'token'
122
+ ])
123
+ end
124
+
125
+ # Returns attribute type mapping
126
+ def self.acceptable_openapi_types
127
+ openapi_types
128
+ end
129
+
130
+ # Returns the nullable attributes
131
+ def self.acceptable_openapi_nullable
132
+ openapi_nullable
133
+ end
134
+
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ def initialize(attributes = {})
138
+ if (!attributes.is_a?(Hash))
139
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrevolGenerado::AccountApiKey` initialize method"
140
+ end
141
+
142
+ # check to see if the attribute exists and convert string to symbol for hash key
143
+ acceptable_attribute_map = self.class.acceptable_attribute_map
144
+ attributes = attributes.each_with_object({}) { |(k, v), h|
145
+ if (!acceptable_attribute_map.key?(k.to_sym))
146
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrevolGenerado::AccountApiKey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
147
+ end
148
+ h[k.to_sym] = v
149
+ }
150
+
151
+ if attributes.key?(:'id')
152
+ self.id = attributes[:'id']
153
+ end
154
+
155
+ if attributes.key?(:'object')
156
+ self.object = attributes[:'object']
157
+ end
158
+
159
+ if attributes.key?(:'company')
160
+ self.company = attributes[:'company']
161
+ end
162
+
163
+ if attributes.key?(:'name')
164
+ self.name = attributes[:'name']
165
+ end
166
+
167
+ if attributes.key?(:'environment')
168
+ self.environment = attributes[:'environment']
169
+ end
170
+
171
+ if attributes.key?(:'permissions')
172
+ self.permissions = attributes[:'permissions']
173
+ end
174
+
175
+ if attributes.key?(:'customers_read')
176
+ self.customers_read = attributes[:'customers_read']
177
+ end
178
+
179
+ if attributes.key?(:'allowed_ips')
180
+ if (value = attributes[:'allowed_ips']).is_a?(Array)
181
+ self.allowed_ips = value
182
+ end
183
+ end
184
+
185
+ if attributes.key?(:'api_version')
186
+ self.api_version = attributes[:'api_version']
187
+ end
188
+
189
+ if attributes.key?(:'prefix')
190
+ self.prefix = attributes[:'prefix']
191
+ end
192
+
193
+ if attributes.key?(:'status')
194
+ self.status = attributes[:'status']
195
+ end
196
+
197
+ if attributes.key?(:'created_at')
198
+ self.created_at = attributes[:'created_at']
199
+ end
200
+
201
+ if attributes.key?(:'last_used_at')
202
+ self.last_used_at = attributes[:'last_used_at']
203
+ end
204
+
205
+ if attributes.key?(:'revoked_at')
206
+ self.revoked_at = attributes[:'revoked_at']
207
+ end
208
+
209
+ if attributes.key?(:'created_via')
210
+ self.created_via = attributes[:'created_via']
211
+ end
212
+
213
+ if attributes.key?(:'token')
214
+ self.token = attributes[:'token']
215
+ end
216
+ end
217
+
218
+ # Show invalid properties with the reasons. Usually used together with valid?
219
+ # @return Array for valid properties with the reasons
220
+ def list_invalid_properties
221
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
222
+ invalid_properties = Array.new
223
+ invalid_properties
224
+ end
225
+
226
+ # Check to see if the all the properties in the model are valid
227
+ # @return true if the model is valid
228
+ def valid?
229
+ warn '[DEPRECATED] the `valid?` method is obsolete'
230
+ true
231
+ end
232
+
233
+ # Checks equality by comparing each attribute.
234
+ # @param [Object] Object to be compared
235
+ def ==(o)
236
+ return true if self.equal?(o)
237
+ self.class == o.class &&
238
+ id == o.id &&
239
+ object == o.object &&
240
+ company == o.company &&
241
+ name == o.name &&
242
+ environment == o.environment &&
243
+ permissions == o.permissions &&
244
+ customers_read == o.customers_read &&
245
+ allowed_ips == o.allowed_ips &&
246
+ api_version == o.api_version &&
247
+ prefix == o.prefix &&
248
+ status == o.status &&
249
+ created_at == o.created_at &&
250
+ last_used_at == o.last_used_at &&
251
+ revoked_at == o.revoked_at &&
252
+ created_via == o.created_via &&
253
+ token == o.token
254
+ end
255
+
256
+ # @see the `==` method
257
+ # @param [Object] Object to be compared
258
+ def eql?(o)
259
+ self == o
260
+ end
261
+
262
+ # Calculates hash code according to all attributes.
263
+ # @return [Integer] Hash code
264
+ def hash
265
+ [id, object, company, name, environment, permissions, customers_read, allowed_ips, api_version, prefix, status, created_at, last_used_at, revoked_at, created_via, token].hash
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def self.build_from_hash(attributes)
272
+ return nil unless attributes.is_a?(Hash)
273
+ attributes = attributes.transform_keys(&:to_sym)
274
+ # include attributes inherited from allOf parents (the nearest declaration wins)
275
+ map = acceptable_attribute_map
276
+ transformed_hash = {}
277
+ acceptable_openapi_types.each_pair do |key, type|
278
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
279
+ transformed_hash["#{key}"] = nil
280
+ elsif type =~ /\AArray<(.*)>/i
281
+ # check to ensure the input is an array given that the attribute
282
+ # is documented as an array but the input is not
283
+ if attributes[map[key]].is_a?(Array)
284
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
285
+ end
286
+ elsif !attributes[map[key]].nil?
287
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
288
+ end
289
+ end
290
+ new(transformed_hash)
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ # include attributes inherited from allOf parents (the nearest declaration wins)
298
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ if value.nil?
301
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
302
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
303
+ end
304
+
305
+ hash[param] = _to_hash(value)
306
+ end
307
+ hash
308
+ end
309
+
310
+ end
311
+
312
+ end
@@ -0,0 +1,254 @@
1
+ =begin
2
+ #API de Trevol
3
+
4
+ #Trevol API. Documentación: https://platform.trevol.si/docs
5
+
6
+ The version of the OpenAPI document: 2026-11-18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrevolGenerado
17
+ # La llave `tvl_` que se crea, en el ambiente de la llave de administración.
18
+ class AccountApiKeyInput < ApiModelBase
19
+ # Para reconocerla (el software o el equipo que la usa).
20
+ attr_accessor :name
21
+
22
+ # `read`: solo lee; `write`: emite y lee. Una de escritura de producción, por ahora, se crea en la app.
23
+ attr_accessor :permissions
24
+
25
+ # Hasta 10 direcciones IP o redes CIDR desde donde sirve (opcional).
26
+ attr_accessor :allowed_ips
27
+
28
+ # Con el permiso `customers:read` (los datos personales de los clientes). Solo si tu llave de administración lo tiene.
29
+ attr_accessor :customers_read
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'name' => :'name',
57
+ :'permissions' => :'permissions',
58
+ :'allowed_ips' => :'allowed_ips',
59
+ :'customers_read' => :'customers_read'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'name' => :'String',
77
+ :'permissions' => :'String',
78
+ :'allowed_ips' => :'Array<String>',
79
+ :'customers_read' => :'Boolean'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Returns attribute type mapping
90
+ def self.acceptable_openapi_types
91
+ openapi_types
92
+ end
93
+
94
+ # Returns the nullable attributes
95
+ def self.acceptable_openapi_nullable
96
+ openapi_nullable
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrevolGenerado::AccountApiKeyInput` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ acceptable_attribute_map = self.class.acceptable_attribute_map
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!acceptable_attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrevolGenerado::AccountApiKeyInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'name')
116
+ self.name = attributes[:'name']
117
+ else
118
+ self.name = nil
119
+ end
120
+
121
+ if attributes.key?(:'permissions')
122
+ self.permissions = attributes[:'permissions']
123
+ else
124
+ self.permissions = nil
125
+ end
126
+
127
+ if attributes.key?(:'allowed_ips')
128
+ if (value = attributes[:'allowed_ips']).is_a?(Array)
129
+ self.allowed_ips = value
130
+ end
131
+ end
132
+
133
+ if attributes.key?(:'customers_read')
134
+ self.customers_read = attributes[:'customers_read']
135
+ else
136
+ self.customers_read = false
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
144
+ invalid_properties = Array.new
145
+ if @name.nil?
146
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
147
+ end
148
+
149
+ if @permissions.nil?
150
+ invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ warn '[DEPRECATED] the `valid?` method is obsolete'
160
+ return false if @name.nil?
161
+ return false if @permissions.nil?
162
+ permissions_validator = EnumAttributeValidator.new('String', ["read", "write", "unknown_default_open_api"])
163
+ return false unless permissions_validator.valid?(@permissions)
164
+ true
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] name Value to be assigned
169
+ def name=(name)
170
+ if name.nil?
171
+ fail ArgumentError, 'name cannot be nil'
172
+ end
173
+
174
+ @name = name
175
+ end
176
+
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] permissions Object to be assigned
179
+ def permissions=(permissions)
180
+ validator = EnumAttributeValidator.new('String', ["read", "write", "unknown_default_open_api"])
181
+ unless validator.valid?(permissions)
182
+ fail ArgumentError, "invalid value for \"permissions\", must be one of #{validator.allowable_values}."
183
+ end
184
+ @permissions = permissions
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ name == o.name &&
193
+ permissions == o.permissions &&
194
+ allowed_ips == o.allowed_ips &&
195
+ customers_read == o.customers_read
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [name, permissions, allowed_ips, customers_read].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ # include attributes inherited from allOf parents (the nearest declaration wins)
217
+ map = acceptable_attribute_map
218
+ transformed_hash = {}
219
+ acceptable_openapi_types.each_pair do |key, type|
220
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
221
+ transformed_hash["#{key}"] = nil
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[map[key]].is_a?(Array)
226
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
227
+ end
228
+ elsif !attributes[map[key]].nil?
229
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
230
+ end
231
+ end
232
+ new(transformed_hash)
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ # include attributes inherited from allOf parents (the nearest declaration wins)
240
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ end
253
+
254
+ end