pulp_npm_client 0.1.0a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +157 -0
  4. data/Rakefile +10 -0
  5. data/docs/AsyncOperationResponse.md +17 -0
  6. data/docs/ContentPackagesApi.md +208 -0
  7. data/docs/ContentSummary.md +21 -0
  8. data/docs/ContentSummaryResponse.md +21 -0
  9. data/docs/DistributionsNpmApi.md +364 -0
  10. data/docs/NpmNpmDistribution.md +25 -0
  11. data/docs/NpmNpmDistributionResponse.md +31 -0
  12. data/docs/NpmNpmRemote.md +37 -0
  13. data/docs/NpmNpmRemoteResponse.md +43 -0
  14. data/docs/NpmNpmRepository.md +21 -0
  15. data/docs/NpmNpmRepositoryResponse.md +29 -0
  16. data/docs/NpmPackage.md +27 -0
  17. data/docs/NpmPackageResponse.md +27 -0
  18. data/docs/PaginatedRepositoryVersionResponseList.md +23 -0
  19. data/docs/PaginatednpmNpmDistributionResponseList.md +23 -0
  20. data/docs/PaginatednpmNpmRemoteResponseList.md +23 -0
  21. data/docs/PaginatednpmNpmRepositoryResponseList.md +23 -0
  22. data/docs/PaginatednpmPackageResponseList.md +23 -0
  23. data/docs/PatchednpmNpmDistribution.md +25 -0
  24. data/docs/PatchednpmNpmRemote.md +37 -0
  25. data/docs/PatchednpmNpmRepository.md +21 -0
  26. data/docs/PolicyEnum.md +16 -0
  27. data/docs/PulpNpmPackagesApi.md +60 -0
  28. data/docs/RemotesNpmApi.md +368 -0
  29. data/docs/RepositoriesNpmApi.md +468 -0
  30. data/docs/RepositoriesNpmVersionsApi.md +271 -0
  31. data/docs/RepositoryAddRemoveContent.md +21 -0
  32. data/docs/RepositorySyncURL.md +19 -0
  33. data/docs/RepositoryVersion.md +17 -0
  34. data/docs/RepositoryVersionResponse.md +25 -0
  35. data/git_push.sh +58 -0
  36. data/lib/pulp_npm_client.rb +69 -0
  37. data/lib/pulp_npm_client/api/content_packages_api.rb +264 -0
  38. data/lib/pulp_npm_client/api/distributions_npm_api.rb +445 -0
  39. data/lib/pulp_npm_client/api/pulp_npm_packages_api.rb +86 -0
  40. data/lib/pulp_npm_client/api/remotes_npm_api.rb +451 -0
  41. data/lib/pulp_npm_client/api/repositories_npm_api.rb +573 -0
  42. data/lib/pulp_npm_client/api/repositories_npm_versions_api.rb +339 -0
  43. data/lib/pulp_npm_client/api_client.rb +402 -0
  44. data/lib/pulp_npm_client/api_error.rb +57 -0
  45. data/lib/pulp_npm_client/configuration.rb +243 -0
  46. data/lib/pulp_npm_client/models/async_operation_response.rb +213 -0
  47. data/lib/pulp_npm_client/models/content_summary.rb +240 -0
  48. data/lib/pulp_npm_client/models/content_summary_response.rb +240 -0
  49. data/lib/pulp_npm_client/models/npm_npm_distribution.rb +261 -0
  50. data/lib/pulp_npm_client/models/npm_npm_distribution_response.rb +290 -0
  51. data/lib/pulp_npm_client/models/npm_npm_remote.rb +339 -0
  52. data/lib/pulp_npm_client/models/npm_npm_remote_response.rb +368 -0
  53. data/lib/pulp_npm_client/models/npm_npm_repository.rb +234 -0
  54. data/lib/pulp_npm_client/models/npm_npm_repository_response.rb +271 -0
  55. data/lib/pulp_npm_client/models/npm_package.rb +270 -0
  56. data/lib/pulp_npm_client/models/npm_package_response.rb +269 -0
  57. data/lib/pulp_npm_client/models/paginated_repository_version_response_list.rb +237 -0
  58. data/lib/pulp_npm_client/models/paginatednpm_npm_distribution_response_list.rb +237 -0
  59. data/lib/pulp_npm_client/models/paginatednpm_npm_remote_response_list.rb +237 -0
  60. data/lib/pulp_npm_client/models/paginatednpm_npm_repository_response_list.rb +237 -0
  61. data/lib/pulp_npm_client/models/paginatednpm_package_response_list.rb +237 -0
  62. data/lib/pulp_npm_client/models/patchednpm_npm_distribution.rb +251 -0
  63. data/lib/pulp_npm_client/models/patchednpm_npm_remote.rb +329 -0
  64. data/lib/pulp_npm_client/models/patchednpm_npm_repository.rb +229 -0
  65. data/lib/pulp_npm_client/models/policy_enum.rb +37 -0
  66. data/lib/pulp_npm_client/models/repository_add_remove_content.rb +232 -0
  67. data/lib/pulp_npm_client/models/repository_sync_url.rb +220 -0
  68. data/lib/pulp_npm_client/models/repository_version.rb +208 -0
  69. data/lib/pulp_npm_client/models/repository_version_response.rb +246 -0
  70. data/lib/pulp_npm_client/version.rb +15 -0
  71. data/pulp_npm_client.gemspec +39 -0
  72. data/spec/api/content_packages_api_spec.rb +87 -0
  73. data/spec/api/distributions_npm_api_spec.rb +121 -0
  74. data/spec/api/pulp_npm_packages_api_spec.rb +48 -0
  75. data/spec/api/remotes_npm_api_spec.rb +123 -0
  76. data/spec/api/repositories_npm_api_spec.rb +143 -0
  77. data/spec/api/repositories_npm_versions_api_spec.rb +104 -0
  78. data/spec/api_client_spec.rb +188 -0
  79. data/spec/configuration_spec.rb +42 -0
  80. data/spec/models/async_operation_response_spec.rb +41 -0
  81. data/spec/models/content_summary_response_spec.rb +53 -0
  82. data/spec/models/content_summary_spec.rb +53 -0
  83. data/spec/models/npm_npm_distribution_response_spec.rb +83 -0
  84. data/spec/models/npm_npm_distribution_spec.rb +65 -0
  85. data/spec/models/npm_npm_remote_response_spec.rb +119 -0
  86. data/spec/models/npm_npm_remote_spec.rb +101 -0
  87. data/spec/models/npm_npm_repository_response_spec.rb +77 -0
  88. data/spec/models/npm_npm_repository_spec.rb +53 -0
  89. data/spec/models/npm_package_response_spec.rb +71 -0
  90. data/spec/models/npm_package_spec.rb +71 -0
  91. data/spec/models/paginated_repository_version_response_list_spec.rb +59 -0
  92. data/spec/models/paginatednpm_npm_distribution_response_list_spec.rb +59 -0
  93. data/spec/models/paginatednpm_npm_remote_response_list_spec.rb +59 -0
  94. data/spec/models/paginatednpm_npm_repository_response_list_spec.rb +59 -0
  95. data/spec/models/paginatednpm_package_response_list_spec.rb +59 -0
  96. data/spec/models/patchednpm_npm_distribution_spec.rb +65 -0
  97. data/spec/models/patchednpm_npm_remote_spec.rb +101 -0
  98. data/spec/models/patchednpm_npm_repository_spec.rb +53 -0
  99. data/spec/models/policy_enum_spec.rb +35 -0
  100. data/spec/models/repository_add_remove_content_spec.rb +53 -0
  101. data/spec/models/repository_sync_url_spec.rb +47 -0
  102. data/spec/models/repository_version_response_spec.rb +65 -0
  103. data/spec/models/repository_version_spec.rb +41 -0
  104. data/spec/spec_helper.rb +111 -0
  105. metadata +233 -0
