cloudmersive-ocr-api-client 1.5.0 → 2.0.1

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 +4 -4
  2. metadata +3 -109
  3. data/Gemfile +0 -7
  4. data/README.md +0 -150
  5. data/Rakefile +0 -8
  6. data/cloudmersive-ocr-api-client.gemspec +0 -45
  7. data/docs/BusinessCardRecognitionResult.md +0 -15
  8. data/docs/FieldResult.md +0 -9
  9. data/docs/FormDefinitionTemplate.md +0 -9
  10. data/docs/FormFieldDefinition.md +0 -25
  11. data/docs/FormRecognitionResult.md +0 -12
  12. data/docs/FormTableColumnDefinition.md +0 -13
  13. data/docs/FormTableDefinition.md +0 -11
  14. data/docs/GetPageAngleResult.md +0 -9
  15. data/docs/ImageOcrApi.md +0 -571
  16. data/docs/ImageToLinesWithLocationResult.md +0 -9
  17. data/docs/ImageToTextResponse.md +0 -9
  18. data/docs/ImageToWordsWithLocationResult.md +0 -9
  19. data/docs/OcrLineElement.md +0 -9
  20. data/docs/OcrPageResult.md +0 -10
  21. data/docs/OcrPageResultWithLinesWithLocation.md +0 -10
  22. data/docs/OcrPageResultWithWordsWithLocation.md +0 -10
  23. data/docs/OcrPhotoTextElement.md +0 -14
  24. data/docs/OcrWordElement.md +0 -18
  25. data/docs/PdfOcrApi.md +0 -191
  26. data/docs/PdfToLinesWithLocationResult.md +0 -9
  27. data/docs/PdfToTextResponse.md +0 -9
  28. data/docs/PdfToWordsWithLocationResult.md +0 -9
  29. data/docs/PhotoToWordsWithLocationResult.md +0 -10
  30. data/docs/Point.md +0 -9
  31. data/docs/PreprocessingApi.md +0 -338
  32. data/docs/ReceiptLineItem.md +0 -9
  33. data/docs/ReceiptRecognitionResult.md +0 -16
  34. data/docs/ReceiptsApi.md +0 -63
  35. data/docs/TableCellResult.md +0 -9
  36. data/docs/TableResult.md +0 -9
  37. data/docs/TableRowResult.md +0 -8
  38. data/git_push.sh +0 -55
  39. data/lib/cloudmersive-ocr-api-client.rb +0 -70
  40. data/lib/cloudmersive-ocr-api-client/api/image_ocr_api.rb +0 -605
  41. data/lib/cloudmersive-ocr-api-client/api/pdf_ocr_api.rb +0 -212
  42. data/lib/cloudmersive-ocr-api-client/api/preprocessing_api.rb +0 -359
  43. data/lib/cloudmersive-ocr-api-client/api/receipts_api.rb +0 -79
  44. data/lib/cloudmersive-ocr-api-client/api_client.rb +0 -389
  45. data/lib/cloudmersive-ocr-api-client/api_error.rb +0 -38
  46. data/lib/cloudmersive-ocr-api-client/configuration.rb +0 -209
  47. data/lib/cloudmersive-ocr-api-client/models/business_card_recognition_result.rb +0 -259
  48. data/lib/cloudmersive-ocr-api-client/models/field_result.rb +0 -201
  49. data/lib/cloudmersive-ocr-api-client/models/form_definition_template.rb +0 -203
  50. data/lib/cloudmersive-ocr-api-client/models/form_field_definition.rb +0 -361
  51. data/lib/cloudmersive-ocr-api-client/models/form_recognition_result.rb +0 -235
  52. data/lib/cloudmersive-ocr-api-client/models/form_table_column_definition.rb +0 -239
  53. data/lib/cloudmersive-ocr-api-client/models/form_table_definition.rb +0 -221
  54. data/lib/cloudmersive-ocr-api-client/models/get_page_angle_result.rb +0 -199
  55. data/lib/cloudmersive-ocr-api-client/models/image_to_lines_with_location_result.rb +0 -201
  56. data/lib/cloudmersive-ocr-api-client/models/image_to_text_response.rb +0 -199
  57. data/lib/cloudmersive-ocr-api-client/models/image_to_words_with_location_result.rb +0 -201
  58. data/lib/cloudmersive-ocr-api-client/models/ocr_line_element.rb +0 -201
  59. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result.rb +0 -209
  60. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_lines_with_location.rb +0 -211
  61. data/lib/cloudmersive-ocr-api-client/models/ocr_page_result_with_words_with_location.rb +0 -211
  62. data/lib/cloudmersive-ocr-api-client/models/ocr_photo_text_element.rb +0 -251
  63. data/lib/cloudmersive-ocr-api-client/models/ocr_word_element.rb +0 -289
  64. data/lib/cloudmersive-ocr-api-client/models/pdf_to_lines_with_location_result.rb +0 -201
  65. data/lib/cloudmersive-ocr-api-client/models/pdf_to_text_response.rb +0 -201
  66. data/lib/cloudmersive-ocr-api-client/models/pdf_to_words_with_location_result.rb +0 -201
  67. data/lib/cloudmersive-ocr-api-client/models/photo_to_words_with_location_result.rb +0 -227
  68. data/lib/cloudmersive-ocr-api-client/models/point.rb +0 -199
  69. data/lib/cloudmersive-ocr-api-client/models/receipt_line_item.rb +0 -199
  70. data/lib/cloudmersive-ocr-api-client/models/receipt_recognition_result.rb +0 -271
  71. data/lib/cloudmersive-ocr-api-client/models/table_cell_result.rb +0 -201
  72. data/lib/cloudmersive-ocr-api-client/models/table_result.rb +0 -201
  73. data/lib/cloudmersive-ocr-api-client/models/table_row_result.rb +0 -191
  74. data/lib/cloudmersive-ocr-api-client/version.rb +0 -15
  75. data/spec/api/image_ocr_api_spec.rb +0 -169
  76. data/spec/api/pdf_ocr_api_spec.rb +0 -78
  77. data/spec/api/preprocessing_api_spec.rb +0 -107
  78. data/spec/api/receipts_api_spec.rb +0 -47
  79. data/spec/api_client_spec.rb +0 -226
  80. data/spec/configuration_spec.rb +0 -42
  81. data/spec/models/business_card_recognition_result_spec.rb +0 -84
  82. data/spec/models/field_result_spec.rb +0 -48
  83. data/spec/models/form_definition_template_spec.rb +0 -48
  84. data/spec/models/form_field_definition_spec.rb +0 -144
  85. data/spec/models/form_recognition_result_spec.rb +0 -66
  86. data/spec/models/form_table_column_definition_spec.rb +0 -72
  87. data/spec/models/form_table_definition_spec.rb +0 -60
  88. data/spec/models/get_page_angle_result_spec.rb +0 -48
  89. data/spec/models/image_to_lines_with_location_result_spec.rb +0 -48
  90. data/spec/models/image_to_text_response_spec.rb +0 -48
  91. data/spec/models/image_to_words_with_location_result_spec.rb +0 -48
  92. data/spec/models/ocr_line_element_spec.rb +0 -48
  93. data/spec/models/ocr_page_result_spec.rb +0 -54
  94. data/spec/models/ocr_page_result_with_lines_with_location_spec.rb +0 -54
  95. data/spec/models/ocr_page_result_with_words_with_location_spec.rb +0 -54
  96. data/spec/models/ocr_photo_text_element_spec.rb +0 -78
  97. data/spec/models/ocr_word_element_spec.rb +0 -102
  98. data/spec/models/pdf_to_lines_with_location_result_spec.rb +0 -48
  99. data/spec/models/pdf_to_text_response_spec.rb +0 -48
  100. data/spec/models/pdf_to_words_with_location_result_spec.rb +0 -48
  101. data/spec/models/photo_to_words_with_location_result_spec.rb +0 -54
  102. data/spec/models/point_spec.rb +0 -48
  103. data/spec/models/receipt_line_item_spec.rb +0 -48
  104. data/spec/models/receipt_recognition_result_spec.rb +0 -90
  105. data/spec/models/table_cell_result_spec.rb +0 -48
  106. data/spec/models/table_result_spec.rb +0 -48
  107. data/spec/models/table_row_result_spec.rb +0 -42
  108. data/spec/spec_helper.rb +0 -111
