moonlogs-ruby 0.0.1.pre.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +524 -0
  4. data/Rakefile +8 -0
  5. data/docs/ApiToken.md +10 -0
  6. data/docs/Credentials.md +8 -0
  7. data/docs/DefaultApi.md +1318 -0
  8. data/docs/InlineResponse200.md +11 -0
  9. data/docs/InlineResponse2001.md +11 -0
  10. data/docs/InlineResponse20010.md +11 -0
  11. data/docs/InlineResponse20011.md +11 -0
  12. data/docs/InlineResponse20012.md +11 -0
  13. data/docs/InlineResponse20013.md +11 -0
  14. data/docs/InlineResponse2002.md +11 -0
  15. data/docs/InlineResponse2003.md +11 -0
  16. data/docs/InlineResponse2004.md +11 -0
  17. data/docs/InlineResponse2005.md +11 -0
  18. data/docs/InlineResponse2006.md +11 -0
  19. data/docs/InlineResponse2007.md +11 -0
  20. data/docs/InlineResponse2008.md +11 -0
  21. data/docs/InlineResponse2009.md +11 -0
  22. data/docs/Level.md +6 -0
  23. data/docs/Meta.md +9 -0
  24. data/docs/OneOfRecordLevel.md +6 -0
  25. data/docs/OneOfUserRole.md +6 -0
  26. data/docs/Record.md +15 -0
  27. data/docs/Role.md +6 -0
  28. data/docs/Schema.md +14 -0
  29. data/docs/SchemaField.md +8 -0
  30. data/docs/SchemaKind.md +8 -0
  31. data/docs/SchemaSearch.md +8 -0
  32. data/docs/Session.md +7 -0
  33. data/docs/Tag.md +8 -0
  34. data/docs/User.md +14 -0
  35. data/git_push.sh +55 -0
  36. data/lib/moonlogs-ruby/api/default_api.rb +1458 -0
  37. data/lib/moonlogs-ruby/api_client.rb +388 -0
  38. data/lib/moonlogs-ruby/api_error.rb +57 -0
  39. data/lib/moonlogs-ruby/configuration.rb +205 -0
  40. data/lib/moonlogs-ruby/models/api_token.rb +253 -0
  41. data/lib/moonlogs-ruby/models/credentials.rb +225 -0
  42. data/lib/moonlogs-ruby/models/inline_response_200.rb +269 -0
  43. data/lib/moonlogs-ruby/models/inline_response_200_1.rb +267 -0
  44. data/lib/moonlogs-ruby/models/inline_response_200_10.rb +267 -0
  45. data/lib/moonlogs-ruby/models/inline_response_200_11.rb +267 -0
  46. data/lib/moonlogs-ruby/models/inline_response_200_12.rb +269 -0
  47. data/lib/moonlogs-ruby/models/inline_response_200_13.rb +267 -0
  48. data/lib/moonlogs-ruby/models/inline_response_200_2.rb +267 -0
  49. data/lib/moonlogs-ruby/models/inline_response_200_3.rb +269 -0
  50. data/lib/moonlogs-ruby/models/inline_response_200_4.rb +267 -0
  51. data/lib/moonlogs-ruby/models/inline_response_200_5.rb +269 -0
  52. data/lib/moonlogs-ruby/models/inline_response_200_6.rb +267 -0
  53. data/lib/moonlogs-ruby/models/inline_response_200_7.rb +268 -0
  54. data/lib/moonlogs-ruby/models/inline_response_200_8.rb +267 -0
  55. data/lib/moonlogs-ruby/models/inline_response_200_9.rb +269 -0
  56. data/lib/moonlogs-ruby/models/level.rb +32 -0
  57. data/lib/moonlogs-ruby/models/meta.rb +239 -0
  58. data/lib/moonlogs-ruby/models/one_of_record_level.rb +197 -0
  59. data/lib/moonlogs-ruby/models/one_of_user_role.rb +197 -0
  60. data/lib/moonlogs-ruby/models/record.rb +303 -0
  61. data/lib/moonlogs-ruby/models/role.rb +28 -0
  62. data/lib/moonlogs-ruby/models/schema.rb +298 -0
  63. data/lib/moonlogs-ruby/models/schema_field.rb +225 -0
  64. data/lib/moonlogs-ruby/models/schema_kind.rb +225 -0
  65. data/lib/moonlogs-ruby/models/schema_search.rb +215 -0
  66. data/lib/moonlogs-ruby/models/session.rb +211 -0
  67. data/lib/moonlogs-ruby/models/tag.rb +225 -0
  68. data/lib/moonlogs-ruby/models/user.rb +301 -0
  69. data/lib/moonlogs-ruby/version.rb +14 -0
  70. data/lib/moonlogs-ruby.rb +68 -0
  71. data/moonlogs-ruby-0.0.1.0.gem +0 -0
  72. data/moonlogs-ruby-0.0.1.gem +0 -0
  73. data/moonlogs-ruby.gemspec +38 -0
  74. data/spec/api/default_api_spec.rb +317 -0
  75. data/spec/api_client_spec.rb +225 -0
  76. data/spec/base_object_spec.rb +109 -0
  77. data/spec/configuration_spec.rb +41 -0
  78. data/spec/models/api_token_spec.rb +58 -0
  79. data/spec/models/credentials_spec.rb +46 -0
  80. data/spec/models/inline_response_200_10_spec.rb +64 -0
  81. data/spec/models/inline_response_200_11_spec.rb +64 -0
  82. data/spec/models/inline_response_200_12_spec.rb +64 -0
  83. data/spec/models/inline_response_200_13_spec.rb +64 -0
  84. data/spec/models/inline_response_200_1_spec.rb +64 -0
  85. data/spec/models/inline_response_200_2_spec.rb +64 -0
  86. data/spec/models/inline_response_200_3_spec.rb +64 -0
  87. data/spec/models/inline_response_200_4_spec.rb +64 -0
  88. data/spec/models/inline_response_200_5_spec.rb +64 -0
  89. data/spec/models/inline_response_200_6_spec.rb +64 -0
  90. data/spec/models/inline_response_200_7_spec.rb +64 -0
  91. data/spec/models/inline_response_200_8_spec.rb +64 -0
  92. data/spec/models/inline_response_200_9_spec.rb +64 -0
  93. data/spec/models/inline_response_200_spec.rb +64 -0
  94. data/spec/models/level_spec.rb +34 -0
  95. data/spec/models/meta_spec.rb +52 -0
  96. data/spec/models/one_of_record_level_spec.rb +34 -0
  97. data/spec/models/one_of_user_role_spec.rb +34 -0
  98. data/spec/models/record_spec.rb +88 -0
  99. data/spec/models/role_spec.rb +34 -0
  100. data/spec/models/schema_field_spec.rb +46 -0
  101. data/spec/models/schema_kind_spec.rb +46 -0
  102. data/spec/models/schema_search_spec.rb +46 -0
  103. data/spec/models/schema_spec.rb +82 -0
  104. data/spec/models/session_spec.rb +40 -0
  105. data/spec/models/tag_spec.rb +46 -0
  106. data/spec/models/user_spec.rb +82 -0
  107. data/spec/spec_helper.rb +110 -0
  108. metadata +243 -0
