wcc_ministries_client 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +68 -0
  4. data/README.md +108 -0
  5. data/Rakefile +10 -0
  6. data/bin/gen +32 -0
  7. data/docs/Asset.md +22 -0
  8. data/docs/AssetFile.md +24 -0
  9. data/docs/AssetFileDetails.md +20 -0
  10. data/docs/AssetFileDetailsImage.md +20 -0
  11. data/docs/CachingMeta.md +20 -0
  12. data/docs/DeletedMinistry.md +20 -0
  13. data/docs/InlineResponse200.md +24 -0
  14. data/docs/InlineResponse2001.md +20 -0
  15. data/docs/InlineResponse200Links.md +26 -0
  16. data/docs/InlineResponse200Meta.md +22 -0
  17. data/docs/Ministry.md +28 -0
  18. data/docs/MinistryApi.md +141 -0
  19. data/docs/MinistryAttributes.md +24 -0
  20. data/docs/MinistryLinks.md +18 -0
  21. data/docs/MinistryRelationships.md +18 -0
  22. data/docs/Page.md +26 -0
  23. data/docs/PageAttributes.md +24 -0
  24. data/docs/PageLinks.md +18 -0
  25. data/docs/PageRelationship.md +18 -0
  26. data/docs/PageRelationshipData.md +20 -0
  27. data/git_push.sh +58 -0
  28. data/lib/wcc_ministries_client/api/ministry_api.rb +149 -0
  29. data/lib/wcc_ministries_client/api_client.rb +389 -0
  30. data/lib/wcc_ministries_client/api_error.rb +57 -0
  31. data/lib/wcc_ministries_client/configuration.rb +270 -0
  32. data/lib/wcc_ministries_client/models/asset.rb +244 -0
  33. data/lib/wcc_ministries_client/models/asset_file.rb +249 -0
  34. data/lib/wcc_ministries_client/models/asset_file_details.rb +226 -0
  35. data/lib/wcc_ministries_client/models/asset_file_details_image.rb +237 -0
  36. data/lib/wcc_ministries_client/models/caching_meta.rb +237 -0
  37. data/lib/wcc_ministries_client/models/deleted_ministry.rb +271 -0
  38. data/lib/wcc_ministries_client/models/inline_response200.rb +262 -0
  39. data/lib/wcc_ministries_client/models/inline_response2001.rb +232 -0
  40. data/lib/wcc_ministries_client/models/inline_response200_links.rb +272 -0
  41. data/lib/wcc_ministries_client/models/inline_response200_meta.rb +252 -0
  42. data/lib/wcc_ministries_client/models/ministry.rb +327 -0
  43. data/lib/wcc_ministries_client/models/ministry_attributes.rb +258 -0
  44. data/lib/wcc_ministries_client/models/ministry_links.rb +222 -0
  45. data/lib/wcc_ministries_client/models/ministry_relationships.rb +216 -0
  46. data/lib/wcc_ministries_client/models/page.rb +313 -0
  47. data/lib/wcc_ministries_client/models/page_attributes.rb +263 -0
  48. data/lib/wcc_ministries_client/models/page_links.rb +222 -0
  49. data/lib/wcc_ministries_client/models/page_relationship.rb +221 -0
  50. data/lib/wcc_ministries_client/models/page_relationship_data.rb +269 -0
  51. data/lib/wcc_ministries_client/version.rb +19 -0
  52. data/lib/wcc_ministries_client.rb +59 -0
  53. data/openapitools.json +23 -0
  54. data/pkg/wcc_ministries_client-1.0.0.gem +0 -0
  55. data/spec/api/ministry_api_spec.rb +60 -0
  56. data/spec/api_client_spec.rb +226 -0
  57. data/spec/configuration_spec.rb +42 -0
  58. data/spec/models/asset_file_details_image_spec.rb +40 -0
  59. data/spec/models/asset_file_details_spec.rb +40 -0
  60. data/spec/models/asset_file_spec.rb +52 -0
  61. data/spec/models/asset_spec.rb +46 -0
  62. data/spec/models/caching_meta_spec.rb +40 -0
  63. data/spec/models/deleted_ministry_spec.rb +44 -0
  64. data/spec/models/inline_response2001_spec.rb +40 -0
  65. data/spec/models/inline_response200_links_spec.rb +58 -0
  66. data/spec/models/inline_response200_meta_spec.rb +46 -0
  67. data/spec/models/inline_response200_spec.rb +52 -0
  68. data/spec/models/ministry_attributes_spec.rb +52 -0
  69. data/spec/models/ministry_links_spec.rb +34 -0
  70. data/spec/models/ministry_relationships_spec.rb +34 -0
  71. data/spec/models/ministry_spec.rb +68 -0
  72. data/spec/models/page_attributes_spec.rb +52 -0
  73. data/spec/models/page_links_spec.rb +34 -0
  74. data/spec/models/page_relationship_data_spec.rb +44 -0
  75. data/spec/models/page_relationship_spec.rb +34 -0
  76. data/spec/models/page_spec.rb +62 -0
  77. data/spec/spec_helper.rb +111 -0
  78. data/swagger.json +425 -0
  79. data/wcc_ministries_client.gemspec +38 -0
  80. metadata +185 -0
