postfinancecheckout-ruby-sdk 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,273 @@
1
+ =begin
2
+ # PostFinance Ruby SDK
3
+ #
4
+ # This library allows to interact with the PostFinance payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.postfinance.ch/en/private.html
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module PostfinancecheckoutRubySdk
27
+ # The result of submitting a merchant application.
28
+ class MerchantApplicationSubmittedDto
29
+ attr_accessor :application_state
30
+
31
+ # The ID of the organization created by submitting the application.
32
+ attr_accessor :payment_facilitator_organization_id
33
+
34
+ # The ID of the submitted merchant application.
35
+ attr_accessor :merchant_application_id
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'application_state' => :'applicationState',
63
+ :'payment_facilitator_organization_id' => :'paymentFacilitatorOrganizationId',
64
+ :'merchant_application_id' => :'merchantApplicationId'
65
+ }
66
+ end
67
+
68
+ # Returns attribute mapping this model knows about
69
+ def self.acceptable_attribute_map
70
+ attribute_map
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ acceptable_attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'application_state' => :'MerchantApplicationState',
82
+ :'payment_facilitator_organization_id' => :'Integer',
83
+ :'merchant_application_id' => :'Integer'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::MerchantApplicationSubmittedDto` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ acceptable_attribute_map = self.class.acceptable_attribute_map
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!acceptable_attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::MerchantApplicationSubmittedDto`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'application_state')
110
+ self.application_state = attributes[:'application_state']
111
+ end
112
+
113
+ if attributes.key?(:'payment_facilitator_organization_id')
114
+ self.payment_facilitator_organization_id = attributes[:'payment_facilitator_organization_id']
115
+ end
116
+
117
+ if attributes.key?(:'merchant_application_id')
118
+ self.merchant_application_id = attributes[:'merchant_application_id']
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
126
+ invalid_properties = Array.new
127
+ invalid_properties
128
+ end
129
+
130
+ # Check to see if the all the properties in the model are valid
131
+ # @return true if the model is valid
132
+ def valid?
133
+ warn '[DEPRECATED] the `valid?` method is obsolete'
134
+ true
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ application_state == o.application_state &&
143
+ payment_facilitator_organization_id == o.payment_facilitator_organization_id &&
144
+ merchant_application_id == o.merchant_application_id
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Integer] Hash code
155
+ def hash
156
+ [application_state, payment_facilitator_organization_id, merchant_application_id].hash
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 self.build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ attributes = attributes.transform_keys(&:to_sym)
165
+ transformed_hash = {}
166
+ openapi_types.each_pair do |key, type|
167
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = nil
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[attribute_map[key]].is_a?(Array)
173
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
174
+ end
175
+ elsif !attributes[attribute_map[key]].nil?
176
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
177
+ end
178
+ end
179
+ new(transformed_hash)
180
+ end
181
+
182
+ # Deserializes the data based on type
183
+ # @param string type Data type
184
+ # @param string value Value to be deserialized
185
+ # @return [Object] Deserialized data
186
+ def self._deserialize(type, value)
187
+ case type.to_sym
188
+ when :Time
189
+ Time.parse(value)
190
+ when :Date
191
+ Date.parse(value)
192
+ when :String
193
+ value.to_s
194
+ when :Integer
195
+ value.to_i
196
+ when :Float
197
+ value.to_f
198
+ when :Boolean
199
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
200
+ true
201
+ else
202
+ false
203
+ end
204
+ when :Object
205
+ # generic object (usually a Hash), return directly
206
+ value
207
+ when /\AArray<(?<inner_type>.+)>\z/
208
+ inner_type = Regexp.last_match[:inner_type]
209
+ value.map { |v| _deserialize(inner_type, v) }
210
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
211
+ k_type = Regexp.last_match[:k_type]
212
+ v_type = Regexp.last_match[:v_type]
213
+ {}.tap do |hash|
214
+ value.each do |k, v|
215
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
216
+ end
217
+ end
218
+ else # model
219
+ # models (e.g. Pet) or oneOf
220
+ klass = PostfinancecheckoutRubySdk.const_get(type)
221
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
222
+ end
223
+ end
224
+
225
+ # Returns the string representation of the object
226
+ # @return [String] String presentation of the object
227
+ def to_s
228
+ to_hash.to_s
229
+ end
230
+
231
+ # to_body is an alias to to_hash (backward compatibility)
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_body
234
+ to_hash
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ if value.nil?
244
+ is_nullable = self.class.openapi_nullable.include?(attr)
245
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
246
+ end
247
+
248
+ hash[param] = _to_hash(value)
249
+ end
250
+ hash
251
+ end
252
+
253
+ # Outputs non-array value in the form of hash
254
+ # For object, use to_hash. Otherwise, just return the value
255
+ # @param [Object] value Any valid value
256
+ # @return [Hash] Returns the value in the form of hash
257
+ def _to_hash(value)
258
+ if value.is_a?(Array)
259
+ value.compact.map { |v| _to_hash(v) }
260
+ elsif value.is_a?(Hash)
261
+ {}.tap do |hash|
262
+ value.each { |k, v| hash[k] = _to_hash(v) }
263
+ end
264
+ elsif value.respond_to? :to_hash
265
+ value.to_hash
266
+ else
267
+ value
268
+ end
269
+ end
270
+
271
+ end
272
+
273
+ end
@@ -24,16 +24,20 @@ require 'date'
24
24
  require 'time'
