bleumi_pay_sdk_ruby 1.0.2 → 1.0.3

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.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -43
  3. data/bleumi_pay_sdk_ruby.gemspec +2 -3
  4. data/docs/BadRequest.md +1 -0
  5. data/docs/Chain.md +11 -0
  6. data/docs/CheckoutToken.md +23 -0
  7. data/docs/CreateCheckoutUrlRequest.md +30 -0
  8. data/docs/CreateCheckoutUrlResponse.md +17 -0
  9. data/docs/CreatePaymentRequest.md +19 -0
  10. data/docs/CreatePaymentResponse.md +15 -0
  11. data/docs/CreatePayoutRequest.md +28 -0
  12. data/docs/CreatePayoutResponse.md +15 -0
  13. data/docs/EthAddress.md +6 -1
  14. data/docs/HostedCheckoutsApi.md +190 -0
  15. data/docs/NetworkBalance.md +29 -0
  16. data/docs/PaginatedPaymentOperations.md +29 -0
  17. data/docs/PaginatedPayments.md +68 -0
  18. data/docs/PaginatedPayoutItems.md +59 -0
  19. data/docs/Payment.md +44 -0
  20. data/docs/PaymentAddresses.md +22 -0
  21. data/docs/PaymentBalances.md +24 -0
  22. data/docs/PaymentOperation.md +46 -0
  23. data/docs/PaymentOperationInputs.md +32 -0
  24. data/docs/PaymentOperationResponse.md +15 -0
  25. data/docs/PaymentRefundRequest.md +16 -0
  26. data/docs/PaymentSettleRequest.md +17 -0
  27. data/docs/PaymentsApi.md +426 -0
  28. data/docs/Payout.md +17 -0
  29. data/docs/PayoutItem.md +39 -0
  30. data/docs/PayoutItemInputs.md +28 -0
  31. data/docs/PayoutsApi.md +137 -0
  32. data/docs/Token.md +15 -0
  33. data/docs/ValidateCheckoutRequest.md +21 -0
  34. data/docs/ValidateCheckoutResponse.md +15 -0
  35. data/docs/WalletAddress.md +14 -0
  36. data/docs/WalletBalance.md +14 -4
  37. data/lib/bleumi_pay_sdk_ruby.rb +32 -15
  38. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +200 -0
  39. data/lib/bleumi_pay_sdk_ruby/api/{erc20_payments_api.rb → payments_api.rb} +130 -124
  40. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +157 -0
  41. data/lib/bleumi_pay_sdk_ruby/api_client.rb +2 -2
  42. data/lib/bleumi_pay_sdk_ruby/api_error.rb +2 -2
  43. data/lib/bleumi_pay_sdk_ruby/configuration.rb +2 -2
  44. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +13 -3
  45. data/lib/bleumi_pay_sdk_ruby/models/{eth_network.rb → chain.rb} +7 -5
  46. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +272 -0
  47. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +299 -0
  48. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +227 -0
  49. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_input.rb → create_payment_request.rb} +17 -7
  50. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_output.rb → create_payment_response.rb} +18 -22
  51. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +243 -0
  52. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +212 -0
  53. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +2 -2
  54. data/lib/bleumi_pay_sdk_ruby/models/network_balance.rb +274 -0
  55. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +224 -0
  56. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallet_operations.rb → paginated_payments.rb} +18 -8
  57. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallets.rb → paginated_payout_items.rb} +18 -8
  58. data/lib/bleumi_pay_sdk_ruby/models/{wallet.rb → payment.rb} +30 -53
  59. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +209 -0
  60. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +207 -0
  61. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation.rb → payment_operation.rb} +42 -17
  62. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_inputs.rb → payment_operation_inputs.rb} +37 -11
  63. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_output.rb → payment_operation_response.rb} +17 -7
  64. data/lib/bleumi_pay_sdk_ruby/models/{wallet_refund_operation_input.rb → payment_refund_request.rb} +17 -7
  65. data/lib/bleumi_pay_sdk_ruby/models/{wallet_settle_operation_input.rb → payment_settle_request.rb} +17 -7
  66. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +227 -0
  67. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +286 -0
  68. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +244 -0
  69. data/lib/bleumi_pay_sdk_ruby/models/token.rb +214 -0
  70. data/lib/bleumi_pay_sdk_ruby/models/{wallet_inputs.rb → validate_checkout_request.rb} +57 -62
  71. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +212 -0
  72. data/lib/bleumi_pay_sdk_ruby/models/wallet_address.rb +212 -0
  73. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +17 -7
  74. data/lib/bleumi_pay_sdk_ruby/version.rb +3 -3
  75. data/spec/api/hosted_checkouts_api_spec.rb +67 -0
  76. data/spec/api/payments_api_spec.rb +122 -0
  77. data/spec/api/payouts_api_spec.rb +61 -0
  78. data/spec/api_client_spec.rb +226 -0
  79. data/spec/configuration_spec.rb +42 -0
  80. data/spec/models/bad_request_spec.rb +47 -0
  81. data/spec/models/chain_spec.rb +35 -0
  82. data/spec/models/checkout_token_spec.rb +65 -0
  83. data/spec/models/create_checkout_url_request_spec.rb +83 -0
  84. data/spec/models/create_checkout_url_response_spec.rb +47 -0
  85. data/spec/models/create_payment_request_spec.rb +53 -0
  86. data/spec/models/create_payment_response_spec.rb +41 -0
  87. data/spec/models/create_payout_request_spec.rb +53 -0
  88. data/spec/models/create_payout_response_spec.rb +41 -0
  89. data/spec/models/eth_address_spec.rb +41 -0
  90. data/spec/models/network_balance_spec.rb +77 -0
  91. data/spec/models/paginated_payment_operations_spec.rb +47 -0
  92. data/spec/models/paginated_payments_spec.rb +47 -0
  93. data/spec/models/paginated_payout_items_spec.rb +47 -0
  94. data/spec/models/payment_addresses_spec.rb +41 -0
  95. data/spec/models/payment_balances_spec.rb +41 -0
  96. data/spec/models/payment_operation_inputs_spec.rb +65 -0
  97. data/spec/models/payment_operation_response_spec.rb +41 -0
  98. data/spec/models/payment_operation_spec.rb +71 -0
  99. data/spec/models/payment_refund_request_spec.rb +41 -0
  100. data/spec/models/payment_settle_request_spec.rb +47 -0
  101. data/spec/models/payment_spec.rb +65 -0
  102. data/spec/models/payout_item_inputs_spec.rb +53 -0
  103. data/spec/models/payout_item_spec.rb +71 -0
  104. data/spec/models/payout_spec.rb +47 -0
  105. data/spec/models/token_spec.rb +41 -0
  106. data/spec/models/validate_checkout_request_spec.rb +59 -0
  107. data/spec/models/validate_checkout_response_spec.rb +41 -0
  108. data/spec/models/wallet_address_spec.rb +41 -0
  109. data/spec/models/wallet_balance_spec.rb +59 -0
  110. data/spec/spec_helper.rb +111 -0
  111. metadata +149 -45
  112. data/docs/Erc20PaymentsApi.md +0 -334
  113. data/docs/EthNetwork.md +0 -9
  114. data/docs/PaginatedWalletOperations.md +0 -8
  115. data/docs/PaginatedWallets.md +0 -8
  116. data/docs/Wallet.md +0 -13
  117. data/docs/WalletCreateInput.md +0 -9
  118. data/docs/WalletCreateOutput.md +0 -10
  119. data/docs/WalletInputs.md +0 -11
  120. data/docs/WalletOperation.md +0 -11
  121. data/docs/WalletOperationInputs.md +0 -10
  122. data/docs/WalletOperationOutput.md +0 -8
  123. data/docs/WalletRefundOperationInput.md +0 -7
  124. data/docs/WalletSettleOperationInput.md +0 -8
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: info@bleumi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class PayoutItemInputs
17
+ # Unique identifier generated for the txid of the payout (specified during Create a Payout).
18
+ attr_accessor :salt
19
+
20
+ # Token used for the payout
21
+ attr_accessor :token
22
+
23
+ # Array of payments to be made in this payout. This is an atomic transaction (i.e. either all payments are processed or all of them are rejected).
24
+ attr_accessor :payouts
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'salt' => :'salt',
30
+ :'token' => :'token',
31
+ :'payouts' => :'payouts'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'salt' => :'String',
39
+ :'token' => :'String',
40
+ :'payouts' => :'Array<Payout>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::PayoutItemInputs` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::PayoutItemInputs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'salt')
66
+ self.salt = attributes[:'salt']
67
+ end
68
+
69
+ if attributes.key?(:'token')
70
+ self.token = attributes[:'token']
71
+ end
72
+
73
+ if attributes.key?(:'payouts')
74
+ if (value = attributes[:'payouts']).is_a?(Array)
75
+ self.payouts = value
76
+ end
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ if @salt.nil?
85
+ invalid_properties.push('invalid value for "salt", salt cannot be nil.')
86
+ end
87
+
88
+ if @token.nil?
89
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
90
+ end
91
+
92
+ if @payouts.nil?
93
+ invalid_properties.push('invalid value for "payouts", payouts cannot be nil.')
94
+ end
95
+
96
+ 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 false if @salt.nil?
103
+ return false if @token.nil?
104
+ return false if @payouts.nil?
105
+ 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
+ salt == o.salt &&
114
+ token == o.token &&
115
+ payouts == o.payouts
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [salt, token, payouts].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ new.build_from_hash(attributes)
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :DateTime
164
+ DateTime.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ BleumiPay.const_get(type).build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: info@bleumi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class Token
17
+ # ETH - for Ethereum ; XDAI - for xDai ; XDAIT - for xDai Testnet ; <contract address of ERC-20 token> - for ERC-20 Tokens;
18
+ attr_accessor :addr
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'addr' => :'addr'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'addr' => :'String'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ def eth_address?(str)
41
+ # We use !! to convert the return value to a boolean
42
+ !!(str =~ /^0x[a-fA-F0-9]{40}$/)
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(value)
48
+
49
+ if (!eth_address?(value))
50
+ fail ArgumentError, "`#{value}` The input argument must be valid Ethereum Address `BleumiPay::EthAddress` initialize method"
51
+ end
52
+
53
+ self.addr = value
54
+
55
+ end
56
+
57
+ # validation for updating addr using setter of addr
58
+ def addr=(new_addr)
59
+ if ((eth_address?(new_addr))||(new_addr == "ETH")||(new_addr == "XDAI")||(new_addr == "XDAIT"))
60
+ fail ArgumentError, "`#{new_addr}` The input argument must be valid Token `BleumiPay::Token` initialize method"
61
+ end
62
+ @addr = new_addr
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @addr.nil?
70
+ invalid_properties.push('invalid value for "addr", addr cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @addr.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ addr == o.addr
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [addr].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ BleumiPay.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ # hash = {}
187
+ # self.class.attribute_map.each_pair do |attr, param|
188
+ # value = self.send(attr)
189
+ # next if value.nil?
190
+ # hash[param] = _to_hash(value)
191
+ # end
192
+ # hash
193
+ addr
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end