bleumi_pay_sdk_ruby 1.0.3 → 1.0.4

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -7
  3. data/bleumi_pay_sdk_ruby.gemspec +3 -3
  4. data/docs/AlgorandBalance.md +27 -0
  5. data/docs/BadRequest.md +1 -1
  6. data/docs/Chain.md +4 -3
  7. data/docs/CheckoutToken.md +6 -3
  8. data/docs/CreateCheckoutUrlRequest.md +7 -7
  9. data/docs/CreatePaymentRequest.md +3 -3
  10. data/docs/CreatePaymentResponse.md +1 -1
  11. data/docs/CreatePayoutRequest.md +1 -1
  12. data/docs/CreatePayoutResponse.md +1 -1
  13. data/docs/EthereumBalance.md +29 -0
  14. data/docs/HostedCheckoutsApi.md +26 -12
  15. data/docs/PaginatedPaymentOperations.md +2 -3
  16. data/docs/PaginatedPayments.md +3 -3
  17. data/docs/PaginatedPayoutItems.md +1 -1
  18. data/docs/Payment.md +0 -1
  19. data/docs/PaymentAddresses.md +2 -1
  20. data/docs/PaymentBalances.md +2 -1
  21. data/docs/PaymentOperation.md +2 -2
  22. data/docs/PaymentOperationInputs.md +4 -4
  23. data/docs/PaymentRefundRequest.md +1 -2
  24. data/docs/PaymentSettleRequest.md +1 -1
  25. data/docs/PaymentsApi.md +17 -15
  26. data/docs/Payout.md +2 -1
  27. data/docs/PayoutItem.md +1 -1
  28. data/docs/PayoutItemInputs.md +1 -1
  29. data/docs/PayoutsApi.md +10 -10
  30. data/docs/ValidateCheckoutRequest.md +1 -1
  31. data/docs/WalletAddress.md +1 -0
  32. data/docs/WalletBalance.md +1 -1
  33. data/lib/bleumi_pay_sdk_ruby.rb +5 -5
  34. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +17 -5
  35. data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +46 -17
  36. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +14 -6
  37. data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +264 -0
  38. data/lib/bleumi_pay_sdk_ruby/api_client.rb +3 -3
  39. data/lib/bleumi_pay_sdk_ruby/api_error.rb +2 -2
  40. data/lib/bleumi_pay_sdk_ruby/configuration.rb +3 -3
  41. data/lib/bleumi_pay_sdk_ruby/models/{token.rb → algorand_balance.rb} +43 -38
  42. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +3 -3
  43. data/lib/bleumi_pay_sdk_ruby/models/chain.rb +4 -5
  44. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +28 -13
  45. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +19 -7
  46. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +2 -2
  47. data/lib/bleumi_pay_sdk_ruby/models/create_payment_request.rb +17 -5
  48. data/lib/bleumi_pay_sdk_ruby/models/create_payment_response.rb +2 -2
  49. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +4 -3
  50. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +2 -2
  51. data/lib/bleumi_pay_sdk_ruby/models/{network_balance.rb → ethereum_balance.rb} +13 -46
  52. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +2 -2
  53. data/lib/bleumi_pay_sdk_ruby/models/paginated_payments.rb +2 -2
  54. data/lib/bleumi_pay_sdk_ruby/models/paginated_payout_items.rb +2 -2
  55. data/lib/bleumi_pay_sdk_ruby/models/payment.rb +2 -2
  56. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +17 -6
  57. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +15 -6
  58. data/lib/bleumi_pay_sdk_ruby/models/payment_operation.rb +4 -3
  59. data/lib/bleumi_pay_sdk_ruby/models/payment_operation_inputs.rb +3 -3
  60. data/lib/bleumi_pay_sdk_ruby/models/payment_operation_response.rb +2 -2
  61. data/lib/bleumi_pay_sdk_ruby/models/payment_refund_request.rb +3 -3
  62. data/lib/bleumi_pay_sdk_ruby/models/payment_settle_request.rb +3 -3
  63. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +16 -6
  64. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +2 -2
  65. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +2 -2
  66. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +2 -2
  67. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +2 -2
  68. data/lib/bleumi_pay_sdk_ruby/models/wallet_address.rb +2 -2
  69. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +2 -2
  70. data/lib/bleumi_pay_sdk_ruby/version.rb +3 -3
  71. data/py_create.rb +38 -0
  72. data/spec/api/payments_api_spec.rb +2 -2
  73. data/spec/models/algorand_balance_spec.rb +47 -0
  74. data/spec/models/ethereum_balance_spec.rb +59 -0
  75. metadata +14 -10
  76. data/docs/EthAddress.md +0 -13
  77. data/docs/NetworkBalance.md +0 -29
  78. data/docs/Token.md +0 -15
  79. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