@@ -1,235 +0,0 @@
1
- =begin
2
- #ocrapi
3
-
4
- #The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveOcrApiClient
16
- # The result of extracting form field values
17
- class FormRecognitionResult
18
- # True if the operation was successful, false otherwise
19
- attr_accessor :successful
20
-
21
- # Result of form field OCR data extraction
22
- attr_accessor :field_value_extraction_result
23
-
24
- # Result of form table OCR data extraction
25
- attr_accessor :table_value_extraction_results
26
-
27
- # Diagnostic images - default is null, enable diagnostics=true to populate this parameter with one image per field
28
- attr_accessor :diagnostics
29
-
30
- # Optional; populated when using photo/recognize/form/advanced with the Setting Name of the best-matching highest-relevance form
31
- attr_accessor :best_match_form_setting_name
32
-
33
-
34
- # Attribute mapping from ruby-style variable name to JSON key.
35
- def self.attribute_map
36
- {
37
- :'successful' => :'Successful',
38
- :'field_value_extraction_result' => :'FieldValueExtractionResult',
39
- :'table_value_extraction_results' => :'TableValueExtractionResults',
40
- :'diagnostics' => :'Diagnostics',
41
- :'best_match_form_setting_name' => :'BestMatchFormSettingName'
42
- }
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.swagger_types
47
- {
48
- :'successful' => :'BOOLEAN',
49
- :'field_value_extraction_result' => :'Array<FieldResult>',
50
- :'table_value_extraction_results' => :'Array<TableResult>',
51
- :'diagnostics' => :'Array<String>',
52
- :'best_match_form_setting_name' => :'String'
53
- }
54
- end
55
-
56
- # Initializes the object
57
- # @param [Hash] attributes Model attributes in the form of hash
58
- def initialize(attributes = {})
59
- return unless attributes.is_a?(Hash)
60
-
61
- # convert string to symbol for hash key
62
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
-
64
- if attributes.has_key?(:'Successful')
65
- self.successful = attributes[:'Successful']
66
- end
67
-
68
- if attributes.has_key?(:'FieldValueExtractionResult')
69
- if (value = attributes[:'FieldValueExtractionResult']).is_a?(Array)
70
- self.field_value_extraction_result = value
71
- end
72
- end
73
-
74
- if attributes.has_key?(:'TableValueExtractionResults')
75
- if (value = attributes[:'TableValueExtractionResults']).is_a?(Array)
76
- self.table_value_extraction_results = value
77
- end
78
- end
79
-
80
- if attributes.has_key?(:'Diagnostics')
81
- if (value = attributes[:'Diagnostics']).is_a?(Array)
82
- self.diagnostics = value
83
- end
84
- end
85
-
86
- if attributes.has_key?(:'BestMatchFormSettingName')
87
- self.best_match_form_setting_name = attributes[:'BestMatchFormSettingName']
88
- end
89
-
90
- end
91
-
92
- # Show invalid properties with the reasons. Usually used together with valid?
93
- # @return Array for valid properties with the reasons
94
- def list_invalid_properties
95
- invalid_properties = Array.new
96
- return invalid_properties
97
- end
98
-
99
- # Check to see if the all the properties in the model are valid
100
- # @return true if the model is valid
101
- def valid?
102
- return true
103
- end
104
-
105
- # Checks equality by comparing each attribute.
106
- # @param [Object] Object to be compared
107
- def ==(o)
108
- return true if self.equal?(o)
109
- self.class == o.class &&
110
- successful == o.successful &&
111
- field_value_extraction_result == o.field_value_extraction_result &&
112
- table_value_extraction_results == o.table_value_extraction_results &&
113
- diagnostics == o.diagnostics &&
114
- best_match_form_setting_name == o.best_match_form_setting_name
115
- end
116
-
117
- # @see the `==` method
118
- # @param [Object] Object to be compared
119
- def eql?(o)
120
- self == o
121
- end
122
-
123
- # Calculates hash code according to all attributes.
124
- # @return [Fixnum] Hash code
125
- def hash
126
- [successful, field_value_extraction_result, table_value_extraction_results, diagnostics, best_match_form_setting_name].hash
127
- end
128
-
129
- # Builds the object from hash
130
- # @param [Hash] attributes Model attributes in the form of hash
131
- # @return [Object] Returns the model itself
132
- def build_from_hash(attributes)
133
- return nil unless attributes.is_a?(Hash)
134
- self.class.swagger_types.each_pair do |key, type|
135
- if type =~ /\AArray<(.*)>/i
136
- # check to ensure the input is an array given that the the attribute
137
- # is documented as an array but the input is not
138
- if attributes[self.class.attribute_map[key]].is_a?(Array)
139
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
- end
141
- elsif !attributes[self.class.attribute_map[key]].nil?
142
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
- end # or else data not found in attributes(hash), not an issue as the data can be optional
144
- end
145
-
146
- self
147
- end
148
-
149
- # Deserializes the data based on type
150
- # @param string type Data type
151
- # @param string value Value to be deserialized
152
- # @return [Object] Deserialized data
153
- def _deserialize(type, value)
154
- case type.to_sym
155
- when :DateTime
156
- DateTime.parse(value)
157
- when :Date
158
- Date.parse(value)
159
- when :String
160
- value.to_s
161
- when :Integer
162
- value.to_i
163
- when :Float
164
- value.to_f
165
- when :BOOLEAN
166
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
- true
168
- else
169
- false
170
- end
171
- when :Object
172
- # generic object (usually a Hash), return directly
173
- value
174
- when /\AArray<(?<inner_type>.+)>\z/
175
- inner_type = Regexp.last_match[:inner_type]
176
- value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
- k_type = Regexp.last_match[:k_type]
179
- v_type = Regexp.last_match[:v_type]
180
- {}.tap do |hash|
181
- value.each do |k, v|
182
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
- end
184
- end
185
- else # model
186
- temp_model = CloudmersiveOcrApiClient.const_get(type).new
187
- temp_model.build_from_hash(value)
188
- end
189
- end
190
-
191
- # Returns the string representation of the object
192
- # @return [String] String presentation of the object
193
- def to_s
194
- to_hash.to_s
195
- end
196
-
197
- # to_body is an alias to to_hash (backward compatibility)
198
- # @return [Hash] Returns the object in the form of hash
199
- def to_body
200
- to_hash
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- next if value.nil?
210
- hash[param] = _to_hash(value)
211
- end
212
- hash
213
- end
214
-
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map{ |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
225
- end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
- end
231
- end
232
-
233
- end
234
-
235
- end
@@ -1,239 +0,0 @@
1
- =begin
2
- #ocrapi
3
-
4
- #The powerful Optical Character Recognition (OCR) APIs let you convert scanned images of pages into recognized text.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveOcrApiClient
16
- # Definition of a column within a table for OCR data extraction from images
17
- class FormTableColumnDefinition
18
- # The identifier of the field; use this to identify which field is being referenced
19
- attr_accessor :column_id
20
-
21
- # Optional - the top anchor of the column heading
22
- attr_accessor :top_anchor
23
-
24
- # Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match). Default is Partial.
25
- attr_accessor :anchor_mode
26
-
27
- # The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace)
28
- attr_accessor :data_type
29
-
30
- # Optional - the target number of digits in the field; useful for fixed-length fields
31
- attr_accessor :minimum_character_count
32
-
33
- # Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
34
- attr_accessor :allow_numeric_digits
35
-
36
-
37
- # Attribute mapping from ruby-style variable name to JSON key.
38
- def self.attribute_map
39
- {
40
- :'column_id' => :'ColumnID',
41
- :'top_anchor' => :'TopAnchor',
42
- :'anchor_mode' => :'AnchorMode',
43
- :'data_type' => :'DataType',
44
- :'minimum_character_count' => :'MinimumCharacterCount',
45
- :'allow_numeric_digits' => :'AllowNumericDigits'
46
- }
47
- end
48
-
49
- # Attribute type mapping.
50
- def self.swagger_types
51
- {
52
- :'column_id' => :'String',
53
- :'top_anchor' => :'String',
54
- :'anchor_mode' => :'String',
55
- :'data_type' => :'String',
56
- :'minimum_character_count' => :'Integer',
57
- :'allow_numeric_digits' => :'BOOLEAN'
58
- }
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- return unless attributes.is_a?(Hash)
65
-
66
- # convert string to symbol for hash key
67
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
-
69
- if attributes.has_key?(:'ColumnID')
70
- self.column_id = attributes[:'ColumnID']
71
- end
72
-
73
- if attributes.has_key?(:'TopAnchor')
74
- self.top_anchor = attributes[:'TopAnchor']
75
- end
76
-
77
- if attributes.has_key?(:'AnchorMode')
78
- self.anchor_mode = attributes[:'AnchorMode']
79
- end
80
-
81
- if attributes.has_key?(:'DataType')
82
- self.data_type = attributes[:'DataType']
83
- end
84
-
85
- if attributes.has_key?(:'MinimumCharacterCount')
86
- self.minimum_character_count = attributes[:'MinimumCharacterCount']
87
- end
88
-
89
- if attributes.has_key?(:'AllowNumericDigits')
90
- self.allow_numeric_digits = attributes[:'AllowNumericDigits']
91
- end
92
-
93
- end
94
-
95
- # Show invalid properties with the reasons. Usually used together with valid?
96
- # @return Array for valid properties with the reasons
97
- def list_invalid_properties
98
- invalid_properties = Array.new
99
- return invalid_properties
100
- end
101
-
102
- # Check to see if the all the properties in the model are valid
103
- # @return true if the model is valid
104
- def valid?
105
- return true
106
- end
107
-
108
- # Checks equality by comparing each attribute.
109
- # @param [Object] Object to be compared
110
- def ==(o)
111
- return true if self.equal?(o)
112
- self.class == o.class &&
113
- column_id == o.column_id &&
114
- top_anchor == o.top_anchor &&
115
- anchor_mode == o.anchor_mode &&
116
- data_type == o.data_type &&
117
- minimum_character_count == o.minimum_character_count &&
118
- allow_numeric_digits == o.allow_numeric_digits
119
- end
120
-
121
- # @see the `==` method
122
- # @param [Object] Object to be compared
123
- def eql?(o)
124
- self == o
125
- end
126
-
127
- # Calculates hash code according to all attributes.
128
- # @return [Fixnum] Hash code
129
- def hash
130
- [column_id, top_anchor, anchor_mode, data_type, minimum_character_count, allow_numeric_digits].hash
131
- end
132
-
133
- # Builds the object from hash
134
- # @param [Hash] attributes Model attributes in the form of hash
135
- # @return [Object] Returns the model itself
136
- def build_from_hash(attributes)
137
- return nil unless attributes.is_a?(Hash)
138
- self.class.swagger_types.each_pair do |key, type|
139
- if type =~ /\AArray<(.*)>/i
140
- # check to ensure the input is an array given that the the attribute
141
- # is documented as an array but the input is not
142
- if attributes[self.class.attribute_map[key]].is_a?(Array)
143
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
144
- end
145
- elsif !attributes[self.class.attribute_map[key]].nil?
146
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
- end # or else data not found in attributes(hash), not an issue as the data can be optional
148
- end
149
-
150
- self
151
- end
152
-
153
- # Deserializes the data based on type
154
- # @param string type Data type
155
- # @param string value Value to be deserialized
156
- # @return [Object] Deserialized data
157
- def _deserialize(type, value)
158
- case type.to_sym
159
- when :DateTime
160
- DateTime.parse(value)
161
- when :Date
162
- Date.parse(value)
163
- when :String
164
- value.to_s
165
- when :Integer
166
- value.to_i
167
- when :Float
168
- value.to_f
169
- when :BOOLEAN
170
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
- true
172
- else
173
- false
174
- end
175
- when :Object
176
- # generic object (usually a Hash), return directly
177
- value
178
- when /\AArray<(?<inner_type>.+)>\z/
179
- inner_type = Regexp.last_match[:inner_type]
180
- value.map { |v| _deserialize(inner_type, v) }
181
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
- k_type = Regexp.last_match[:k_type]
183
- v_type = Regexp.last_match[:v_type]
184
- {}.tap do |hash|
185
- value.each do |k, v|
186
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
- end
188
- end
189
- else # model
190
- temp_model = CloudmersiveOcrApiClient.const_get(type).new
191
- temp_model.build_from_hash(value)
192
- end
193
- end
194
-
195
- # Returns the string representation of the object
196
- # @return [String] String presentation of the object
197
- def to_s
198
- to_hash.to_s
199
- end
200
-
201
- # to_body is an alias to to_hash (backward compatibility)
202
- # @return [Hash] Returns the object in the form of hash
203
- def to_body
204
- to_hash
205
- end
206
-
207
- # Returns the object in the form of hash
208
- # @return [Hash] Returns the object in the form of hash
209
- def to_hash
210
- hash = {}
211
- self.class.attribute_map.each_pair do |attr, param|
212
- value = self.send(attr)
213
- next if value.nil?
214
- hash[param] = _to_hash(value)
215
- end
216
- hash
217
- end
218
-
219
- # Outputs non-array value in the form of hash
220
- # For object, use to_hash. Otherwise, just return the value
221
- # @param [Object] value Any valid value
222
- # @return [Hash] Returns the value in the form of hash
223
- def _to_hash(value)
224
- if value.is_a?(Array)
225
- value.compact.map{ |v| _to_hash(v) }
226
- elsif value.is_a?(Hash)
227
- {}.tap do |hash|
228
- value.each { |k, v| hash[k] = _to_hash(v) }
229
- end
230
- elsif value.respond_to? :to_hash
231
- value.to_hash
232
- else
233
- value
234
- end
235
- end
236
-
237
- end
238
-
239
- end