@@ -0,0 +1,37 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpNpmClient
16
+ class PolicyEnum
17
+ IMMEDIATE = "immediate".freeze
18
+ ON_DEMAND = "on_demand".freeze
19
+ STREAMED = "streamed".freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = PolicyEnum.constants.select { |c| PolicyEnum::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #PolicyEnum" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,232 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpNpmClient
16
+ # Base serializer for use with :class:`pulpcore.app.models.Model` This ensures that all Serializers provide values for the 'pulp_href` field. The class provides a default for the ``ref_name`` attribute in the ModelSerializers's ``Meta`` class. This ensures that the OpenAPI definitions of plugins are namespaced properly.
17
+ class RepositoryAddRemoveContent
18
+ # A list of content units to add to a new repository version. This content is added after remove_content_units are removed.
19
+ attr_accessor :add_content_units
20
+
21
+ # A list of content units to remove from the latest repository version. You may also specify '*' as an entry to remove all content. This content is removed before add_content_units are added.
22
+ attr_accessor :remove_content_units
23
+
24
+ # A repository version whose content will be used as the initial set of content for the new repository version
25
+ attr_accessor :base_version
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'add_content_units' => :'add_content_units',
31
+ :'remove_content_units' => :'remove_content_units',
32
+ :'base_version' => :'base_version'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'add_content_units' => :'Array<Object>',
40
+ :'remove_content_units' => :'Array<Object>',
41
+ :'base_version' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::RepositoryAddRemoveContent` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::RepositoryAddRemoveContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'add_content_units')
67
+ if (value = attributes[:'add_content_units']).is_a?(Array)
68
+ self.add_content_units = value
69
+ end
70
+ end
71
+
72
+ if attributes.key?(:'remove_content_units')
73
+ if (value = attributes[:'remove_content_units']).is_a?(Array)
74
+ self.remove_content_units = value
75
+ end
76
+ end
77
+
78
+ if attributes.key?(:'base_version')
79
+ self.base_version = attributes[:'base_version']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ add_content_units == o.add_content_units &&
102
+ remove_content_units == o.remove_content_units &&
103
+ base_version == o.base_version
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [add_content_units, remove_content_units, base_version].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :DateTime
152
+ DateTime.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ PulpNpmClient.const_get(type).build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+ end
232
+ end
@@ -0,0 +1,220 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PulpNpmClient
16
+ # A mixin for validating unknown serializers' fields.
17
+ class RepositorySyncURL
18
+ # A remote to sync from. This will override a remote set on repository.
19
+ attr_accessor :remote
20
+
21
+ # If ``True``, synchronization will remove all content that is not present in the remote repository. If ``False``, sync will be additive only.
22
+ attr_accessor :mirror
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'remote' => :'remote',
28
+ :'mirror' => :'mirror'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'remote' => :'String',
36
+ :'mirror' => :'Boolean'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PulpNpmClient::RepositorySyncURL` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PulpNpmClient::RepositorySyncURL`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'remote')
62
+ self.remote = attributes[:'remote']
63
+ end
64
+
65
+ if attributes.key?(:'mirror')
66
+ self.mirror = attributes[:'mirror']
67
+ else
68
+ self.mirror = false
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ remote == o.remote &&
91
+ mirror == o.mirror
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [remote, mirror].hash
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 self.build_from_hash(attributes)
110
+ new.build_from_hash(attributes)
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ PulpNpmClient.const_get(type).build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ if value.nil?
193
+ is_nullable = self.class.openapi_nullable.include?(attr)
194
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
195
+ end
196
+
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+ end
220
+ end