@@ -0,0 +1,267 @@
1
+ =begin
2
+ #Moonlogs
3
+
4
+ #Moonlogs API
5
+
6
+ OpenAPI spec version: 0.0.1
7
+ Contact: shalpack@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.52
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module MoonlogsRuby
15
+ class InlineResponse20010
16
+ attr_accessor :success
17
+
18
+ attr_accessor :code
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :data
23
+
24
+ attr_accessor :meta
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'success' => :'success',
30
+ :'code' => :'code',
31
+ :'error' => :'error',
32
+ :'data' => :'data',
33
+ :'meta' => :'meta'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'success' => :'Object',
41
+ :'code' => :'Object',
42
+ :'error' => :'Object',
43
+ :'data' => :'Object',
44
+ :'meta' => :'Object'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoonlogsRuby::InlineResponse20010` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoonlogsRuby::InlineResponse20010`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'success')
70
+ self.success = attributes[:'success']
71
+ end
72
+
73
+ if attributes.key?(:'code')
74
+ self.code = attributes[:'code']
75
+ end
76
+
77
+ if attributes.key?(:'error')
78
+ self.error = attributes[:'error']
79
+ end
80
+
81
+ if attributes.key?(:'data')
82
+ self.data = attributes[:'data']
83
+ end
84
+
85
+ if attributes.key?(:'meta')
86
+ self.meta = attributes[:'meta']
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
+ invalid_properties = Array.new
94
+ if @success.nil?
95
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
96
+ end
97
+
98
+ if @code.nil?
99
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
100
+ end
101
+
102
+ if @error.nil?
103
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
104
+ end
105
+
106
+ if @data.nil?
107
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
108
+ end
109
+
110
+ if @meta.nil?
111
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ return false if @success.nil?
121
+ return false if @code.nil?
122
+ return false if @error.nil?
123
+ return false if @data.nil?
124
+ return false if @meta.nil?
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ success == o.success &&
134
+ code == o.code &&
135
+ error == o.error &&
136
+ data == o.data &&
137
+ meta == o.meta
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [success, code, error, data, meta].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ new.build_from_hash(attributes)
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.openapi_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
174
+ self.send("#{key}=", nil)
175
+ end
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ DateTime.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :Boolean
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ MoonlogsRuby.const_get(type).build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end end
267
+ end
@@ -0,0 +1,267 @@
1
+ =begin
2
+ #Moonlogs
3
+
4
+ #Moonlogs API
5
+
6
+ OpenAPI spec version: 0.0.1
7
+ Contact: shalpack@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.52
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module MoonlogsRuby
15
+ class InlineResponse20011
16
+ attr_accessor :success
17
+
18
+ attr_accessor :code
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :data
23
+
24
+ attr_accessor :meta
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'success' => :'success',
30
+ :'code' => :'code',
31
+ :'error' => :'error',
32
+ :'data' => :'data',
33
+ :'meta' => :'meta'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'success' => :'Object',
41
+ :'code' => :'Object',
42
+ :'error' => :'Object',
43
+ :'data' => :'Object',
44
+ :'meta' => :'Object'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoonlogsRuby::InlineResponse20011` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoonlogsRuby::InlineResponse20011`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'success')
70
+ self.success = attributes[:'success']
71
+ end
72
+
73
+ if attributes.key?(:'code')
74
+ self.code = attributes[:'code']
75
+ end
76
+
77
+ if attributes.key?(:'error')
78
+ self.error = attributes[:'error']
79
+ end
80
+
81
+ if attributes.key?(:'data')
82
+ self.data = attributes[:'data']
83
+ end
84
+
85
+ if attributes.key?(:'meta')
86
+ self.meta = attributes[:'meta']
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
+ invalid_properties = Array.new
94
+ if @success.nil?
95
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
96
+ end
97
+
98
+ if @code.nil?
99
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
100
+ end
101
+
102
+ if @error.nil?
103
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
104
+ end
105
+
106
+ if @data.nil?
107
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
108
+ end
109
+
110
+ if @meta.nil?
111
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ return false if @success.nil?
121
+ return false if @code.nil?
122
+ return false if @error.nil?
123
+ return false if @data.nil?
124
+ return false if @meta.nil?
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ success == o.success &&
134
+ code == o.code &&
135
+ error == o.error &&
136
+ data == o.data &&
137
+ meta == o.meta
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [success, code, error, data, meta].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ new.build_from_hash(attributes)
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.openapi_types.each_pair do |key, type|
165
+ if type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
174
+ self.send("#{key}=", nil)
175
+ end
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :DateTime
188
+ DateTime.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :Boolean
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ MoonlogsRuby.const_get(type).build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end end
267
+ end