25
25
 
26
26
  module PostfinancecheckoutRubySdk
27
- class PaymentTerminalUpdate
27
+ class PaymentTerminalUpdateRequest
28
+ # The configuration that is assigned to the terminal and determines how it works.
29
+ attr_accessor :configuration
30
+
28
31
  # The name used to identify the payment terminal.
29
32
  attr_accessor :name
30
33
 
31
- # The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
34
+ # The version is used for optimistic locking and incremented whenever the payment terminal is updated.
32
35
  attr_accessor :version
33
36
 
34
37
  # Attribute mapping from ruby-style variable name to JSON key.
35
38
  def self.attribute_map
36
39
  {
40
+ :'configuration' => :'configuration',
37
41
  :'name' => :'name',
38
42
  :'version' => :'version'
39
43
  }
@@ -52,6 +56,7 @@ module PostfinancecheckoutRubySdk
52
56
  # Attribute type mapping.
53
57
  def self.openapi_types
54
58
  {
59
+ :'configuration' => :'Integer',
55
60
  :'name' => :'String',
56
61
  :'version' => :'Integer'
57
62
  }
@@ -67,26 +72,28 @@ module PostfinancecheckoutRubySdk
67
72
  # @param [Hash] attributes Model attributes in the form of hash
68
73
  def initialize(attributes = {})
69
74
  if (!attributes.is_a?(Hash))
70
- fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::PaymentTerminalUpdate` initialize method"
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::PaymentTerminalUpdateRequest` initialize method"
71
76
  end
72
77
 
73
78
  # check to see if the attribute exists and convert string to symbol for hash key
74
79
  acceptable_attribute_map = self.class.acceptable_attribute_map
75
80
  attributes = attributes.each_with_object({}) { |(k, v), h|
76
81
  if (!acceptable_attribute_map.key?(k.to_sym))
77
- fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::PaymentTerminalUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::PaymentTerminalUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
83
  end
79
84
  h[k.to_sym] = v
80
85
  }
81
86
 
87
+ if attributes.key?(:'configuration')
88
+ self.configuration = attributes[:'configuration']
89
+ end
90
+
82
91
  if attributes.key?(:'name')
83
92
  self.name = attributes[:'name']
84
93
  end
85
94
 
86
95
  if attributes.key?(:'version')
87
96
  self.version = attributes[:'version']
