SematextCloud 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +13 -0
  4. data/README.md +149 -0
  5. data/Rakefile +8 -0
  6. data/SematextCloud.gemspec +45 -0
  7. data/docs/AlertNotificationRequest.md +9 -0
  8. data/docs/AlertNotificationsApi.md +118 -0
  9. data/docs/AlertRule.md +53 -0
  10. data/docs/AlertRuleScheduleTimeRangeDto.md +7 -0
  11. data/docs/AlertRuleScheduleWeekdayDto.md +10 -0
  12. data/docs/AlertsApi.md +270 -0
  13. data/docs/App.md +32 -0
  14. data/docs/AppDescription.md +6 -0
  15. data/docs/AppMetadata.md +10 -0
  16. data/docs/AppsApi.md +369 -0
  17. data/docs/AwsSettingsControllerApi.md +63 -0
  18. data/docs/BasicAuthMethodDto.md +7 -0
  19. data/docs/BasicOrganizationDto.md +9 -0
  20. data/docs/BillingApi.md +176 -0
  21. data/docs/BillingInfo.md +8 -0
  22. data/docs/CloudWatchSettings.md +9 -0
  23. data/docs/CreateAppInfo.md +10 -0
  24. data/docs/DataSeriesFilter.md +8 -0
  25. data/docs/DataSeriesRequest.md +12 -0
  26. data/docs/Error.md +7 -0
  27. data/docs/FilterValue.md +11 -0
  28. data/docs/GenericApiResponse.md +9 -0
  29. data/docs/Invitation.md +15 -0
  30. data/docs/LogsAppApi.md +58 -0
  31. data/docs/MetricsApi.md +227 -0
  32. data/docs/MonitoringAppApi.md +58 -0
  33. data/docs/NotificationIntegration.md +15 -0
  34. data/docs/Plan.md +18 -0
  35. data/docs/ReportInfo.md +13 -0
  36. data/docs/ResetPasswordApi.md +58 -0
  37. data/docs/SavedQueriesApi.md +220 -0
  38. data/docs/SavedQuery.md +18 -0
  39. data/docs/ServiceIntegration.md +17 -0
  40. data/docs/SubscriptionsApi.md +114 -0
  41. data/docs/TagApiControllerApi.md +212 -0
  42. data/docs/UpdateAppInfo.md +14 -0
  43. data/docs/UserInfo.md +6 -0
  44. data/docs/UserPermissions.md +8 -0
  45. data/docs/UserRole.md +8 -0
  46. data/lib/SematextCloud.rb +78 -0
  47. data/lib/SematextCloud/api/alert_notifications_api.rb +137 -0
  48. data/lib/SematextCloud/api/alerts_api.rb +283 -0
  49. data/lib/SematextCloud/api/apps_api.rb +381 -0
  50. data/lib/SematextCloud/api/aws_settings_controller_api.rb +83 -0
  51. data/lib/SematextCloud/api/billing_api.rb +197 -0
  52. data/lib/SematextCloud/api/logs_app_api.rb +75 -0
  53. data/lib/SematextCloud/api/metrics_api.rb +247 -0
  54. data/lib/SematextCloud/api/monitoring_app_api.rb +75 -0
  55. data/lib/SematextCloud/api/reset_password_api.rb +75 -0
  56. data/lib/SematextCloud/api/saved_queries_api.rb +237 -0
  57. data/lib/SematextCloud/api/subscriptions_api.rb +133 -0
  58. data/lib/SematextCloud/api/tag_api_controller_api.rb +247 -0
  59. data/lib/SematextCloud/api_client.rb +389 -0
  60. data/lib/SematextCloud/api_error.rb +38 -0
  61. data/lib/SematextCloud/configuration.rb +209 -0
  62. data/lib/SematextCloud/models/alert_notification_request.rb +212 -0
  63. data/lib/SematextCloud/models/alert_rule.rb +652 -0
  64. data/lib/SematextCloud/models/alert_rule_schedule_time_range_dto.rb +192 -0
  65. data/lib/SematextCloud/models/alert_rule_schedule_weekday_dto.rb +221 -0
  66. data/lib/SematextCloud/models/app.rb +419 -0
  67. data/lib/SematextCloud/models/app_description.rb +183 -0
  68. data/lib/SematextCloud/models/app_metadata.rb +268 -0
  69. data/lib/SematextCloud/models/basic_auth_method_dto.rb +226 -0
  70. data/lib/SematextCloud/models/basic_organization_dto.rb +246 -0
  71. data/lib/SematextCloud/models/billing_info.rb +201 -0
  72. data/lib/SematextCloud/models/cloud_watch_settings.rb +256 -0
  73. data/lib/SematextCloud/models/create_app_info.rb +220 -0
  74. data/lib/SematextCloud/models/data_series_filter.rb +237 -0
  75. data/lib/SematextCloud/models/data_series_request.rb +283 -0
  76. data/lib/SematextCloud/models/error.rb +192 -0
  77. data/lib/SematextCloud/models/filter_value.rb +230 -0
  78. data/lib/SematextCloud/models/generic_api_response.rb +214 -0
  79. data/lib/SematextCloud/models/invitation.rb +326 -0
  80. data/lib/SematextCloud/models/notification_integration.rb +324 -0
  81. data/lib/SematextCloud/models/plan.rb +337 -0
  82. data/lib/SematextCloud/models/report_info.rb +247 -0
  83. data/lib/SematextCloud/models/saved_query.rb +291 -0
  84. data/lib/SematextCloud/models/service_integration.rb +282 -0
  85. data/lib/SematextCloud/models/update_app_info.rb +289 -0
  86. data/lib/SematextCloud/models/user_info.rb +183 -0
  87. data/lib/SematextCloud/models/user_permissions.rb +201 -0
  88. data/lib/SematextCloud/models/user_role.rb +247 -0
  89. data/lib/SematextCloud/version.rb +15 -0
  90. data/spec/api/alert_notifications_api_spec.rb +60 -0
  91. data/spec/api/alerts_api_spec.rb +90 -0
  92. data/spec/api/apps_api_spec.rb +113 -0
  93. data/spec/api/aws_settings_controller_api_spec.rb +48 -0
  94. data/spec/api/billing_api_spec.rb +72 -0
  95. data/spec/api/logs_app_api_spec.rb +46 -0
  96. data/spec/api/metrics_api_spec.rb +83 -0
  97. data/spec/api/monitoring_app_api_spec.rb +46 -0
  98. data/spec/api/reset_password_api_spec.rb +46 -0
  99. data/spec/api/saved_queries_api_spec.rb +80 -0
  100. data/spec/api/subscriptions_api_spec.rb +58 -0
  101. data/spec/api/tag_api_controller_api_spec.rb +88 -0
  102. data/spec/api_client_spec.rb +226 -0
  103. data/spec/configuration_spec.rb +42 -0
  104. data/spec/models/alert_notification_request_spec.rb +59 -0
  105. data/spec/models/alert_rule_schedule_time_range_dto_spec.rb +47 -0
  106. data/spec/models/alert_rule_schedule_weekday_dto_spec.rb +65 -0
  107. data/spec/models/alert_rule_spec.rb +327 -0
  108. data/spec/models/app_description_spec.rb +41 -0
  109. data/spec/models/app_metadata_spec.rb +77 -0
  110. data/spec/models/app_spec.rb +197 -0
  111. data/spec/models/basic_auth_method_dto_spec.rb +51 -0
  112. data/spec/models/basic_organization_dto_spec.rb +63 -0
  113. data/spec/models/billing_info_spec.rb +53 -0
  114. data/spec/models/cloud_watch_settings_spec.rb +67 -0
  115. data/spec/models/create_app_info_spec.rb +65 -0
  116. data/spec/models/data_series_filter_spec.rb +57 -0
  117. data/spec/models/data_series_request_spec.rb +81 -0
  118. data/spec/models/error_spec.rb +47 -0
  119. data/spec/models/filter_value_spec.rb +71 -0
  120. data/spec/models/generic_api_response_spec.rb +59 -0
  121. data/spec/models/invitation_spec.rb +107 -0
  122. data/spec/models/notification_integration_spec.rb +107 -0
  123. data/spec/models/plan_spec.rb +121 -0
  124. data/spec/models/report_info_spec.rb +83 -0
  125. data/spec/models/saved_query_spec.rb +113 -0
  126. data/spec/models/service_integration_spec.rb +107 -0
  127. data/spec/models/update_app_info_spec.rb +93 -0
  128. data/spec/models/user_info_spec.rb +41 -0
  129. data/spec/models/user_permissions_spec.rb +53 -0
  130. data/spec/models/user_role_spec.rb +61 -0
  131. data/spec/spec_helper.rb +111 -0
  132. metadata +395 -0
