trevol 0.3.1 → 0.4.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/GENERADO.md +1 -1
  4. data/README.md +1 -1
  5. data/lib/trevol/client.rb +6 -1
  6. data/lib/trevol/transporte.rb +1 -0
  7. data/lib/trevol_generado/api/catalogs_api.rb +164 -0
  8. data/lib/trevol_generado/api/company_settings_api.rb +384 -0
  9. data/lib/trevol_generado/api/credit_notes_api.rb +79 -0
  10. data/lib/trevol_generado/api/debit_notes_api.rb +79 -0
  11. data/lib/trevol_generado/api/dian_documents_api.rb +8 -2
  12. data/lib/trevol_generado/api/equivalent_document_adjustments_api.rb +79 -0
  13. data/lib/trevol_generado/api/equivalent_documents_api.rb +79 -0
  14. data/lib/trevol_generado/api/invoices_api.rb +79 -0
  15. data/lib/trevol_generado/api/payroll_adjustments_api.rb +6 -0
  16. data/lib/trevol_generado/api/payrolls_api.rb +6 -0
  17. data/lib/trevol_generado/api/pdf_designs_api.rb +357 -0
  18. data/lib/trevol_generado/api/pdf_templates_api.rb +79 -0
  19. data/lib/trevol_generado/api/radian_events_api.rb +6 -0
  20. data/lib/trevol_generado/api/support_document_adjustments_api.rb +6 -0
  21. data/lib/trevol_generado/api/support_documents_api.rb +6 -0
  22. data/lib/trevol_generado/models/account_company.rb +11 -1
  23. data/lib/trevol_generado/models/code_list.rb +245 -0
  24. data/lib/trevol_generado/models/code_list_entry.rb +353 -0
  25. data/lib/trevol_generado/models/code_list_entry_list.rb +191 -0
  26. data/lib/trevol_generado/models/code_list_list.rb +191 -0
  27. data/lib/trevol_generado/models/code_list_rates.rb +174 -0
  28. data/lib/trevol_generado/models/company.rb +11 -1
  29. data/lib/trevol_generado/models/company_logo.rb +217 -0
  30. data/lib/trevol_generado/models/company_logo_deleted.rb +170 -0
  31. data/lib/trevol_generado/models/company_logo_input.rb +178 -0
  32. data/lib/trevol_generado/models/delivery.rb +16 -5
  33. data/lib/trevol_generado/models/delivery_email_resends.rb +171 -0
  34. data/lib/trevol_generado/models/document.rb +37 -5
  35. data/lib/trevol_generado/models/document_totals_item.rb +1 -0
  36. data/lib/trevol_generado/models/email_resend.rb +256 -0
  37. data/lib/trevol_generado/models/email_resend_delivery.rb +183 -0
  38. data/lib/trevol_generado/models/email_resend_request.rb +163 -0
  39. data/lib/trevol_generado/models/email_resend_summary.rb +256 -0
  40. data/lib/trevol_generado/models/equivalent_document.rb +27 -5
  41. data/lib/trevol_generado/models/equivalent_document_adjustment.rb +26 -4
  42. data/lib/trevol_generado/models/equivalent_document_adjustment_input.rb +15 -4
  43. data/lib/trevol_generado/models/equivalent_document_input.rb +15 -4
  44. data/lib/trevol_generado/models/event.rb +11 -1
  45. data/lib/trevol_generado/models/invoice_batch.rb +11 -1
  46. data/lib/trevol_generado/models/invoice_batch_invoice_input.rb +24 -5
  47. data/lib/trevol_generado/models/invoice_input.rb +24 -4
  48. data/lib/trevol_generado/models/note_input.rb +15 -4
  49. data/lib/trevol_generado/models/numbering.rb +1 -1
  50. data/lib/trevol_generado/models/pdf_design.rb +297 -0
  51. data/lib/trevol_generado/models/pdf_design_applied.rb +193 -0
  52. data/lib/trevol_generado/models/pdf_design_input.rb +277 -0
  53. data/lib/trevol_generado/models/pdf_design_list.rb +191 -0
  54. data/lib/trevol_generado/models/pdf_design_update.rb +246 -0
  55. data/lib/trevol_generado/models/pdf_settings.rb +202 -0
  56. data/lib/trevol_generado/models/pdf_settings_update.rb +170 -0
  57. data/lib/trevol_generado/models/pdf_template.rb +210 -0
  58. data/lib/trevol_generado/models/pdf_template_list.rb +191 -0
  59. data/lib/trevol_generado/models/preview.rb +11 -1
  60. data/lib/trevol_generado/models/preview_numbering.rb +161 -0
  61. data/lib/trevol_generado/models/problem.rb +26 -4
  62. data/lib/trevol_generado/models/problem_finding.rb +172 -0
  63. data/lib/trevol_generado/models/support_document.rb +11 -1
  64. data/lib/trevol_generado/models/support_document_adjustment.rb +11 -1
  65. data/lib/trevol_generado/models/webhook_endpoint.rb +12 -2
  66. data/lib/trevol_generado/models/webhook_endpoint_input.rb +14 -4
  67. data/lib/trevol_generado/models/webhook_endpoint_update.rb +11 -1
  68. data/lib/trevol_generado/tablas.rb +30 -1
  69. data/lib/trevol_generado/version.rb +1 -1
  70. data/lib/trevol_generado.rb +28 -0
  71. metadata +29 -1