88
- else
89
- self.version = nil
90
97
  end
91
98
  end
92
99
 
@@ -95,14 +102,6 @@ module PostfinancecheckoutRubySdk
95
102
  def list_invalid_properties
96
103
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
104
  invalid_properties = Array.new
98
- if !@name.nil? && @name.to_s.length > 100
99
- invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
100
- end
101
-
102
- if @version.nil?
103
- invalid_properties.push('invalid value for "version", version cannot be nil.')
104
- end
105
-
106
105
  invalid_properties
107
106
  end
108
107
 
@@ -110,40 +109,15 @@ module PostfinancecheckoutRubySdk
110
109
  # @return true if the model is valid
111
110
  def valid?
112
111
  warn '[DEPRECATED] the `valid?` method is obsolete'
113
- return false if !@name.nil? && @name.to_s.length > 100
114
- return false if @version.nil?
115
112
  true
116
113
  end
117
114
 
118
- # Custom attribute writer method with validation
119
- # @param [Object] name Value to be assigned
120
- def name=(name)
121
- if name.nil?
122
- fail ArgumentError, 'name cannot be nil'
123
- end
124
-
125
- if name.to_s.length > 100
126
- fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
127
- end
128
-
129
- @name = name
130
- end
131
-
132
- # Custom attribute writer method with validation
133
- # @param [Object] version Value to be assigned
134
- def version=(version)
135
- if version.nil?
136
- fail ArgumentError, 'version cannot be nil'
137
- end
138
-
139
- @version = version
140
- end
141
-
142
115
  # Checks equality by comparing each attribute.
143
116
  # @param [Object] Object to be compared
144
117
  def ==(o)
145
118
  return true if self.equal?(o)
146
119
  self.class == o.class &&
120
+ configuration == o.configuration &&
147
121
  name == o.name &&
148
122
  version == o.version
149
123
  end
@@ -157,7 +131,7 @@ module PostfinancecheckoutRubySdk
157
131
  # Calculates hash code according to all attributes.
158
132
  # @return [Integer] Hash code
159
133
  def hash
160
- [name, version].hash
134
+ [configuration, name, version].hash
161
135
  end
162
136
 
163
137
  # Builds the object from hash
@@ -0,0 +1,250 @@
1
+ =begin
2
+ # PostFinance Ruby SDK
3
+ #
4
+ # This library allows to interact with the PostFinance payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://www.postfinance.ch/en/private.html
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module PostfinancecheckoutRubySdk
27
+ class SubscriptionPartialUpdateRequest
28
+ # A description used to identify the subscription.
29
+ attr_accessor :description
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'description' => :'description'
35
+ }
36
+ end
37
+
38
+ # Returns attribute mapping this model knows about
39
+ def self.acceptable_attribute_map
40
+ attribute_map
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ acceptable_attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'description' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::SubscriptionPartialUpdateRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::SubscriptionPartialUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'description')
78
+ self.description = attributes[:'description']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
86
+ invalid_properties = Array.new
87
+ if !@description.nil? && @description.to_s.length > 200
88
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 200.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ warn '[DEPRECATED] the `valid?` method is obsolete'
98
+ return false if !@description.nil? && @description.to_s.length > 200
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] description Value to be assigned
104
+ def description=(description)
105
+ if description.nil?
106
+ fail ArgumentError, 'description cannot be nil'
107
+ end
108
+
109
+ if description.to_s.length > 200
110
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 200.'
111
+ end
112
+
113
+ @description = description
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ description == o.description
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [description].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ transformed_hash = {}
143
+ openapi_types.each_pair do |key, type|
144
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = nil
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[attribute_map[key]].is_a?(Array)
150
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
151
+ end
152
+ elsif !attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
154
+ end
155
+ end
156
+ new(transformed_hash)
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def self._deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = PostfinancecheckoutRubySdk.const_get(type)
198
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end