pulp_rpm_client 3.18.0.dev1662699317 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -36
  3. data/docs/AcsRpmApi.md +0 -228
  4. data/docs/DistributionsRpmApi.md +0 -228
  5. data/docs/PublicationsRpmApi.md +0 -228
  6. data/docs/RemotesRpmApi.md +0 -228
  7. data/docs/RemotesUlnApi.md +0 -228
  8. data/docs/RepositoriesRpmApi.md +0 -228
  9. data/docs/RpmModulemd.md +5 -1
  10. data/docs/RpmModulemdResponse.md +5 -1
  11. data/lib/pulp_rpm_client/api/acs_rpm_api.rb +0 -268
  12. data/lib/pulp_rpm_client/api/content_modulemds_api.rb +1 -1
  13. data/lib/pulp_rpm_client/api/distributions_rpm_api.rb +0 -268
  14. data/lib/pulp_rpm_client/api/publications_rpm_api.rb +0 -268
  15. data/lib/pulp_rpm_client/api/remotes_rpm_api.rb +0 -268
  16. data/lib/pulp_rpm_client/api/remotes_uln_api.rb +0 -268
  17. data/lib/pulp_rpm_client/api/repositories_rpm_api.rb +0 -268
  18. data/lib/pulp_rpm_client/models/rpm_modulemd.rb +49 -4
  19. data/lib/pulp_rpm_client/models/rpm_modulemd_response.rb +30 -4
  20. data/lib/pulp_rpm_client/version.rb +1 -1
  21. data/lib/pulp_rpm_client.rb +0 -4
  22. data/spec/api/acs_rpm_api_spec.rb +0 -50
  23. data/spec/api/distributions_rpm_api_spec.rb +0 -50
  24. data/spec/api/publications_rpm_api_spec.rb +0 -50
  25. data/spec/api/remotes_rpm_api_spec.rb +0 -50
  26. data/spec/api/remotes_uln_api_spec.rb +0 -50
  27. data/spec/api/repositories_rpm_api_spec.rb +0 -50
  28. data/spec/models/rpm_modulemd_response_spec.rb +12 -0
  29. data/spec/models/rpm_modulemd_spec.rb +12 -0
  30. metadata +4 -20
  31. data/docs/MyPermissionsResponse.md +0 -17
  32. data/docs/NestedRole.md +0 -21
  33. data/docs/NestedRoleResponse.md +0 -21
  34. data/docs/ObjectRolesResponse.md +0 -17
  35. data/lib/pulp_rpm_client/models/my_permissions_response.rb +0 -213
  36. data/lib/pulp_rpm_client/models/nested_role.rb +0 -234
  37. data/lib/pulp_rpm_client/models/nested_role_response.rb +0 -234
  38. data/lib/pulp_rpm_client/models/object_roles_response.rb +0 -213
  39. data/spec/models/my_permissions_response_spec.rb +0 -41
  40. data/spec/models/nested_role_response_spec.rb +0 -53
  41. data/spec/models/nested_role_spec.rb +0 -53
  42. data/spec/models/object_roles_response_spec.rb +0 -41
@@ -92,4 +92,16 @@ describe 'RpmModulemd' do
92
92
  end
93
93
  end
94
94
 
95
+ describe 'test attribute "profiles"' do
96
+ it 'should work' do
97
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
98
+ end
99
+ end
100
+
101
+ describe 'test attribute "description"' do
102
+ it 'should work' do
103
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
104
+ end
105
+ end
106
+
95
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulp_rpm_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.0.dev1662699317
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-09 00:00:00.000000000 Z
11
+ date: 2022-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -102,10 +102,6 @@ files:
102
102
  - docs/DistributionsRpmApi.md
103
103
  - docs/ImageResponse.md
104
104
  - docs/MetadataChecksumTypeEnum.md
105
- - docs/MyPermissionsResponse.md
106
- - docs/NestedRole.md
107
- - docs/NestedRoleResponse.md
108
- - docs/ObjectRolesResponse.md
109
105
  - docs/PackageChecksumTypeEnum.md
110
106
  - docs/PaginatedRepositoryVersionResponseList.md
111
107
  - docs/PaginatedrpmDistributionTreeResponseList.md
@@ -209,10 +205,6 @@ files:
209
205
  - lib/pulp_rpm_client/models/copy.rb
210
206
  - lib/pulp_rpm_client/models/image_response.rb
211
207
  - lib/pulp_rpm_client/models/metadata_checksum_type_enum.rb
