helloextend_api_client 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +151 -0
  4. data/Rakefile +10 -0
  5. data/docs/Address.md +27 -0
  6. data/docs/Amount.md +19 -0
  7. data/docs/Contract.md +39 -0
  8. data/docs/ContractPlan.md +19 -0
  9. data/docs/ContractProduct.md +27 -0
  10. data/docs/ContractsApi.md +180 -0
  11. data/docs/Customer.md +23 -0
  12. data/docs/Error.md +19 -0
  13. data/docs/Invoice.md +27 -0
  14. data/docs/InvoiceDetails.md +19 -0
  15. data/docs/InvoiceDiscount.md +21 -0
  16. data/docs/InvoiceItems.md +31 -0
  17. data/docs/InvoiceMetadata.md +21 -0
  18. data/docs/InvoiceMetadataProduct.md +21 -0
  19. data/docs/InvoicePayee.md +23 -0
  20. data/docs/InvoicePayer.md +23 -0
  21. data/docs/Offer.md +17 -0
  22. data/docs/OfferPlan.md +23 -0
  23. data/docs/OfferPlanContract.md +27 -0
  24. data/docs/OffersApi.md +58 -0
  25. data/docs/Plan.md +21 -0
  26. data/docs/PlanDetails.md +21 -0
  27. data/docs/PlanPrices.md +21 -0
  28. data/docs/PlansApi.md +61 -0
  29. data/docs/PlansList.md +17 -0
  30. data/docs/Product.md +45 -0
  31. data/docs/ProductIdentifiers.md +25 -0
  32. data/docs/ProductMfrWarranty.md +21 -0
  33. data/docs/ProductsApi.md +241 -0
  34. data/git_push.sh +58 -0
  35. data/helloextend_api_client.gemspec +39 -0
  36. data/lib/helloextend_api_client.rb +68 -0
  37. data/lib/helloextend_api_client/api/contracts_api.rb +229 -0
  38. data/lib/helloextend_api_client/api/offers_api.rb +90 -0
  39. data/lib/helloextend_api_client/api/plans_api.rb +82 -0
  40. data/lib/helloextend_api_client/api/products_api.rb +298 -0
  41. data/lib/helloextend_api_client/api_client.rb +388 -0
  42. data/lib/helloextend_api_client/api_error.rb +57 -0
  43. data/lib/helloextend_api_client/configuration.rb +248 -0
  44. data/lib/helloextend_api_client/models/address.rb +259 -0
  45. data/lib/helloextend_api_client/models/amount.rb +217 -0
  46. data/lib/helloextend_api_client/models/contract.rb +378 -0
  47. data/lib/helloextend_api_client/models/contract_plan.rb +228 -0
  48. data/lib/helloextend_api_client/models/contract_product.rb +268 -0
  49. data/lib/helloextend_api_client/models/customer.rb +245 -0
  50. data/lib/helloextend_api_client/models/error.rb +225 -0
  51. data/lib/helloextend_api_client/models/invoice.rb +254 -0
  52. data/lib/helloextend_api_client/models/invoice_details.rb +216 -0
  53. data/lib/helloextend_api_client/models/invoice_discount.rb +226 -0
  54. data/lib/helloextend_api_client/models/invoice_items.rb +271 -0
  55. data/lib/helloextend_api_client/models/invoice_metadata.rb +226 -0
  56. data/lib/helloextend_api_client/models/invoice_metadata_product.rb +225 -0
  57. data/lib/helloextend_api_client/models/invoice_payee.rb +233 -0
  58. data/lib/helloextend_api_client/models/invoice_payer.rb +233 -0
  59. data/lib/helloextend_api_client/models/offer.rb +208 -0
  60. data/lib/helloextend_api_client/models/offer_plan.rb +236 -0
  61. data/lib/helloextend_api_client/models/offer_plan_contract.rb +258 -0
  62. data/lib/helloextend_api_client/models/plan.rb +225 -0
  63. data/lib/helloextend_api_client/models/plan_details.rb +227 -0
  64. data/lib/helloextend_api_client/models/plan_prices.rb +230 -0
  65. data/lib/helloextend_api_client/models/plans_list.rb +208 -0
  66. data/lib/helloextend_api_client/models/product.rb +429 -0
  67. data/lib/helloextend_api_client/models/product_identifiers.rb +247 -0
  68. data/lib/helloextend_api_client/models/product_mfr_warranty.rb +228 -0
  69. data/lib/helloextend_api_client/version.rb +15 -0
  70. data/spec/api/contracts_api_spec.rb +74 -0
  71. data/spec/api/offers_api_spec.rb +48 -0
  72. data/spec/api/plans_api_spec.rb +46 -0
  73. data/spec/api/products_api_spec.rb +88 -0
  74. data/spec/api_client_spec.rb +226 -0
  75. data/spec/configuration_spec.rb +42 -0
  76. data/spec/models/address_spec.rb +71 -0
  77. data/spec/models/amount_spec.rb +47 -0
  78. data/spec/models/contract_plan_spec.rb +47 -0
  79. data/spec/models/contract_product_spec.rb +71 -0
  80. data/spec/models/contract_spec.rb +111 -0
  81. data/spec/models/customer_spec.rb +59 -0
  82. data/spec/models/error_spec.rb +47 -0
  83. data/spec/models/invoice_details_spec.rb +47 -0
  84. data/spec/models/invoice_discount_spec.rb +53 -0
  85. data/spec/models/invoice_items_spec.rb +83 -0
  86. data/spec/models/invoice_metadata_product_spec.rb +53 -0
  87. data/spec/models/invoice_metadata_spec.rb +53 -0
  88. data/spec/models/invoice_payee_spec.rb +59 -0
  89. data/spec/models/invoice_payer_spec.rb +59 -0
  90. data/spec/models/invoice_spec.rb +71 -0
  91. data/spec/models/offer_plan_contract_spec.rb +71 -0
  92. data/spec/models/offer_plan_spec.rb +59 -0
  93. data/spec/models/offer_spec.rb +41 -0
  94. data/spec/models/plan_details_spec.rb +53 -0
  95. data/spec/models/plan_prices_spec.rb +53 -0
  96. data/spec/models/plan_spec.rb +53 -0
  97. data/spec/models/plans_list_spec.rb +41 -0
  98. data/spec/models/product_identifiers_spec.rb +65 -0
  99. data/spec/models/product_mfr_warranty_spec.rb +53 -0
  100. data/spec/models/product_spec.rb +129 -0
  101. data/spec/spec_helper.rb +111 -0
  102. metadata +235 -0
