messente_api 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +118 -0
  5. data/Rakefile +10 -0
  6. data/docs/BlacklistApi.md +209 -0
  7. data/docs/Channel.md +16 -0
  8. data/docs/ContactEnvelope.md +17 -0
  9. data/docs/ContactFields.md +35 -0
  10. data/docs/ContactListEnvelope.md +17 -0
  11. data/docs/ContactUpdateFields.md +33 -0
  12. data/docs/ContactsApi.md +430 -0
  13. data/docs/DeliveryReportApi.md +60 -0
  14. data/docs/DeliveryReportResponse.md +21 -0
  15. data/docs/DeliveryResult.md +27 -0
  16. data/docs/ErrorCodeOmnichannel.md +16 -0
  17. data/docs/ErrorCodeOmnichannelMachine.md +16 -0
  18. data/docs/ErrorCodePhonebook.md +16 -0
  19. data/docs/ErrorItemOmnichannel.md +23 -0
  20. data/docs/ErrorItemPhonebook.md +21 -0
  21. data/docs/ErrorOmnichannel.md +17 -0
  22. data/docs/ErrorPhonebook.md +17 -0
  23. data/docs/ErrorTitleOmnichannel.md +16 -0
  24. data/docs/ErrorTitlePhonebook.md +16 -0
  25. data/docs/FetchBlacklistSuccess.md +17 -0
  26. data/docs/GroupEnvelope.md +17 -0
  27. data/docs/GroupListEnvelope.md +17 -0
  28. data/docs/GroupName.md +17 -0
  29. data/docs/GroupResponseFields.md +23 -0
  30. data/docs/GroupsApi.md +265 -0
  31. data/docs/MessageResult.md +21 -0
  32. data/docs/NumberToBlacklist.md +17 -0
  33. data/docs/OmniMessageCreateSuccessResponse.md +21 -0
  34. data/docs/Omnimessage.md +25 -0
  35. data/docs/OmnimessageApi.md +111 -0
  36. data/docs/SMS.md +27 -0
  37. data/docs/Status.md +16 -0
  38. data/docs/TextStore.md +16 -0
  39. data/docs/Viber.md +29 -0
  40. data/docs/WhatsApp.md +29 -0
  41. data/docs/WhatsAppAudio.md +17 -0
  42. data/docs/WhatsAppDocument.md +19 -0
  43. data/docs/WhatsAppImage.md +19 -0
  44. data/docs/WhatsAppText.md +19 -0
  45. data/git_push.sh +55 -0
  46. data/lib/messente_api.rb +78 -0
  47. data/lib/messente_api/api/blacklist_api.rb +258 -0
  48. data/lib/messente_api/api/contacts_api.rb +521 -0
  49. data/lib/messente_api/api/delivery_report_api.rb +82 -0
  50. data/lib/messente_api/api/groups_api.rb +326 -0
  51. data/lib/messente_api/api/omnimessage_api.rb +144 -0
  52. data/lib/messente_api/api_client.rb +387 -0
  53. data/lib/messente_api/api_error.rb +57 -0
  54. data/lib/messente_api/configuration.rb +251 -0
  55. data/lib/messente_api/models/channel.rb +37 -0
  56. data/lib/messente_api/models/contact_envelope.rb +196 -0
  57. data/lib/messente_api/models/contact_fields.rb +283 -0
  58. data/lib/messente_api/models/contact_list_envelope.rb +198 -0
  59. data/lib/messente_api/models/contact_update_fields.rb +268 -0
  60. data/lib/messente_api/models/delivery_report_response.rb +234 -0
  61. data/lib/messente_api/models/delivery_result.rb +244 -0
  62. data/lib/messente_api/models/error_code_omnichannel.rb +41 -0
  63. data/lib/messente_api/models/error_code_omnichannel_machine.rb +46 -0
  64. data/lib/messente_api/models/error_code_phonebook.rb +40 -0
  65. data/lib/messente_api/models/error_item_omnichannel.rb +245 -0
  66. data/lib/messente_api/models/error_item_phonebook.rb +230 -0
  67. data/lib/messente_api/models/error_omnichannel.rb +203 -0
  68. data/lib/messente_api/models/error_phonebook.rb +203 -0
  69. data/lib/messente_api/models/error_title_omnichannel.rb +41 -0
  70. data/lib/messente_api/models/error_title_phonebook.rb +40 -0
  71. data/lib/messente_api/models/fetch_blacklist_success.rb +198 -0
  72. data/lib/messente_api/models/group_envelope.rb +196 -0
  73. data/lib/messente_api/models/group_list_envelope.rb +198 -0
  74. data/lib/messente_api/models/group_name.rb +220 -0
  75. data/lib/messente_api/models/group_response_fields.rb +240 -0
  76. data/lib/messente_api/models/message_result.rb +231 -0
  77. data/lib/messente_api/models/number_to_blacklist.rb +202 -0
  78. data/lib/messente_api/models/omni_message_create_success_response.rb +234 -0
  79. data/lib/messente_api/models/omnimessage.rb +247 -0
  80. data/lib/messente_api/models/sms.rb +300 -0
  81. data/lib/messente_api/models/status.rb +45 -0
  82. data/lib/messente_api/models/text_store.rb +37 -0
  83. data/lib/messente_api/models/viber.rb +293 -0
  84. data/lib/messente_api/models/whats_app.rb +289 -0
  85. data/lib/messente_api/models/whats_app_audio.rb +202 -0
  86. data/lib/messente_api/models/whats_app_document.rb +212 -0
  87. data/lib/messente_api/models/whats_app_image.rb +212 -0
  88. data/lib/messente_api/models/whats_app_text.rb +214 -0
  89. data/lib/messente_api/version.rb +15 -0
  90. data/messente_api.gemspec +45 -0
  91. data/spec/api/blacklist_api_spec.rb +78 -0
  92. data/spec/api/contacts_api_spec.rb +126 -0
  93. data/spec/api/delivery_report_api_spec.rb +46 -0
  94. data/spec/api/groups_api_spec.rb +90 -0
  95. data/spec/api/omnimessage_api_spec.rb +57 -0
  96. data/spec/api_client_spec.rb +226 -0
  97. data/spec/configuration_spec.rb +42 -0
  98. data/spec/models/channel_spec.rb +35 -0
  99. data/spec/models/contact_envelope_spec.rb +41 -0
  100. data/spec/models/contact_fields_spec.rb +95 -0
  101. data/spec/models/contact_list_envelope_spec.rb +41 -0
  102. data/spec/models/contact_update_fields_spec.rb +89 -0
  103. data/spec/models/delivery_report_response_spec.rb +53 -0
  104. data/spec/models/delivery_result_spec.rb +71 -0
  105. data/spec/models/error_code_omnichannel_machine_spec.rb +35 -0
  106. data/spec/models/error_code_omnichannel_spec.rb +35 -0
  107. data/spec/models/error_code_phonebook_spec.rb +35 -0
  108. data/spec/models/error_item_omnichannel_spec.rb +59 -0
  109. data/spec/models/error_item_phonebook_spec.rb +53 -0
  110. data/spec/models/error_omnichannel_spec.rb +41 -0
  111. data/spec/models/error_phonebook_spec.rb +41 -0
  112. data/spec/models/error_title_omnichannel_spec.rb +35 -0
  113. data/spec/models/error_title_phonebook_spec.rb +35 -0
  114. data/spec/models/fetch_blacklist_success_spec.rb +41 -0
  115. data/spec/models/group_envelope_spec.rb +41 -0
  116. data/spec/models/group_list_envelope_spec.rb +41 -0
  117. data/spec/models/group_name_spec.rb +41 -0
  118. data/spec/models/group_response_fields_spec.rb +59 -0
  119. data/spec/models/message_result_spec.rb +53 -0
  120. data/spec/models/number_to_blacklist_spec.rb +41 -0
  121. data/spec/models/omni_message_create_success_response_spec.rb +53 -0
  122. data/spec/models/omnimessage_spec.rb +65 -0
  123. data/spec/models/sms_spec.rb +79 -0
  124. data/spec/models/status_spec.rb +35 -0
  125. data/spec/models/text_store_spec.rb +35 -0
  126. data/spec/models/viber_spec.rb +81 -0
  127. data/spec/models/whats_app_audio_spec.rb +41 -0
  128. data/spec/models/whats_app_document_spec.rb +47 -0
  129. data/spec/models/whats_app_image_spec.rb +47 -0
  130. data/spec/models/whats_app_spec.rb +81 -0
  131. data/spec/models/whats_app_text_spec.rb +47 -0
  132. data/spec/spec_helper.rb +111 -0
  133. metadata +401 -0
