smplkit 2.0.3 → 2.0.5

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/actions_api.rb +159 -0
  3. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/functions_api.rb +90 -0
  4. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/api/resource_types_api.rb +159 -0
  5. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/action_attributes.rb +192 -0
  6. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/action_list_links.rb +148 -0
  7. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/action_list_meta.rb +164 -0
  8. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/action_list_response.rb +202 -0
  9. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/action_resource.rb +202 -0
  10. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_attributes.rb +192 -0
  11. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_list_links.rb +148 -0
  12. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_list_meta.rb +164 -0
  13. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_list_response.rb +202 -0
  14. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/resource_type_resource.rb +202 -0
  15. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/usage_attributes.rb +217 -0
  16. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/usage_resource.rb +2 -4
  17. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/wipe_response.rb +201 -0
  18. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/wipe_tables_summary.rb +348 -0
  19. data/lib/smplkit/_generated/audit/lib/smplkit_audit_client.rb +16 -0
  20. data/lib/smplkit/_generated/audit/spec/api/actions_api_spec.rb +62 -0
  21. data/lib/smplkit/_generated/audit/spec/api/functions_api_spec.rb +47 -0
  22. data/lib/smplkit/_generated/audit/spec/api/resource_types_api_spec.rb +62 -0
  23. data/lib/smplkit/_generated/audit/spec/models/action_attributes_spec.rb +42 -0
  24. data/lib/smplkit/_generated/audit/spec/models/action_list_links_spec.rb +36 -0
  25. data/lib/smplkit/_generated/audit/spec/models/action_list_meta_spec.rb +36 -0
  26. data/lib/smplkit/_generated/audit/spec/models/action_list_response_spec.rb +48 -0
  27. data/lib/smplkit/_generated/audit/spec/models/action_resource_spec.rb +48 -0
  28. data/lib/smplkit/_generated/audit/spec/models/resource_type_attributes_spec.rb +42 -0
  29. data/lib/smplkit/_generated/audit/spec/models/resource_type_list_links_spec.rb +36 -0
  30. data/lib/smplkit/_generated/audit/spec/models/resource_type_list_meta_spec.rb +36 -0
  31. data/lib/smplkit/_generated/audit/spec/models/resource_type_list_response_spec.rb +48 -0
  32. data/lib/smplkit/_generated/audit/spec/models/resource_type_resource_spec.rb +48 -0
  33. data/lib/smplkit/_generated/audit/spec/models/usage_attributes_spec.rb +48 -0
  34. data/lib/smplkit/_generated/audit/spec/models/wipe_response_spec.rb +48 -0
  35. data/lib/smplkit/_generated/audit/spec/models/wipe_tables_summary_spec.rb +66 -0
  36. metadata +33 -1
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Audit
17
+ class ResourceTypeResource < ApiModelBase
18
+ # The resource_type slug.
19
+ attr_accessor :id
20
+
21
+ attr_accessor :type
22
+
23
+ attr_accessor :attributes
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'type' => :'type',
30
+ :'attributes' => :'attributes'
31
+ }
32
+ end
33
+
34
+ # Returns attribute mapping this model knows about
35
+ def self.acceptable_attribute_map
36
+ attribute_map
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ acceptable_attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'id' => :'String',
48
+ :'type' => :'String',
49
+ :'attributes' => :'ResourceTypeAttributes'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::ResourceTypeResource` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ acceptable_attribute_map = self.class.acceptable_attribute_map
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!acceptable_attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::ResourceTypeResource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'id')
76
+ self.id = attributes[:'id']
77
+ else
78
+ self.id = nil
79
+ end
80
+
81
+ if attributes.key?(:'type')
82
+ self.type = attributes[:'type']
83
+ else
84
+ self.type = 'resource_type'
85
+ end
86
+
87
+ if attributes.key?(:'attributes')
88
+ self.attributes = attributes[:'attributes']
89
+ else
90
+ self.attributes = nil
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
+ invalid_properties = Array.new
99
+ if @id.nil?
100
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
101
+ end
102
+
103
+ if @attributes.nil?
104
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ warn '[DEPRECATED] the `valid?` method is obsolete'
114
+ return false if @id.nil?
115
+ return false if @attributes.nil?
116
+ true
117
+ end
118
+
119
+ # Custom attribute writer method with validation
120
+ # @param [Object] id Value to be assigned
121
+ def id=(id)
122
+ if id.nil?
123
+ fail ArgumentError, 'id cannot be nil'
124
+ end
125
+
126
+ @id = id
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] attributes Value to be assigned
131
+ def attributes=(attributes)
132
+ if attributes.nil?
133
+ fail ArgumentError, 'attributes cannot be nil'
134
+ end
135
+
136
+ @attributes = attributes
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ id == o.id &&
145
+ type == o.type &&
146
+ attributes == o.attributes
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [id, type, attributes].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ transformed_hash = {}
168
+ openapi_types.each_pair do |key, type|
169
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = nil
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[attribute_map[key]].is_a?(Array)
175
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
176
+ end
177
+ elsif !attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
179
+ end
180
+ end
181
+ new(transformed_hash)
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.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,217 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Audit
17
+ # Attribute set for a usage resource. The shape mirrors the ``/api/v1/usage`` contract used by config, flags, and logging — three fields, no per-product extras. Per-period limits live in the product catalog (``GET /api/v1/products``); the usage endpoint reports counts only.
18
+ class UsageAttributes < ApiModelBase
19
+ attr_accessor :limit_key
20
+
21
+ attr_accessor :period
22
+
23
+ attr_accessor :value
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'limit_key' => :'limit_key',
29
+ :'period' => :'period',
30
+ :'value' => :'value'
31
+ }
32
+ end
33
+
34
+ # Returns attribute mapping this model knows about
35
+ def self.acceptable_attribute_map
36
+ attribute_map
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ acceptable_attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'limit_key' => :'String',
48
+ :'period' => :'String',
49
+ :'value' => :'Integer'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::UsageAttributes` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ acceptable_attribute_map = self.class.acceptable_attribute_map
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!acceptable_attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::UsageAttributes`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'limit_key')
76
+ self.limit_key = attributes[:'limit_key']
77
+ else
78
+ self.limit_key = nil
79
+ end
80
+
81
+ if attributes.key?(:'period')
82
+ self.period = attributes[:'period']
83
+ else
84
+ self.period = nil
85
+ end
86
+
87
+ if attributes.key?(:'value')
88
+ self.value = attributes[:'value']
89
+ else
90
+ self.value = nil
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
+ invalid_properties = Array.new
99
+ if @limit_key.nil?
100
+ invalid_properties.push('invalid value for "limit_key", limit_key cannot be nil.')
101
+ end
102
+
103
+ if @period.nil?
104
+ invalid_properties.push('invalid value for "period", period cannot be nil.')
105
+ end
106
+
107
+ if @value.nil?
108
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
109
+ end
110
+
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ warn '[DEPRECATED] the `valid?` method is obsolete'
118
+ return false if @limit_key.nil?
119
+ return false if @period.nil?
120
+ return false if @value.nil?
121
+ true
122
+ end
123
+
124
+ # Custom attribute writer method with validation
125
+ # @param [Object] limit_key Value to be assigned
126
+ def limit_key=(limit_key)
127
+ if limit_key.nil?
128
+ fail ArgumentError, 'limit_key cannot be nil'
129
+ end
130
+
131
+ @limit_key = limit_key
132
+ end
133
+
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] period Value to be assigned
136
+ def period=(period)
137
+ if period.nil?
138
+ fail ArgumentError, 'period cannot be nil'
139
+ end
140
+
141
+ @period = period
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] value Value to be assigned
146
+ def value=(value)
147
+ if value.nil?
148
+ fail ArgumentError, 'value cannot be nil'
149
+ end
150
+
151
+ @value = value
152
+ end
153
+
154
+ # Checks equality by comparing each attribute.
155
+ # @param [Object] Object to be compared
156
+ def ==(o)
157
+ return true if self.equal?(o)
158
+ self.class == o.class &&
159
+ limit_key == o.limit_key &&
160
+ period == o.period &&
161
+ value == o.value
162
+ end
163
+
164
+ # @see the `==` method
165
+ # @param [Object] Object to be compared
166
+ def eql?(o)
167
+ self == o
168
+ end
169
+
170
+ # Calculates hash code according to all attributes.
171
+ # @return [Integer] Hash code
172
+ def hash
173
+ [limit_key, period, value].hash
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def self.build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ transformed_hash = {}
183
+ openapi_types.each_pair do |key, type|
184
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = nil
186
+ elsif type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[attribute_map[key]].is_a?(Array)
190
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
191
+ end
192
+ elsif !attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
194
+ end
195
+ end
196
+ new(transformed_hash)
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -45,7 +45,7 @@ module SmplkitGeneratedClient::Audit
45
45
  {
46
46
  :'id' => :'String',
47
47
  :'type' => :'String',
48
- :'attributes' => :'Hash<String, Object>'
48
+ :'attributes' => :'UsageAttributes'
49
49
  }
50
50
  end
51
51
 
@@ -84,9 +84,7 @@ module SmplkitGeneratedClient::Audit
84
84
  end
85
85
 
86
86
  if attributes.key?(:'attributes')
87
- if (value = attributes[:'attributes']).is_a?(Hash)
88
- self.attributes = value
89
- end
87
+ self.attributes = attributes[:'attributes']
90
88
  else
91
89
  self.attributes = nil
92
90
  end
@@ -0,0 +1,201 @@
1
+ =begin
2
+ #smplkit Audit API
3
+
4
+ #Append-only change-history substrate for smpl.* resources and customer-application events. ADR-047.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Audit
17
+ class WipeResponse < ApiModelBase
18
+ attr_accessor :wiped
19
+
20
+ attr_accessor :tables
21
+
22
+ attr_accessor :completed_at
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'wiped' => :'wiped',
28
+ :'tables' => :'tables',
29
+ :'completed_at' => :'completed_at'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'wiped' => :'Boolean',
47
+ :'tables' => :'WipeTablesSummary',
48
+ :'completed_at' => :'Time'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::WipeResponse` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::WipeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'wiped')
75
+ self.wiped = attributes[:'wiped']
76
+ else
77
+ self.wiped = true
78
+ end
79
+
80
+ if attributes.key?(:'tables')
81
+ self.tables = attributes[:'tables']
82
+ else
83
+ self.tables = nil
84
+ end
85
+
86
+ if attributes.key?(:'completed_at')
87
+ self.completed_at = attributes[:'completed_at']
88
+ else
89
+ self.completed_at = nil
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ if @tables.nil?
99
+ invalid_properties.push('invalid value for "tables", tables cannot be nil.')
100
+ end
101
+
102
+ if @completed_at.nil?
103
+ invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.')
104
+ end
105
+
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ return false if @tables.nil?
114
+ return false if @completed_at.nil?
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] tables Value to be assigned
120
+ def tables=(tables)
121
+ if tables.nil?
122
+ fail ArgumentError, 'tables cannot be nil'
123
+ end
124
+
125
+ @tables = tables
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] completed_at Value to be assigned
130
+ def completed_at=(completed_at)
131
+ if completed_at.nil?
132
+ fail ArgumentError, 'completed_at cannot be nil'
133
+ end
134
+
135
+ @completed_at = completed_at
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ wiped == o.wiped &&
144
+ tables == o.tables &&
145
+ completed_at == o.completed_at
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [wiped, tables, completed_at].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ openapi_types.each_pair do |key, type|
168
+ if attributes.key?(attribute_map[key]) && attributes[attribute_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[attribute_map[key]].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_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
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ end
200
+
201
+ end