@@ -98,7 +98,7 @@ describe 'PaymentsApi' do
98
98
  # @param id Unique identifier of the payment (specified during [Create a Payment](#createPayment))
99
99
  # @param payment_refund_request Request body - used to specify the token to refund.
100
100
  # @param [Hash] opts the optional parameters
101
- # @option opts [Chain] :chain Ethereum network in which payment is to be created.
101
+ # @option opts [Chain] :chain network in which payment is to be created.
102
102
  # @return [PaymentOperationResponse]
103
103
  describe 'refund_payment test' do
104
104
  it 'should work' do
@@ -111,7 +111,7 @@ describe 'PaymentsApi' do
111
111
  # @param id Unique identifier of the payment (specified during [Create a Payment](#createPayment))
112
112
  # @param payment_settle_request Request body - used to specify the amount to settle.
113
113
  # @param [Hash] opts the optional parameters
114
- # @option opts [Chain] :chain Ethereum network in which payment is to be created.
114
+ # @option opts [Chain] :chain network in which payment is to be created.
115
115
  # @return [PaymentOperationResponse]
116
116
  describe 'settle_payment test' do
117
117
  it 'should work' do
@@ -0,0 +1,47 @@
1
+ =begin
2
+ #Bleumi Pay REST API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand 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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for BleumiPay::AlgorandBalance
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'AlgorandBalance' do
21
+ before do
22
+ # run before each test
23
+ @instance = BleumiPay::AlgorandBalance.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of AlgorandBalance' do
31
+ it 'should create an instance of AlgorandBalance' do
32
+ expect(@instance).to be_instance_of(BleumiPay::AlgorandBalance)
33
+ end
34
+ end
35
+ describe 'test attribute "alg_mainnet"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "alg_testnet"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,59 @@
1
+ =begin
2
+ #Bleumi Pay REST API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand 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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for BleumiPay::EthereumBalance
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'EthereumBalance' do
21
+ before do
22
+ # run before each test
23
+ @instance = BleumiPay::EthereumBalance.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of EthereumBalance' do
31
+ it 'should create an instance of EthereumBalance' do
32
+ expect(@instance).to be_instance_of(BleumiPay::EthereumBalance)
33
+ end
34
+ end
35
+ describe 'test attribute "mainnet"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "goerli"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "xdai"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "xdai_testnet"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bleumi_pay_sdk_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bleumi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-09 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -70,8 +70,8 @@ dependencies:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.6'
73
- description: A simple and powerful REST API to integrate ERC20 payments into your
74
- business or application
73
+ description: A simple and powerful REST API to integrate Algorand, Ethereum, ERC-20
74
+ and xDai payments into your business or application
75
75
  email:
76
76
  - info@bleumi.com
77
77
  executables: []
@@ -83,6 +83,7 @@ files:
83
83
  - README.md
84
84
  - Rakefile
85
85
  - bleumi_pay_sdk_ruby.gemspec
86
+ - docs/AlgorandBalance.md
86
87
  - docs/BadRequest.md
87
88
  - docs/Chain.md
88
89
  - docs/CheckoutToken.md
@@ -92,9 +93,8 @@ files:
92
93
  - docs/CreatePaymentResponse.md