@@ -0,0 +1,283 @@
1
+ =begin
2
+ #Sematext Cloud API
3
+
4
+ #API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`.
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SematextCloud
16
+ class DataSeriesRequest
17
+ attr_accessor :default_interval
18
+
19
+ # End time of interval. Can be expressed as timestamp in milliseconds or UTC date in yyyy-MM-dd HH:mm:ss format
20
+ attr_accessor :_end
21
+
22
+ # Map of allowed filter values and aggregation strategy. List of available filter values can be fetched using metric filters endpoint and default aggregation strategy depends on metric
23
+ attr_accessor :filters
24
+
25
+ # Data points interval granularity between two data points.Default value is \"AUTO\" - calculated based on selected time span. Not required while getting filters.
26
+ attr_accessor :granularity
27
+
28
+ attr_accessor :interval
29
+
30
+ # Metric name or metric group prefix
31
+ attr_accessor :metric
32
+
33
+ # Start time of interval. Can be expressed as timestamp in milliseconds or UTC date in yyyy-MM-dd HH:mm:ss format
34
+ attr_accessor :start
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'default_interval' => :'defaultInterval',
62
+ :'_end' => :'end',
63
+ :'filters' => :'filters',
64
+ :'granularity' => :'granularity',
65
+ :'interval' => :'interval',
66
+ :'metric' => :'metric',
67
+ :'start' => :'start'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ :'default_interval' => :'Integer',
75
+ :'_end' => :'String',
76
+ :'filters' => :'Hash<String, DataSeriesFilter>',
77
+ :'granularity' => :'String',
78
+ :'interval' => :'String',
79
+ :'metric' => :'String',
80
+ :'start' => :'String'
81
+ }
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ return unless attributes.is_a?(Hash)
88
+
89
+ # convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
91
+
92
+ if attributes.has_key?(:'defaultInterval')
93
+ self.default_interval = attributes[:'defaultInterval']
94
+ end
95
+
96
+ if attributes.has_key?(:'end')
97
+ self._end = attributes[:'end']
98
+ end
99
+
100
+ if attributes.has_key?(:'filters')
101
+ if (value = attributes[:'filters']).is_a?(Hash)
102
+ self.filters = value
103
+ end
104
+ end
105
+
106
+ if attributes.has_key?(:'granularity')
107
+ self.granularity = attributes[:'granularity']
108
+ end
109
+
110
+ if attributes.has_key?(:'interval')
111
+ self.interval = attributes[:'interval']
112
+ end
113
+
114
+ if attributes.has_key?(:'metric')
115
+ self.metric = attributes[:'metric']
116
+ end
117
+
118
+ if attributes.has_key?(:'start')
119
+ self.start = attributes[:'start']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ invalid_properties = Array.new
127
+ if @metric.nil?
128
+ invalid_properties.push('invalid value for "metric", metric cannot be nil.')
129
+ end
130
+
131
+ invalid_properties
132
+ end
133
+
134
+ # Check to see if the all the properties in the model are valid
135
+ # @return true if the model is valid
136
+ def valid?
137
+ granularity_validator = EnumAttributeValidator.new('String', ['AUTO', 'ONE_MINUTE', 'FIVE_MINUTES', 'HOUR', 'DAY', 'WEEK', 'MONTH'])
138
+ return false unless granularity_validator.valid?(@granularity)
139
+ return false if @metric.nil?
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method checking allowed values (enum).
144
+ # @param [Object] granularity Object to be assigned
145
+ def granularity=(granularity)
146
+ validator = EnumAttributeValidator.new('String', ['AUTO', 'ONE_MINUTE', 'FIVE_MINUTES', 'HOUR', 'DAY', 'WEEK', 'MONTH'])
147
+ unless validator.valid?(granularity)
148
+ fail ArgumentError, 'invalid value for "granularity", must be one of #{validator.allowable_values}.'
149
+ end
150
+ @granularity = granularity
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ default_interval == o.default_interval &&
159
+ _end == o._end &&
160
+ filters == o.filters &&
161
+ granularity == o.granularity &&
162
+ interval == o.interval &&
163
+ metric == o.metric &&
164
+ start == o.start
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Fixnum] Hash code
175
+ def hash
176
+ [default_interval, _end, filters, granularity, interval, metric, start].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ self.class.swagger_types.each_pair do |key, type|
185
+ if type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
189
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
194
+ end
195
+
196
+ self
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def _deserialize(type, value)
204
+ case type.to_sym
205
+ when :DateTime
206
+ DateTime.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :BOOLEAN
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ temp_model = SematextCloud.const_get(type).new
237
+ temp_model.build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ # Returns the object in the form of hash
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_hash
256
+ hash = {}
257
+ self.class.attribute_map.each_pair do |attr, param|
258
+ value = self.send(attr)
259
+ next if value.nil?
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+ end
283
+ end
@@ -0,0 +1,192 @@
1
+ =begin
2
+ #Sematext Cloud API
3
+
4
+ #API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`.
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SematextCloud
16
+ class Error
17
+ attr_accessor :code
18
+
19
+ attr_accessor :message
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'code' => :'code',
25
+ :'message' => :'message'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'code' => :'String',
33
+ :'message' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'code')
46
+ self.code = attributes[:'code']
47
+ end
48
+
49
+ if attributes.has_key?(:'message')
50
+ self.message = attributes[:'message']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ code == o.code &&
73
+ message == o.message
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [code, message].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = SematextCloud.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map { |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+ end
192
+ end