@@ -0,0 +1,327 @@
1
+ =begin
2
+ #WCC Ministries API
3
+
4
+ #WCC Ministries API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: dev@watermark.org
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module WCC::Ministries::Client
17
+ class Ministry
18
+ # The unique ID of the Ministry. Used in the ministriesShow endpoint
19
+ attr_accessor :id
20
+
21
+ # Always the literal string 'ministry'. This is used as a discriminator.
22
+ attr_accessor :type
23
+
24
+ attr_accessor :attributes
25
+
26
+ attr_accessor :relationships
27
+
28
+ attr_accessor :links
29
+
30
+ attr_accessor :meta
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'id' => :'id',
58
+ :'type' => :'type',
59
+ :'attributes' => :'attributes',
60
+ :'relationships' => :'relationships',
61
+ :'links' => :'links',
62
+ :'meta' => :'meta'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'id' => :'String',
75
+ :'type' => :'String',
76
+ :'attributes' => :'MinistryAttributes',
77
+ :'relationships' => :'MinistryRelationships',
78
+ :'links' => :'MinistryLinks',
79
+ :'meta' => :'CachingMeta'
80
+ }
81
+ end
82
+
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WCC::Ministries::Client::Ministry` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WCC::Ministries::Client::Ministry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'id')
105
+ self.id = attributes[:'id']
106
+ end
107
+
108
+ if attributes.key?(:'type')
109
+ self.type = attributes[:'type']
110
+ end
111
+
112
+ if attributes.key?(:'attributes')
113
+ self.attributes = attributes[:'attributes']
114
+ end
115
+
116
+ if attributes.key?(:'relationships')
117
+ self.relationships = attributes[:'relationships']
118
+ end
119
+
120
+ if attributes.key?(:'links')
121
+ self.links = attributes[:'links']
122
+ end
123
+
124
+ if attributes.key?(:'meta')
125
+ self.meta = attributes[:'meta']
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ if @id.nil?
134
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
135
+ end
136
+
137
+ if @type.nil?
138
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
139
+ end
140
+
141
+ if @attributes.nil?
142
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
143
+ end
144
+
145
+ if @relationships.nil?
146
+ invalid_properties.push('invalid value for "relationships", relationships cannot be nil.')
147
+ end
148
+
149
+ if @links.nil?
150
+ invalid_properties.push('invalid value for "links", links cannot be nil.')
151
+ end
152
+
153
+ if @meta.nil?
154
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
155
+ end
156
+
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ return false if @id.nil?
164
+ return false if @type.nil?
165
+ type_validator = EnumAttributeValidator.new('String', ["ministry"])
166
+ return false unless type_validator.valid?(@type)
167
+ return false if @attributes.nil?
168
+ return false if @relationships.nil?
169
+ return false if @links.nil?
170
+ return false if @meta.nil?
171
+ true
172
+ end
173
+
174
+ # Custom attribute writer method checking allowed values (enum).
175
+ # @param [Object] type Object to be assigned
176
+ def type=(type)
177
+ validator = EnumAttributeValidator.new('String', ["ministry"])
178
+ unless validator.valid?(type)
179
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
180
+ end
181
+ @type = type
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ id == o.id &&
190
+ type == o.type &&
191
+ attributes == o.attributes &&
192
+ relationships == o.relationships &&
193
+ links == o.links &&
194
+ meta == o.meta
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [id, type, attributes, relationships, links, meta].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
+ self.send("#{key}=", nil)
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :Time
245
+ Time.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ # models (e.g. Pet) or oneOf
276
+ klass = WCC::Ministries::Client.const_get(type)
277
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_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
+ self.class.attribute_map.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ is_nullable = self.class.openapi_nullable.include?(attr)
301
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
+ end
303
+
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map { |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+ end
327
+ end
@@ -0,0 +1,258 @@
1
+ =begin
2
+ #WCC Ministries API
3
+
4
+ #WCC Ministries API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: dev@watermark.org
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: unset
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module WCC::Ministries::Client
17
+ class MinistryAttributes
18
+ attr_accessor :code
19
+
20
+ attr_accessor :title
21
+
22
+ attr_accessor :descriptive_title
23
+
24
+ attr_accessor :display_in_internal_search
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'code' => :'code',
30
+ :'title' => :'title',
31
+ :'descriptive_title' => :'descriptiveTitle',
32
+ :'display_in_internal_search' => :'displayInInternalSearch'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'code' => :'String',
45
+ :'title' => :'String',
46
+ :'descriptive_title' => :'String',
47
+ :'display_in_internal_search' => :'Boolean'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WCC::Ministries::Client::MinistryAttributes` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WCC::Ministries::Client::MinistryAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'code')
73
+ self.code = attributes[:'code']
74
+ end
75
+
76
+ if attributes.key?(:'title')
77
+ self.title = attributes[:'title']
78
+ end
79
+
80
+ if attributes.key?(:'descriptive_title')
81
+ self.descriptive_title = attributes[:'descriptive_title']
82
+ end
83
+
84
+ if attributes.key?(:'display_in_internal_search')
85
+ self.display_in_internal_search = attributes[:'display_in_internal_search']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ if @code.nil?
94
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
95
+ end
96
+
97
+ if @title.nil?
98
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
99
+ end
100
+
101
+ if @descriptive_title.nil?
102
+ invalid_properties.push('invalid value for "descriptive_title", descriptive_title cannot be nil.')
103
+ end
104
+
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ return false if @code.nil?
112
+ return false if @title.nil?
113
+ return false if @descriptive_title.nil?
114
+ true
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ code == o.code &&
123
+ title == o.title &&
124
+ descriptive_title == o.descriptive_title &&
125
+ display_in_internal_search == o.display_in_internal_search
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Integer] Hash code
136
+ def hash
137
+ [code, title, descriptive_title, display_in_internal_search].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def self.build_from_hash(attributes)
144
+ new.build_from_hash(attributes)
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
154
+ self.send("#{key}=", nil)
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = WCC::Ministries::Client.const_get(type)
208
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+ end
258
+ end