93
94
  - docs/CreatePayoutRequest.md
94
95
  - docs/CreatePayoutResponse.md
95
- - docs/EthAddress.md
96
+ - docs/EthereumBalance.md
96
97
  - docs/HostedCheckoutsApi.md
97
- - docs/NetworkBalance.md
98
98
  - docs/PaginatedPaymentOperations.md
99
99
  - docs/PaginatedPayments.md
100
100
  - docs/PaginatedPayoutItems.md
@@ -111,7 +111,6 @@ files:
111
111
  - docs/PayoutItem.md
112
112
  - docs/PayoutItemInputs.md
113
113
  - docs/PayoutsApi.md
114
- - docs/Token.md
115
114
  - docs/ValidateCheckoutRequest.md
116
115
  - docs/ValidateCheckoutResponse.md
117
116
  - docs/WalletAddress.md
@@ -120,9 +119,11 @@ files:
120
119
  - lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb
121
120
  - lib/bleumi_pay_sdk_ruby/api/payments_api.rb
122
121
  - lib/bleumi_pay_sdk_ruby/api/payouts_api.rb
122
+ - lib/bleumi_pay_sdk_ruby/api/request_validator.rb
123
123
  - lib/bleumi_pay_sdk_ruby/api_client.rb
124
124
  - lib/bleumi_pay_sdk_ruby/api_error.rb
125
125
  - lib/bleumi_pay_sdk_ruby/configuration.rb
126
+ - lib/bleumi_pay_sdk_ruby/models/algorand_balance.rb
126
127
  - lib/bleumi_pay_sdk_ruby/models/bad_request.rb
127
128
  - lib/bleumi_pay_sdk_ruby/models/chain.rb
128
129
  - lib/bleumi_pay_sdk_ruby/models/checkout_token.rb
@@ -132,8 +133,7 @@ files:
132
133
  - lib/bleumi_pay_sdk_ruby/models/create_payment_response.rb
133
134
  - lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb
134
135
  - lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb
135
- - lib/bleumi_pay_sdk_ruby/models/eth_address.rb
136
- - lib/bleumi_pay_sdk_ruby/models/network_balance.rb
136
+ - lib/bleumi_pay_sdk_ruby/models/ethereum_balance.rb
137
137
  - lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb
138
138
  - lib/bleumi_pay_sdk_ruby/models/paginated_payments.rb
139
139
  - lib/bleumi_pay_sdk_ruby/models/paginated_payout_items.rb
@@ -148,17 +148,18 @@ files:
148
148
  - lib/bleumi_pay_sdk_ruby/models/payout.rb
149
149
  - lib/bleumi_pay_sdk_ruby/models/payout_item.rb
150
150
  - lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb
151
- - lib/bleumi_pay_sdk_ruby/models/token.rb
152
151
  - lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb
153
152
  - lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb
154
153
  - lib/bleumi_pay_sdk_ruby/models/wallet_address.rb
155
154
  - lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb
156
155
  - lib/bleumi_pay_sdk_ruby/version.rb
156
+ - py_create.rb
157
157
  - spec/api/hosted_checkouts_api_spec.rb
158
158
  - spec/api/payments_api_spec.rb
159
159
  - spec/api/payouts_api_spec.rb
160
160
  - spec/api_client_spec.rb
161
161
  - spec/configuration_spec.rb
162
+ - spec/models/algorand_balance_spec.rb
162
163
  - spec/models/bad_request_spec.rb
163
164
  - spec/models/chain_spec.rb
164
165
  - spec/models/checkout_token_spec.rb
@@ -169,6 +170,7 @@ files:
169
170
  - spec/models/create_payout_request_spec.rb
170
171
  - spec/models/create_payout_response_spec.rb
171
172
  - spec/models/eth_address_spec.rb
173
+ - spec/models/ethereum_balance_spec.rb
172
174
  - spec/models/network_balance_spec.rb
173
175
  - spec/models/paginated_payment_operations_spec.rb