212
- - lib/pulp_rpm_client/models/my_permissions_response.rb
213
- - lib/pulp_rpm_client/models/nested_role.rb
214
- - lib/pulp_rpm_client/models/nested_role_response.rb
215
- - lib/pulp_rpm_client/models/object_roles_response.rb
216
208
  - lib/pulp_rpm_client/models/package_checksum_type_enum.rb
217
209
  - lib/pulp_rpm_client/models/paginated_repository_version_response_list.rb
218
210
  - lib/pulp_rpm_client/models/paginatedrpm_distribution_tree_response_list.rb
@@ -309,10 +301,6 @@ files:
309
301
  - spec/models/copy_spec.rb
310
302
  - spec/models/image_response_spec.rb
311
303
  - spec/models/metadata_checksum_type_enum_spec.rb
312
- - spec/models/my_permissions_response_spec.rb
313
- - spec/models/nested_role_response_spec.rb
314
- - spec/models/nested_role_spec.rb
315
- - spec/models/object_roles_response_spec.rb
316
304
  - spec/models/package_checksum_type_enum_spec.rb
317
305
  - spec/models/paginated_repository_version_response_list_spec.rb
318
306
  - spec/models/paginatedrpm_distribution_tree_response_list_spec.rb
@@ -392,9 +380,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
392
380
  version: '1.9'
393
381
  required_rubygems_version: !ruby/object:Gem::Requirement
394
382
  requirements:
395
- - - ">"
383
+ - - ">="
396
384
  - !ruby/object:Gem::Version
397
- version: 1.3.1
385
+ version: '0'
398
386
  requirements: []
399
387
  rubygems_version: 3.0.3.1
400
388
  signing_key:
@@ -432,7 +420,6 @@ test_files:
432
420
  - spec/models/image_response_spec.rb
433
421
  - spec/models/patchedrpm_rpm_alternate_content_source_spec.rb
434
422
  - spec/models/paginatedrpm_modulemd_defaults_response_list_spec.rb
435
- - spec/models/my_permissions_response_spec.rb
436
423
  - spec/models/async_operation_response_spec.rb
437
424
  - spec/models/patchedrpm_rpm_repository_spec.rb
438
425
  - spec/models/rpm_repository_sync_url_spec.rb
@@ -453,7 +440,6 @@ test_files:
453
440
  - spec/models/repair_spec.rb
454
441
  - spec/models/rpm_distribution_tree_response_spec.rb
455
442
  - spec/models/paginatedrpm_package_group_response_list_spec.rb
456
- - spec/models/nested_role_spec.rb
457
443
  - spec/models/rpm_uln_remote_spec.rb
458
444
  - spec/models/paginatedrpm_rpm_publication_response_list_spec.rb
459
445
  - spec/models/patchedrpm_uln_remote_spec.rb
@@ -470,14 +456,12 @@ test_files:
470
456
  - spec/models/rpm_rpm_distribution_response_spec.rb
471
457
  - spec/models/rpm_rpm_remote_response_spec.rb
472
458
  - spec/models/policy_enum_spec.rb
473
- - spec/models/object_roles_response_spec.rb
474
459
  - spec/models/rpm_rpm_repository_response_spec.rb
475
460
  - spec/models/patchedrpm_rpm_remote_spec.rb
476
461
  - spec/models/package_checksum_type_enum_spec.rb
477
462
  - spec/models/artifact_response_spec.rb
478
463
  - spec/models/paginated_repository_version_response_list_spec.rb
479
464
  - spec/models/rpm_modulemd_defaults_response_spec.rb
480
- - spec/models/nested_role_response_spec.rb
481
465
  - spec/models/patchedrpm_rpm_distribution_spec.rb
482
466
  - spec/models/metadata_checksum_type_enum_spec.rb
483
467
  - spec/models/paginatedrpm_package_environment_response_list_spec.rb