@@ -0,0 +1,198 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ class ContactListEnvelope
17
+ attr_accessor :contacts
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'contacts' => :'contacts'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'contacts' => :'Array<ContactFields>'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ if (!attributes.is_a?(Hash))
37
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::ContactListEnvelope` initialize method"
38
+ end
39
+
40
+ # check to see if the attribute exists and convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h|
42
+ if (!self.class.attribute_map.key?(k.to_sym))
43
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::ContactListEnvelope`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
44
+ end
45
+ h[k.to_sym] = v
46
+ }
47
+
48
+ if attributes.key?(:'contacts')
49
+ if (value = attributes[:'contacts']).is_a?(Array)
50
+ self.contacts = value
51
+ end
52
+ end
53
+ end
54
+
55
+ # Show invalid properties with the reasons. Usually used together with valid?
56
+ # @return Array for valid properties with the reasons
57
+ def list_invalid_properties
58
+ invalid_properties = Array.new
59
+ invalid_properties
60
+ end
61
+
62
+ # Check to see if the all the properties in the model are valid
63
+ # @return true if the model is valid
64
+ def valid?
65
+ true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ contacts == o.contacts
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 [Integer] Hash code
84
+ def hash
85
+ [contacts].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 self.build_from_hash(attributes)
92
+ new.build_from_hash(attributes)
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.openapi_types.each_pair do |key, type|
101
+ if type =~ /\AArray<(.*)>/i
102
+ # check to ensure the input is an array given that the attribute
103
+ # is documented as an array but the input is not
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
110
+ end
111
+
112
+ self
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :Boolean
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ MessenteApi.const_get(type).build_from_hash(value)
153
+ end
154
+ end
155
+
156
+ # Returns the string representation of the object
157
+ # @return [String] String presentation of the object
158
+ def to_s
159
+ to_hash.to_s
160
+ end
161
+
162
+ # to_body is an alias to to_hash (backward compatibility)
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_body
165
+ to_hash
166
+ end
167
+
168
+ # Returns the object in the form of hash
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_hash
171
+ hash = {}
172
+ self.class.attribute_map.each_pair do |attr, param|
173
+ value = self.send(attr)
174
+ next if value.nil?
175
+ hash[param] = _to_hash(value)
176
+ end
177
+ hash
178
+ end
179
+
180
+ # Outputs non-array value in the form of hash
181
+ # For object, use to_hash. Otherwise, just return the value
182
+ # @param [Object] value Any valid value
183
+ # @return [Hash] Returns the value in the form of hash
184
+ def _to_hash(value)
185
+ if value.is_a?(Array)
186
+ value.compact.map { |v| _to_hash(v) }
187
+ elsif value.is_a?(Hash)
188
+ {}.tap do |hash|
189
+ value.each { |k, v| hash[k] = _to_hash(v) }
190
+ end
191
+ elsif value.respond_to? :to_hash
192
+ value.to_hash
193
+ else
194
+ value
195
+ end
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,268 @@
1
+ =begin
2
+ #Messente API
3
+
4
+ #[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MessenteApi
16
+ class ContactUpdateFields
17
+ attr_accessor :email
18
+
19
+ attr_accessor :first_name
20
+
21
+ attr_accessor :last_name
22
+
23
+ attr_accessor :company
24
+
25
+ attr_accessor :title
26
+
27
+ attr_accessor :custom
28
+
29
+ attr_accessor :custom2
30
+
31
+ attr_accessor :custom3
32
+
33
+ attr_accessor :custom4
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'email' => :'email',
39
+ :'first_name' => :'firstName',
40
+ :'last_name' => :'lastName',
41
+ :'company' => :'company',
42
+ :'title' => :'title',
43
+ :'custom' => :'custom',
44
+ :'custom2' => :'custom2',
45
+ :'custom3' => :'custom3',
46
+ :'custom4' => :'custom4'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'email' => :'String',
54
+ :'first_name' => :'String',
55
+ :'last_name' => :'String',
56
+ :'company' => :'String',
57
+ :'title' => :'String',
58
+ :'custom' => :'String',
59
+ :'custom2' => :'String',
60
+ :'custom3' => :'String',
61
+ :'custom4' => :'String'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::ContactUpdateFields` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::ContactUpdateFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'email')
81
+ self.email = attributes[:'email']
82
+ end
83
+
84
+ if attributes.key?(:'first_name')
85
+ self.first_name = attributes[:'first_name']
86
+ end
87
+
88
+ if attributes.key?(:'last_name')
89
+ self.last_name = attributes[:'last_name']
90
+ end
91
+
92
+ if attributes.key?(:'company')
93
+ self.company = attributes[:'company']
94
+ end
95
+
96
+ if attributes.key?(:'title')
97
+ self.title = attributes[:'title']
98
+ end
99
+
100
+ if attributes.key?(:'custom')
101
+ self.custom = attributes[:'custom']
102
+ end
103
+
104
+ if attributes.key?(:'custom2')
105
+ self.custom2 = attributes[:'custom2']
106
+ end
107
+
108
+ if attributes.key?(:'custom3')
109
+ self.custom3 = attributes[:'custom3']
110
+ end
111
+
112
+ if attributes.key?(:'custom4')
113
+ self.custom4 = attributes[:'custom4']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ email == o.email &&
136
+ first_name == o.first_name &&
137
+ last_name == o.last_name &&
138
+ company == o.company &&
139
+ title == o.title &&
140
+ custom == o.custom &&
141
+ custom2 == o.custom2 &&
142
+ custom3 == o.custom3 &&
143
+ custom4 == o.custom4
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [email, first_name, last_name, company, title, custom, custom2, custom3, custom4].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ new.build_from_hash(attributes)
163
+ end
164
+
165
+ # Builds the object from hash
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ # @return [Object] Returns the model itself
168
+ def build_from_hash(attributes)
169
+ return nil unless attributes.is_a?(Hash)
170
+ self.class.openapi_types.each_pair do |key, type|
171
+ if type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
175
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
+ end
177
+ elsif !attributes[self.class.attribute_map[key]].nil?
178
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :DateTime
192
+ DateTime.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ MessenteApi.const_get(type).build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ next if value.nil?
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
267
+ end
268
+ end