174
176
  - spec/models/paginated_payments_spec.rb
@@ -230,6 +232,8 @@ test_files:
230
232
  - spec/models/payout_item_inputs_spec.rb
231
233
  - spec/models/network_balance_spec.rb
232
234
  - spec/models/payment_operation_spec.rb
235
+ - spec/models/algorand_balance_spec.rb
236
+ - spec/models/ethereum_balance_spec.rb
233
237
  - spec/models/wallet_address_spec.rb
234
238
  - spec/models/wallet_balance_spec.rb
235
239
  - spec/models/create_payout_request_spec.rb
@@ -1,13 +0,0 @@
1
- # BleumiPay::EthAddress
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **addr** | **String** | Valid Ethereum address string should pass validation pattern: '^0x[a-fA-F0-9]{40}$' |
8
-
9
- ## Example
10
-
11
- ```json
12
- 0x13e4ACeFE6a6700604929946E70E6443E4E73447
13
- ```
@@ -1,29 +0,0 @@
1
- # BleumiPay::NetworkBalance
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **mainnet** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in MainNet | [optional]
8
- **xdai** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in xDAI | [optional]
9
- **goerli** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in Goerli TestNet | [optional]
10
- **kovan** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in Kovan TestNet | [optional]
11
- **rinkeby** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in Rinkeby TestNet | [optional]
12
- **ropsten** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in Ropsten TestNet | [optional]
13
- **xdai_testnet** | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in xDAI TestNet | [optional]
14
-
15
- ## Example
16
-
17
- ```json
18
- {
19
- "xdai_testnet": {
20
- "XDAIT": {
21
- "balance": "1",
22
- "token_decimals": 15,
23
- "blockNum": "1698324",
24
- "token_balance": "1000000000000000"
25
- }
26
- }
27
- }
28
-
29
- ```
@@ -1,15 +0,0 @@
1
- # BleumiPay::Token
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **addr** | **String** | <b>ETH</b> - for Ethereum <br/> <b>XDAI</b> - for xDai <br/> <b>XDAIT</b> - for xDai Testnet <br/> <b> &lt;contract address of ERC-20 token&gt;</b> - for ERC-20 Tokens |
8
-
9
- ## Example
10
-
11
- ```json
12
- {
13
- "addr": "0x84df8548086ec9025e9c93297058bed706e90ddd"
14
- }
15
- ```
@@ -1,208 +0,0 @@
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 EthAddress
17
- # Valid Ethereum address string should pass validation pattern
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
- def eth_address?(str)
35
- # We use !! to convert the return value to a boolean
36
- !!(str =~ /^0x[a-fA-F0-9]{40}$/)
37
- end
38
-
39
- # Initializes the object
40
- # @param [Hash] attributes Model attributes in the form of hash
41
- def initialize(value)
42
-
43
- if (!eth_address?(value))
44
- fail ArgumentError, "`#{value}` The input argument must be valid Ethereum Address `BleumiPay::EthAddress` initialize method"
45
- end
46
-
47
- self.addr = value
48
-
49
- end
50
-
51
- # validation for updating addr using setter of addr
52
- def addr=(new_addr)
53
- if (!eth_address?(new_addr))
54
- fail ArgumentError, "`#{new_addr}` The input argument must be valid Ethereum Address `BleumiPay::EthAddress` initialize method"
55
- end
56
- @addr = new_addr
57
- end
58
-
59
- # Show invalid properties with the reasons. Usually used together with valid?
60
- # @return Array for valid properties with the reasons
61
- def list_invalid_properties
62
- invalid_properties = Array.new
63
- if @addr.nil?
64
- invalid_properties.push('invalid value for "addr", addr cannot be nil.')
65
- end
66
-
67
- invalid_properties
68
- end
69
-
70
- # Check to see if the all the properties in the model are valid
71
- # @return true if the model is valid
72
- def valid?
73
- return false if @addr.nil?
74
- true
75
- end
76
-
77
- # Checks equality by comparing each attribute.
78
- # @param [Object] Object to be compared
79
- def ==(o)
80
- return true if self.equal?(o)
81
- self.class == o.class &&
82
- addr == o.addr
83
- end
84
-
85
- # @see the `==` method
86
- # @param [Object] Object to be compared
87
- def eql?(o)
88
- self == o
89
- end
90
-
91
- # Calculates hash code according to all attributes.
92
- # @return [Integer] Hash code
93
- def hash
94
- [addr].hash
95
- end
96
-
97
- # Builds the object from hash
98
- # @param [Hash] attributes Model attributes in the form of hash
99
- # @return [Object] Returns the model itself
100
- def self.build_from_hash(attributes)
101
- new.build_from_hash(attributes)
102
- end
103
-
104
- # Builds the object from hash
105
- # @param [Hash] attributes Model attributes in the form of hash
106
- # @return [Object] Returns the model itself
107
- def build_from_hash(attributes)
108
- return nil unless attributes.is_a?(Hash)
109
- self.class.openapi_types.each_pair do |key, type|
110
- if type =~ /\AArray<(.*)>/i
111
- # check to ensure the input is an array given that the attribute
112
- # is documented as an array but the input is not
113
- if attributes[self.class.attribute_map[key]].is_a?(Array)
114
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
115
- end
116
- elsif !attributes[self.class.attribute_map[key]].nil?
117
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
- end # or else data not found in attributes(hash), not an issue as the data can be optional
119
- end
120
-
121
- self
122
- end
123
-
124
- # Deserializes the data based on type
125
- # @param string type Data type
126
- # @param string value Value to be deserialized
127
- # @return [Object] Deserialized data
128
- def _deserialize(type, value)
129
- case type.to_sym
130
- when :DateTime
131
- DateTime.parse(value)
132
- when :Date
133
- Date.parse(value)
134
- when :String
135
- value.to_s
136
- when :Integer
137
- value.to_i
138
- when :Float
139
- value.to_f
140
- when :Boolean
141
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
- true
143
- else
144
- false
145
- end
146
- when :Object
147
- # generic object (usually a Hash), return directly
148
- value
149
- when /\AArray<(?<inner_type>.+)>\z/
150
- inner_type = Regexp.last_match[:inner_type]
151
- value.map { |v| _deserialize(inner_type, v) }
152
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
- k_type = Regexp.last_match[:k_type]
154
- v_type = Regexp.last_match[:v_type]
155
- {}.tap do |hash|
156
- value.each do |k, v|
157
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
- end
159
- end
160
- else # model
161
- BleumiPay.const_get(type).build_from_hash(value)
162
- end
163
- end
164
-
165
- # Returns the string representation of the object
166
- # @return [String] String presentation of the object
167
- def to_s
168
- to_hash.to_s
169
- end
170
-
171
- # to_body is an alias to to_hash (backward compatibility)
172
- # @return [Hash] Returns the object in the form of hash
173
- def to_body
174
- to_hash
175
- end
176
-
177
- # Returns the object in the form of hash
178
- # @return [Hash] Returns the object in the form of hash
179
- def to_hash
180
- # hash = {}
181
- # self.class.attribute_map.each_pair do |attr, param|
182
- # value = self.send(attr)
183
- # next if value.nil?
184
- # hash[param] = _to_hash(value)
185
- # end
186
- # hash
187
- addr
188
- end
189
-
190
- # Outputs non-array value in the form of hash
191
- # For object, use to_hash. Otherwise, just return the value
192
- # @param [Object] value Any valid value
193
- # @return [Hash] Returns the value in the form of hash
194
- def _to_hash(value)
195
- if value.is_a?(Array)
196
- value.compact.map { |v| _to_hash(v) }
197
- elsif value.is_a?(Hash)
198
- {}.tap do |hash|
199
- value.each { |k, v| hash[k] = _to_hash(v) }
200
- end
201
- elsif value.respond_to? :to_hash
202
- value.to_hash
203
- else
204
- value
205
- end
206
- end
207
- end
208
- end