@@ -1,17 +0,0 @@
1
- # PulpRpmClient::MyPermissionsResponse
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **permissions** | **Array<String>** | |
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'PulpRpmClient'
13
-
14
- instance = PulpRpmClient::MyPermissionsResponse.new(permissions: null)
15
- ```
16
-
17
-
data/docs/NestedRole.md DELETED
@@ -1,21 +0,0 @@
1
- # PulpRpmClient::NestedRole
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **users** | **Array<String>** | | [optional]
8
- **groups** | **Array<String>** | | [optional]
9
- **role** | **String** | |
10
-
11
- ## Code Sample
12
-
13
- ```ruby
14
- require 'PulpRpmClient'
15
-
16
- instance = PulpRpmClient::NestedRole.new(users: null,
17
- groups: null,
18
- role: null)
19
- ```
20
-
21
-
@@ -1,21 +0,0 @@
1
- # PulpRpmClient::NestedRoleResponse
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **users** | **Array<String>** | | [optional]
8
- **groups** | **Array<String>** | | [optional]
9
- **role** | **String** | |
10
-
11
- ## Code Sample
12
-
13
- ```ruby
14
- require 'PulpRpmClient'
15
-
16
- instance = PulpRpmClient::NestedRoleResponse.new(users: null,
17
- groups: null,
18
- role: null)
19
- ```
20
-
21
-
@@ -1,17 +0,0 @@
1
- # PulpRpmClient::ObjectRolesResponse
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **roles** | [**Array<NestedRoleResponse>**](NestedRoleResponse.md) | |
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'PulpRpmClient'
13
-
14
- instance = PulpRpmClient::ObjectRolesResponse.new(roles: null)
15
- ```
16
-
17
-
@@ -1,213 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #Fetch, Upload, Organize, and Distribute Software Packages
5
-
6
- The version of the OpenAPI document: v3
7
- Contact: pulp-list@redhat.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module PulpRpmClient
16
- class MyPermissionsResponse
17
- attr_accessor :permissions
18
-
19
- # Attribute mapping from ruby-style variable name to JSON key.
20
- def self.attribute_map
21
- {
22
- :'permissions' => :'permissions'
23
- }
24
- end
25
-
26
- # Attribute type mapping.
27
- def self.openapi_types
28
- {
29
- :'permissions' => :'Array<String>'
30
- }
31
- end
32
-
33
- # List of attributes with nullable: true
34
- def self.openapi_nullable
35
- Set.new([
36
- ])
37
- end
38
-
39
- # Initializes the object
40
- # @param [Hash] attributes Model attributes in the form of hash
41
- def initialize(attributes = {})
42
- if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::MyPermissionsResponse` initialize method"
44
- end
45
-
46
- # check to see if the attribute exists and convert string to symbol for hash key
47
- attributes = attributes.each_with_object({}) { |(k, v), h|
48
- if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::MyPermissionsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
- end
51
- h[k.to_sym] = v
52
- }
53
-
54
- if attributes.key?(:'permissions')
55
- if (value = attributes[:'permissions']).is_a?(Array)
56
- self.permissions = value
57
- end
58
- end
59
- end
60
-
61
- # Show invalid properties with the reasons. Usually used together with valid?
62
- # @return Array for valid properties with the reasons
63
- def list_invalid_properties
64
- invalid_properties = Array.new
65
- if @permissions.nil?
66
- invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
67
- end
68
-
69
- invalid_properties
70
- end
71
-
72
- # Check to see if the all the properties in the model are valid
73
- # @return true if the model is valid
74
- def valid?
75
- return false if @permissions.nil?
76
- true
77
- end
78
-
79
- # Checks equality by comparing each attribute.
80
- # @param [Object] Object to be compared
81
- def ==(o)
82
- return true if self.equal?(o)
83
- self.class == o.class &&
84
- permissions == o.permissions
85
- end
86
-
87
- # @see the `==` method
88
- # @param [Object] Object to be compared
89
- def eql?(o)
90
- self == o
91
- end
92
-
93
- # Calculates hash code according to all attributes.
94
- # @return [Integer] Hash code
95
- def hash
96
- [permissions].hash
97
- end
98
-
99
- # Builds the object from hash
100
- # @param [Hash] attributes Model attributes in the form of hash
101
- # @return [Object] Returns the model itself
102
- def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
- return nil unless attributes.is_a?(Hash)
111
- self.class.openapi_types.each_pair do |key, type|
112
- if type =~ /\AArray<(.*)>/i
113
- # check to ensure the input is an array given that the attribute
114
- # is documented as an array but the input is not
115
- if attributes[self.class.attribute_map[key]].is_a?(Array)
116
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
- end
118
- elsif !attributes[self.class.attribute_map[key]].nil?
119
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
- end # or else data not found in attributes(hash), not an issue as the data can be optional
121
- end
122
-
123
- self
124
- end
125
-
126
- # Deserializes the data based on type
127
- # @param string type Data type
128
- # @param string value Value to be deserialized
129
- # @return [Object] Deserialized data
130
- def _deserialize(type, value)
131
- case type.to_sym
132
- when :DateTime
133
- DateTime.parse(value)
134
- when :Date
135
- Date.parse(value)
136
- when :String
137
- value.to_s
138
- when :Integer
139
- value.to_i
140
- when :Float
141
- value.to_f
142
- when :Boolean
143
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
- true
145
- else
146
- false
147
- end
148
- when :Object
149
- # generic object (usually a Hash), return directly
150
- value
151
- when /\AArray<(?<inner_type>.+)>\z/
152
- inner_type = Regexp.last_match[:inner_type]
153
- value.map { |v| _deserialize(inner_type, v) }
154
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
- k_type = Regexp.last_match[:k_type]
156
- v_type = Regexp.last_match[:v_type]
157
- {}.tap do |hash|
158
- value.each do |k, v|
159
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
- end
161
- end
162
- else # model
163
- PulpRpmClient.const_get(type).build_from_hash(value)
164
- end
165
- end
166
-
167
- # Returns the string representation of the object
168
- # @return [String] String presentation of the object
169
- def to_s
170
- to_hash.to_s
171
- end
172
-
173
- # to_body is an alias to to_hash (backward compatibility)
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_body
176
- to_hash
177
- end
178
-
179
- # Returns the object in the form of hash
180
- # @return [Hash] Returns the object in the form of hash
181
- def to_hash
182
- hash = {}
183
- self.class.attribute_map.each_pair do |attr, param|
184
- value = self.send(attr)
185
- if value.nil?
186
- is_nullable = self.class.openapi_nullable.include?(attr)
187
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
- end
189
-
190
- hash[param] = _to_hash(value)
191
- end
192
- hash
193
- end
194
-
195
- # Outputs non-array value in the form of hash
196
- # For object, use to_hash. Otherwise, just return the value
197
- # @param [Object] value Any valid value
198
- # @return [Hash] Returns the value in the form of hash
199
- def _to_hash(value)
200
- if value.is_a?(Array)
201
- value.compact.map { |v| _to_hash(v) }
202
- elsif value.is_a?(Hash)
203
- {}.tap do |hash|
204
- value.each { |k, v| hash[k] = _to_hash(v) }
205
- end
206
- elsif value.respond_to? :to_hash
207
- value.to_hash
208
- else
209
- value
210
- end
211
- end
212
- end
213
- end
@@ -1,234 +0,0 @@
1
- =begin
2
- #Pulp 3 API
3
-
4
- #Fetch, Upload, Organize, and Distribute Software Packages
5
-
6
- The version of the OpenAPI document: v3
7
- Contact: pulp-list@redhat.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module PulpRpmClient
16
- # Serializer to add/remove object roles to/from users/groups. This is used in conjunction with ``pulpcore.app.viewsets.base.RolesMixin`` and requires the underlying object to be passed as ``content_object`` in the context.
17
- class NestedRole
18
- attr_accessor :users
19
-
20
- attr_accessor :groups
21
-
22
- attr_accessor :role
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'users' => :'users',
28
- :'groups' => :'groups',
29
- :'role' => :'role'
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.openapi_types
35
- {
36
- :'users' => :'Array<String>',
37
- :'groups' => :'Array<String>',
38
- :'role' => :'String'
39
- }
40
- end
41
-
42
- # List of attributes with nullable: true
43
- def self.openapi_nullable
44
- Set.new([
45
- ])
46
- end
47
-
48
- # Initializes the object
49
- # @param [Hash] attributes Model attributes in the form of hash
50
- def initialize(attributes = {})
51
- if (!attributes.is_a?(Hash))
52
- fail ArgumentError, "The input argument (attributes) must be a hash in `PulpRpmClient::NestedRole` initialize method"
53
- end
54
-
55
- # check to see if the attribute exists and convert string to symbol for hash key
56
- attributes = attributes.each_with_object({}) { |(k, v), h|
57
- if (!self.class.attribute_map.key?(k.to_sym))
58
- fail ArgumentError, "`#{k}` is not a valid attribute in `PulpRpmClient::NestedRole`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
- end
60
- h[k.to_sym] = v
61
- }
62
-
63
- if attributes.key?(:'users')
64
- if (value = attributes[:'users']).is_a?(Array)
65
- self.users = value
66
- end
67
- end
68
-
69
- if attributes.key?(:'groups')
70
- if (value = attributes[:'groups']).is_a?(Array)
71
- self.groups = value
72
- end
73
- end
74
-
75
- if attributes.key?(:'role')
76
- self.role = attributes[:'role']
77
- end
78
- end
79
-
80
- # Show invalid properties with the reasons. Usually used together with valid?
81
- # @return Array for valid properties with the reasons
82
- def list_invalid_properties
83
- invalid_properties = Array.new
84
- if @role.nil?
85
- invalid_properties.push('invalid value for "role", role cannot be nil.')
86
- end
87
-
88
- invalid_properties
89
- end
90
-
91
- # Check to see if the all the properties in the model are valid
92
- # @return true if the model is valid
93
- def valid?
94
- return false if @role.nil?
95
- true
96
- end
97
-
98
- # Checks equality by comparing each attribute.
99
- # @param [Object] Object to be compared
100
- def ==(o)
101
- return true if self.equal?(o)
102
- self.class == o.class &&
103
- users == o.users &&
104
- groups == o.groups &&
105
- role == o.role
106
- end
107
-
108
- # @see the `==` method
109
- # @param [Object] Object to be compared
110
- def eql?(o)
111
- self == o
112
- end
113
-
114
- # Calculates hash code according to all attributes.
115
- # @return [Integer] Hash code
116
- def hash
117
- [users, groups, role].hash
118
- end
119
-
120
- # Builds the object from hash
121
- # @param [Hash] attributes Model attributes in the form of hash
122
- # @return [Object] Returns the model itself
123
- def self.build_from_hash(attributes)
124
- new.build_from_hash(attributes)
125
- end
126
-
127
- # Builds the object from hash
128
- # @param [Hash] attributes Model attributes in the form of hash
129
- # @return [Object] Returns the model itself
130
- def build_from_hash(attributes)
131
- return nil unless attributes.is_a?(Hash)
132
- self.class.openapi_types.each_pair do |key, type|
133
- if type =~ /\AArray<(.*)>/i
134
- # check to ensure the input is an array given that the attribute
135
- # is documented as an array but the input is not
136
- if attributes[self.class.attribute_map[key]].is_a?(Array)
137
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
- end
139
- elsif !attributes[self.class.attribute_map[key]].nil?
140
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
- end # or else data not found in attributes(hash), not an issue as the data can be optional
142
- end
143
-
144
- self
145
- end
146
-
147
- # Deserializes the data based on type
148
- # @param string type Data type
149
- # @param string value Value to be deserialized
150
- # @return [Object] Deserialized data
151
- def _deserialize(type, value)
152
- case type.to_sym
153
- when :DateTime
154
- DateTime.parse(value)
155
- when :Date
156
- Date.parse(value)
157
- when :String
158
- value.to_s
159
- when :Integer
160
- value.to_i
161
- when :Float
162
- value.to_f
163
- when :Boolean
164
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
- true
166
- else
167
- false
168
- end
169
- when :Object
170
- # generic object (usually a Hash), return directly
171
- value
172
- when /\AArray<(?<inner_type>.+)>\z/
173
- inner_type = Regexp.last_match[:inner_type]
174
- value.map { |v| _deserialize(inner_type, v) }
175
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
- k_type = Regexp.last_match[:k_type]
177
- v_type = Regexp.last_match[:v_type]
178
- {}.tap do |hash|
179
- value.each do |k, v|
180
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
- end
182
- end
183
- else # model
184
- PulpRpmClient.const_get(type).build_from_hash(value)
185
- end
186
- end
187
-
188
- # Returns the string representation of the object
189
- # @return [String] String presentation of the object
190
- def to_s
191
- to_hash.to_s
192
- end
193
-
194
- # to_body is an alias to to_hash (backward compatibility)
195
- # @return [Hash] Returns the object in the form of hash
196
- def to_body
197
- to_hash
198
- end
199
-
200
- # Returns the object in the form of hash
201
- # @return [Hash] Returns the object in the form of hash
202
- def to_hash
203
- hash = {}
204
- self.class.attribute_map.each_pair do |attr, param|
205
- value = self.send(attr)
206
- if value.nil?
207
- is_nullable = self.class.openapi_nullable.include?(attr)
208
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
- end
210
-
211
- hash[param] = _to_hash(value)
212
- end
213
- hash
214
- end
215
-
216
- # Outputs non-array value in the form of hash
217
- # For object, use to_hash. Otherwise, just return the value
218
- # @param [Object] value Any valid value
219
- # @return [Hash] Returns the value in the form of hash
220
- def _to_hash(value)
221
- if value.is_a?(Array)
222
- value.compact.map { |v| _to_hash(v) }
223
- elsif value.is_a?(Hash)
224
- {}.tap do |hash|
225
- value.each { |k, v| hash[k] = _to_hash(v) }
226
- end
227
- elsif value.respond_to? :to_hash
228
- value.to_hash
229
- else
230
- value
231
- end
232
- end
233
- end
234
- end