@@ -0,0 +1,202 @@
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
+ class PdfSettings < ApiModelBase
18
+ # Valores conocidos: `pdf_settings`.
19
+ attr_accessor :object
20
+
21
+ # El predeterminado de carta, o `classic`.
22
+ attr_accessor :letter_design_id
23
+
24
+ # El predeterminado de tirilla (80 o 57 mm), o null: el POS usa el de carta.
25
+ attr_accessor :receipt_design_id
26
+
27
+ attr_accessor :logo
28
+
29
+ # Si el titular permitió (en la app) que la API cambie los diseños, los predeterminados y el logo de la empresa.
30
+ attr_accessor :api_writes_enabled
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'object' => :'object',
36
+ :'letter_design_id' => :'letter_design_id',
37
+ :'receipt_design_id' => :'receipt_design_id',
38
+ :'logo' => :'logo',
39
+ :'api_writes_enabled' => :'api_writes_enabled'
40
+ }
41
+ end
42
+
43
+ # Returns attribute mapping this model knows about
44
+ def self.acceptable_attribute_map
45
+ attribute_map
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ acceptable_attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'object' => :'String',
57
+ :'letter_design_id' => :'String',
58
+ :'receipt_design_id' => :'String',
59
+ :'logo' => :'CompanyLogo',
60
+ :'api_writes_enabled' => :'Boolean'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'receipt_design_id',
68
+ :'logo',
69
+ ])
70
+ end
71
+
72
+ # Returns attribute type mapping
73
+ def self.acceptable_openapi_types
74
+ openapi_types
75
+ end
76
+
77
+ # Returns the nullable attributes
78
+ def self.acceptable_openapi_nullable
79
+ openapi_nullable
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrevolGenerado::PdfSettings` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrevolGenerado::PdfSettings`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'object')
99
+ self.object = attributes[:'object']
100
+ end
101
+
102
+ if attributes.key?(:'letter_design_id')
103
+ self.letter_design_id = attributes[:'letter_design_id']
104
+ end
105
+
106
+ if attributes.key?(:'receipt_design_id')
107
+ self.receipt_design_id = attributes[:'receipt_design_id']
108
+ end
109
+
110
+ if attributes.key?(:'logo')
111
+ self.logo = attributes[:'logo']
112
+ end
113
+
114
+ if attributes.key?(:'api_writes_enabled')
115
+ self.api_writes_enabled = attributes[:'api_writes_enabled']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ object == o.object &&
140
+ letter_design_id == o.letter_design_id &&
141
+ receipt_design_id == o.receipt_design_id &&
142
+ logo == o.logo &&
143
+ api_writes_enabled == o.api_writes_enabled
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [object, letter_design_id, receipt_design_id, logo, api_writes_enabled].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ # include attributes inherited from allOf parents (the nearest declaration wins)
165
+ map = acceptable_attribute_map
166
+ transformed_hash = {}
167
+ acceptable_openapi_types.each_pair do |key, type|
168
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
169
+ transformed_hash["#{key}"] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[map[key]].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[map[key]].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ # include attributes inherited from allOf parents (the nearest declaration wins)
188
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ end
201
+
202
+ end
@@ -0,0 +1,170 @@
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
+ class PdfSettingsUpdate < ApiModelBase
18
+ attr_accessor :letter_design_id
19
+
20
+ attr_accessor :receipt_design_id
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'letter_design_id' => :'letter_design_id',
26
+ :'receipt_design_id' => :'receipt_design_id'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'letter_design_id' => :'String',
44
+ :'receipt_design_id' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'receipt_design_id'
52
+ ])
53
+ end
54
+
55
+ # Returns attribute type mapping
56
+ def self.acceptable_openapi_types
57
+ openapi_types
58
+ end
59
+
60
+ # Returns the nullable attributes
61
+ def self.acceptable_openapi_nullable
62
+ openapi_nullable
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrevolGenerado::PdfSettingsUpdate` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ acceptable_attribute_map = self.class.acceptable_attribute_map
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!acceptable_attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrevolGenerado::PdfSettingsUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'letter_design_id')
82
+ self.letter_design_id = attributes[:'letter_design_id']
83
+ end
84
+
85
+ if attributes.key?(:'receipt_design_id')
86
+ self.receipt_design_id = attributes[:'receipt_design_id']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ letter_design_id == o.letter_design_id &&
111
+ receipt_design_id == o.receipt_design_id
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [letter_design_id, receipt_design_id].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ # include attributes inherited from allOf parents (the nearest declaration wins)
133
+ map = acceptable_attribute_map
134
+ transformed_hash = {}
135
+ acceptable_openapi_types.each_pair do |key, type|
136
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
137
+ transformed_hash["#{key}"] = nil
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[map[key]].is_a?(Array)
142
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
143
+ end
144
+ elsif !attributes[map[key]].nil?
145
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
146
+ end
147
+ end
148
+ new(transformed_hash)
149
+ end
150
+
151
+ # Returns the object in the form of hash
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_hash
154
+ hash = {}
155
+ # include attributes inherited from allOf parents (the nearest declaration wins)
156
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
157
+ value = self.send(attr)
158
+ if value.nil?
159
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
160
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
161
+ end
162
+
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ end
169
+
170
+ end
@@ -0,0 +1,210 @@
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
+ class PdfTemplate < ApiModelBase
18
+ # Valores conocidos: `pdf_template`.
19
+ attr_accessor :object
20
+
21
+ # Valores conocidos: `classic`, `modern`, `color_band`, `compact`, `pos_80mm`, `pos_57mm`.
22
+ attr_accessor :key
23
+
24
+ attr_accessor :name
25
+
26
+ attr_accessor :description
27
+
28
+ # `letter` (carta: todos los documentos), `receipt_80mm` o `receipt_57mm` (tirilla: solo el documento equivalente POS y su nota de ajuste). Valores conocidos: `letter`, `receipt_80mm`, `receipt_57mm`.
29
+ attr_accessor :format
30
+
31
+ # Si la plantilla lleva el logo de la empresa.
32
+ attr_accessor :supports_logo
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'object' => :'object',
38
+ :'key' => :'key',
39
+ :'name' => :'name',
40
+ :'description' => :'description',
41
+ :'format' => :'format',
42
+ :'supports_logo' => :'supports_logo'
43
+ }
44
+ end
45
+
46
+ # Returns attribute mapping this model knows about
47
+ def self.acceptable_attribute_map
48
+ attribute_map
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ acceptable_attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'object' => :'String',
60
+ :'key' => :'String',
61
+ :'name' => :'String',
62
+ :'description' => :'String',
63
+ :'format' => :'String',
64
+ :'supports_logo' => :'Boolean'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ :'format',
72
+ ])
73
+ end
74
+
75
+ # Returns attribute type mapping
76
+ def self.acceptable_openapi_types
77
+ openapi_types
78
+ end
79
+
80
+ # Returns the nullable attributes
81
+ def self.acceptable_openapi_nullable
82
+ openapi_nullable
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrevolGenerado::PdfTemplate` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ acceptable_attribute_map = self.class.acceptable_attribute_map
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!acceptable_attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrevolGenerado::PdfTemplate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'object')
102
+ self.object = attributes[:'object']
103
+ end
104
+
105
+ if attributes.key?(:'key')
106
+ self.key = attributes[:'key']
107
+ end
108
+
109
+ if attributes.key?(:'name')
110
+ self.name = attributes[:'name']
111
+ end
112
+
113
+ if attributes.key?(:'description')
114
+ self.description = attributes[:'description']
115
+ end
116
+
117
+ if attributes.key?(:'format')
118
+ self.format = attributes[:'format']
119
+ end
120
+
121
+ if attributes.key?(:'supports_logo')
122
+ self.supports_logo = attributes[:'supports_logo']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ invalid_properties
132
+ end
133
+
134
+ # Check to see if the all the properties in the model are valid
135
+ # @return true if the model is valid
136
+ def valid?
137
+ warn '[DEPRECATED] the `valid?` method is obsolete'
138
+ true
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ object == o.object &&
147
+ key == o.key &&
148
+ name == o.name &&
149
+ description == o.description &&
150
+ format == o.format &&
151
+ supports_logo == o.supports_logo
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [object, key, name, description, format, supports_logo].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ attributes = attributes.transform_keys(&:to_sym)
172
+ # include attributes inherited from allOf parents (the nearest declaration wins)
173
+ map = acceptable_attribute_map
174
+ transformed_hash = {}
175
+ acceptable_openapi_types.each_pair do |key, type|
176
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
177
+ transformed_hash["#{key}"] = nil
178
+ elsif type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[map[key]].is_a?(Array)
182
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
183
+ end
184
+ elsif !attributes[map[key]].nil?
185
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
186
+ end
187
+ end
188
+ new(transformed_hash)
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ # include attributes inherited from allOf parents (the nearest declaration wins)
196
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ end
209
+
210
+ end