@@ -0,0 +1,254 @@
1
+ =begin
2
+ #Extend API Reference
3
+
4
+ ## Introduction Welcome to the Extend API Documentation! Our goal is to make your integration as clear and easy as possible, so if you have feedback or suggestions for our API or reference docs, [please let us know](mailto:devs@helloextend.com). If you are implementing the API for the first time, please use the latest \"2019-08-01\" API version. If you have already implemented the API and haven't specified a version, you are on the \"Default\" API version. #### You can get up and running with Extend with just 5 simple steps: * Create an account with Extend, and get an access token from your Extend merchant portal * Sync your store's products to Extend * Get the relevant Extend warranty SKUs and add them to your store * Add the JS SDK snippets to your store's website, which will enable warranty offers to be displayed in your store * Record warranty purchases with Extend so we can create a new contract and deliver it to the customer, or record warranty returns / refunds so we can cancel the contract and account for the refunded amount <div class='wrapper tip'><h2>Pro Tip! Keep your store's products up to date</h2><p>To make sure you are selling warranty plans on all eligible products (and not selling them on ineligible ones), it is best to keep your store's products in sync with Extend. If you update your products infrequently, it might be easiest to manually upload or edit products in your merchant portal. If you do update frequently, though, consider integrating with our Products API resource.</p><p>Need help? <a href='mailto:devs@helloextend.com'>Contact us!</a> We love to help!</p></div>
5
+
6
+ The version of the OpenAPI document: Default
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module HelloextendApiClient
16
+ class Invoice
17
+ # The invoice id, which is exactly the same as the corresponding contract id.
18
+ attr_accessor :id
19
+
20
+ attr_accessor :details
21
+
22
+ attr_accessor :payee
23
+
24
+ attr_accessor :payer
25
+
26
+ attr_accessor :items
27
+
28
+ attr_accessor :total_amount_due
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'id' => :'id',
34
+ :'details' => :'details',
35
+ :'payee' => :'payee',
36
+ :'payer' => :'payer',
37
+ :'items' => :'items',
38
+ :'total_amount_due' => :'totalAmountDue'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'details' => :'InvoiceDetails',
47
+ :'payee' => :'InvoicePayee',
48
+ :'payer' => :'InvoicePayer',
49
+ :'items' => :'Array<InvoiceItems>',
50
+ :'total_amount_due' => :'Amount'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::Invoice` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::Invoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'id')
76
+ self.id = attributes[:'id']
77
+ end
78
+
79
+ if attributes.key?(:'details')
80
+ self.details = attributes[:'details']
81
+ end
82
+
83
+ if attributes.key?(:'payee')
84
+ self.payee = attributes[:'payee']
85
+ end
86
+
87
+ if attributes.key?(:'payer')
88
+ self.payer = attributes[:'payer']
89
+ end
90
+
91
+ if attributes.key?(:'items')
92
+ if (value = attributes[:'items']).is_a?(Array)
93
+ self.items = value
94
+ end
95
+ end
96
+
97
+ if attributes.key?(:'total_amount_due')
98
+ self.total_amount_due = attributes[:'total_amount_due']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ id == o.id &&
121
+ details == o.details &&
122
+ payee == o.payee &&
123
+ payer == o.payer &&
124
+ items == o.items &&
125
+ total_amount_due == o.total_amount_due
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
+ [id, details, payee, payer, items, total_amount_due].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 type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ HelloextendApiClient.const_get(type).build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #Extend API Reference
3
+
4
+ ## Introduction Welcome to the Extend API Documentation! Our goal is to make your integration as clear and easy as possible, so if you have feedback or suggestions for our API or reference docs, [please let us know](mailto:devs@helloextend.com). If you are implementing the API for the first time, please use the latest \"2019-08-01\" API version. If you have already implemented the API and haven't specified a version, you are on the \"Default\" API version. #### You can get up and running with Extend with just 5 simple steps: * Create an account with Extend, and get an access token from your Extend merchant portal * Sync your store's products to Extend * Get the relevant Extend warranty SKUs and add them to your store * Add the JS SDK snippets to your store's website, which will enable warranty offers to be displayed in your store * Record warranty purchases with Extend so we can create a new contract and deliver it to the customer, or record warranty returns / refunds so we can cancel the contract and account for the refunded amount <div class='wrapper tip'><h2>Pro Tip! Keep your store's products up to date</h2><p>To make sure you are selling warranty plans on all eligible products (and not selling them on ineligible ones), it is best to keep your store's products in sync with Extend. If you update your products infrequently, it might be easiest to manually upload or edit products in your merchant portal. If you do update frequently, though, consider integrating with our Products API resource.</p><p>Need help? <a href='mailto:devs@helloextend.com'>Contact us!</a> We love to help!</p></div>
5
+
6
+ The version of the OpenAPI document: Default
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module HelloextendApiClient
16
+ class InvoiceDetails
17
+ attr_accessor :store_id
18
+
19
+ # A Date-Time stamp in ISO 8601 format (UTC)
20
+ attr_accessor :invoice_date
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'store_id' => :'storeId',
26
+ :'invoice_date' => :'invoiceDate'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'store_id' => :'String',
34
+ :'invoice_date' => :'DateTime'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `HelloextendApiClient::InvoiceDetails` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `HelloextendApiClient::InvoiceDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'store_id')
60
+ self.store_id = attributes[:'store_id']
61
+ end
62
+
63
+ if attributes.key?(:'invoice_date')
64
+ self.invoice_date = attributes[:'invoice_date']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ store_id == o.store_id &&
87
+ invoice_date == o.invoice_date
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Integer] Hash code
98
+ def hash
99
+ [store_id, invoice_date].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def self.build_from_hash(attributes)
106
+ new.build_from_hash(attributes)
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.openapi_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ HelloextendApiClient.const_get(type).build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+ end
216
+ end