cryptopay-ruby 0.1.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.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +36 -0
- data/.gitignore +38 -0
- data/.rspec +2 -0
- data/.rubocop.yml +104 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +521 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/cryptopay.gemspec +40 -0
- data/lib/cryptopay/api/accounts.rb +51 -0
- data/lib/cryptopay/api/channels.rb +142 -0
- data/lib/cryptopay/api/coin_withdrawals.rb +115 -0
- data/lib/cryptopay/api/customers.rb +85 -0
- data/lib/cryptopay/api/exchange_transfers.rb +64 -0
- data/lib/cryptopay/api/invoices.rb +163 -0
- data/lib/cryptopay/api/rates.rb +50 -0
- data/lib/cryptopay/api/risks.rb +32 -0
- data/lib/cryptopay/api/transactions.rb +47 -0
- data/lib/cryptopay/authentication.rb +30 -0
- data/lib/cryptopay/callbacks.rb +38 -0
- data/lib/cryptopay/client.rb +39 -0
- data/lib/cryptopay/config.rb +48 -0
- data/lib/cryptopay/connection.rb +48 -0
- data/lib/cryptopay/encoder.rb +113 -0
- data/lib/cryptopay/errors.rb +32 -0
- data/lib/cryptopay/models/account.rb +88 -0
- data/lib/cryptopay/models/account_list_result.rb +70 -0
- data/lib/cryptopay/models/callback.rb +25 -0
- data/lib/cryptopay/models/channel.rb +156 -0
- data/lib/cryptopay/models/channel_list_result.rb +82 -0
- data/lib/cryptopay/models/channel_params.rb +102 -0
- data/lib/cryptopay/models/channel_payment.rb +216 -0
- data/lib/cryptopay/models/channel_payment_callback.rb +92 -0
- data/lib/cryptopay/models/channel_payment_callback_event.rb +21 -0
- data/lib/cryptopay/models/channel_payment_list_result.rb +82 -0
- data/lib/cryptopay/models/channel_payment_result.rb +68 -0
- data/lib/cryptopay/models/channel_payment_status.rb +21 -0
- data/lib/cryptopay/models/channel_payment_status_context.rb +18 -0
- data/lib/cryptopay/models/channel_result.rb +68 -0
- data/lib/cryptopay/models/channel_status.rb +18 -0
- data/lib/cryptopay/models/channel_update_params.rb +85 -0
- data/lib/cryptopay/models/coin_withdrawal.rb +205 -0
- data/lib/cryptopay/models/coin_withdrawal_callback.rb +92 -0
- data/lib/cryptopay/models/coin_withdrawal_callback_event.rb +18 -0
- data/lib/cryptopay/models/coin_withdrawal_list_result.rb +82 -0
- data/lib/cryptopay/models/coin_withdrawal_params.rb +135 -0
- data/lib/cryptopay/models/coin_withdrawal_result.rb +68 -0
- data/lib/cryptopay/models/coin_withdrawal_status.rb +24 -0
- data/lib/cryptopay/models/customer.rb +81 -0
- data/lib/cryptopay/models/customer_list_result.rb +82 -0
- data/lib/cryptopay/models/customer_params.rb +81 -0
- data/lib/cryptopay/models/customer_result.rb +68 -0
- data/lib/cryptopay/models/customer_update_params.rb +68 -0
- data/lib/cryptopay/models/exchange.rb +89 -0
- data/lib/cryptopay/models/exchange_transfer.rb +116 -0
- data/lib/cryptopay/models/exchange_transfer_params.rb +101 -0
- data/lib/cryptopay/models/exchange_transfer_result.rb +68 -0
- data/lib/cryptopay/models/invoice.rb +276 -0
- data/lib/cryptopay/models/invoice_callback.rb +90 -0
- data/lib/cryptopay/models/invoice_callback_event.rb +22 -0
- data/lib/cryptopay/models/invoice_list_result.rb +82 -0
- data/lib/cryptopay/models/invoice_params.rb +131 -0
- data/lib/cryptopay/models/invoice_recalculation.rb +178 -0
- data/lib/cryptopay/models/invoice_recalculation_params.rb +61 -0
- data/lib/cryptopay/models/invoice_recalculation_result.rb +68 -0
- data/lib/cryptopay/models/invoice_refund.rb +154 -0
- data/lib/cryptopay/models/invoice_refund_list_result.rb +70 -0
- data/lib/cryptopay/models/invoice_refund_params.rb +61 -0
- data/lib/cryptopay/models/invoice_refund_result.rb +68 -0
- data/lib/cryptopay/models/invoice_result.rb +68 -0
- data/lib/cryptopay/models/invoice_status.rb +21 -0
- data/lib/cryptopay/models/invoice_status_context.rb +20 -0
- data/lib/cryptopay/models/invoice_transaction.rb +76 -0
- data/lib/cryptopay/models/network_fee.rb +84 -0
- data/lib/cryptopay/models/network_fee_level.rb +19 -0
- data/lib/cryptopay/models/network_fee_list_result.rb +70 -0
- data/lib/cryptopay/models/pagination.rb +72 -0
- data/lib/cryptopay/models/rate.rb +74 -0
- data/lib/cryptopay/models/rate_result.rb +68 -0
- data/lib/cryptopay/models/rates_result.rb +64 -0
- data/lib/cryptopay/models/risk.rb +98 -0
- data/lib/cryptopay/models/risk_level.rb +19 -0
- data/lib/cryptopay/models/risk_params.rb +86 -0
- data/lib/cryptopay/models/risk_result.rb +68 -0
- data/lib/cryptopay/models/transaction.rb +174 -0
- data/lib/cryptopay/models/transaction_list_result.rb +82 -0
- data/lib/cryptopay/models/transaction_reference_type.rb +25 -0
- data/lib/cryptopay/request.rb +46 -0
- data/lib/cryptopay/require.rb +79 -0
- data/lib/cryptopay/types.rb +11 -0
- data/lib/cryptopay/version.rb +5 -0
- data/lib/cryptopay.rb +26 -0
- metadata +256 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class ChannelResult
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::ChannelResult',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'data': :data
|
|
12
|
+
},
|
|
13
|
+
types: {
|
|
14
|
+
'data': :Channel
|
|
15
|
+
},
|
|
16
|
+
nullables: []
|
|
17
|
+
)
|
|
18
|
+
private_constant :ENCODER
|
|
19
|
+
|
|
20
|
+
# Initializes the object
|
|
21
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
22
|
+
def initialize(attributes = {})
|
|
23
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def data
|
|
27
|
+
@attributes[:data]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
31
|
+
# @return Array for valid properties with the reasons
|
|
32
|
+
def invalid_properties
|
|
33
|
+
properties = []
|
|
34
|
+
|
|
35
|
+
properties.push('invalid value for "data", data cannot be nil.') if data.nil?
|
|
36
|
+
|
|
37
|
+
data&.invalid_properties&.each do |prop|
|
|
38
|
+
properties.push("invalid value for \"data\": #{prop}")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
properties
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Check to see if the all the properties in the model are valid
|
|
45
|
+
# @return true if the model is valid
|
|
46
|
+
def valid?
|
|
47
|
+
invalid_properties.empty?
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Builds the object from hash
|
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
52
|
+
# @return [Cryptopay::ChannelResult] Returns the model itself
|
|
53
|
+
def self.build_from_hash(data)
|
|
54
|
+
attributes = ENCODER.build_from_hash(data)
|
|
55
|
+
new(attributes)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns the object in the form of hash
|
|
59
|
+
# @return [Hash] Returns the object in the form of hash
|
|
60
|
+
def to_hash
|
|
61
|
+
ENCODER.to_hash(@attributes)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def inspect
|
|
65
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
module ChannelStatus
|
|
8
|
+
ENABLED = 'enabled'
|
|
9
|
+
DISABLED = 'disabled'
|
|
10
|
+
|
|
11
|
+
# Builds the enum from string
|
|
12
|
+
# @param [String] The enum value in the form of the string
|
|
13
|
+
# @return [String] The enum value
|
|
14
|
+
def self.build_from_hash(value)
|
|
15
|
+
value
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class ChannelUpdateParams
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::ChannelUpdateParams',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'name': :name,
|
|
12
|
+
'description': :description,
|
|
13
|
+
'status': :status,
|
|
14
|
+
'customer_id': :customer_id
|
|
15
|
+
},
|
|
16
|
+
types: {
|
|
17
|
+
'name': :String,
|
|
18
|
+
'description': :String,
|
|
19
|
+
'status': :ChannelStatus,
|
|
20
|
+
'customer_id': :String
|
|
21
|
+
},
|
|
22
|
+
nullables: []
|
|
23
|
+
)
|
|
24
|
+
private_constant :ENCODER
|
|
25
|
+
|
|
26
|
+
# Initializes the object
|
|
27
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
28
|
+
def initialize(attributes = {})
|
|
29
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def name
|
|
33
|
+
@attributes[:name]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def description
|
|
37
|
+
@attributes[:description]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def status
|
|
41
|
+
@attributes[:status]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# The internal ID of your customer that the channel relates to
|
|
45
|
+
def customer_id
|
|
46
|
+
@attributes[:customer_id]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
50
|
+
# @return Array for valid properties with the reasons
|
|
51
|
+
def invalid_properties
|
|
52
|
+
properties = []
|
|
53
|
+
|
|
54
|
+
if !status.nil? && !%w[enabled disabled].include?(status)
|
|
55
|
+
properties.push('invalid value for status, must be one of "enabled", "disabled"')
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
properties
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Check to see if the all the properties in the model are valid
|
|
62
|
+
# @return true if the model is valid
|
|
63
|
+
def valid?
|
|
64
|
+
invalid_properties.empty?
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Builds the object from hash
|
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
69
|
+
# @return [Cryptopay::ChannelUpdateParams] Returns the model itself
|
|
70
|
+
def self.build_from_hash(data)
|
|
71
|
+
attributes = ENCODER.build_from_hash(data)
|
|
72
|
+
new(attributes)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Returns the object in the form of hash
|
|
76
|
+
# @return [Hash] Returns the object in the form of hash
|
|
77
|
+
def to_hash
|
|
78
|
+
ENCODER.to_hash(@attributes)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def inspect
|
|
82
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class CoinWithdrawal
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::CoinWithdrawal',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'id': :id,
|
|
12
|
+
'custom_id': :custom_id,
|
|
13
|
+
'customer_id': :customer_id,
|
|
14
|
+
'address': :address,
|
|
15
|
+
'txid': :txid,
|
|
16
|
+
'status': :status,
|
|
17
|
+
'charged_amount': :charged_amount,
|
|
18
|
+
'charged_currency': :charged_currency,
|
|
19
|
+
'received_amount': :received_amount,
|
|
20
|
+
'received_currency': :received_currency,
|
|
21
|
+
'network_fee': :network_fee,
|
|
22
|
+
'network_fee_level': :network_fee_level,
|
|
23
|
+
'fee': :fee,
|
|
24
|
+
'fee_currency': :fee_currency,
|
|
25
|
+
'exchange': :exchange,
|
|
26
|
+
'risk': :risk,
|
|
27
|
+
'created_at': :created_at
|
|
28
|
+
},
|
|
29
|
+
types: {
|
|
30
|
+
'id': :String,
|
|
31
|
+
'custom_id': :String,
|
|
32
|
+
'customer_id': :String,
|
|
33
|
+
'address': :String,
|
|
34
|
+
'txid': :String,
|
|
35
|
+
'status': :CoinWithdrawalStatus,
|
|
36
|
+
'charged_amount': :Decimal,
|
|
37
|
+
'charged_currency': :String,
|
|
38
|
+
'received_amount': :Decimal,
|
|
39
|
+
'received_currency': :String,
|
|
40
|
+
'network_fee': :Decimal,
|
|
41
|
+
'network_fee_level': :NetworkFeeLevel,
|
|
42
|
+
'fee': :Decimal,
|
|
43
|
+
'fee_currency': :String,
|
|
44
|
+
'exchange': :Exchange,
|
|
45
|
+
'risk': :Risk,
|
|
46
|
+
'created_at': :Time
|
|
47
|
+
},
|
|
48
|
+
nullables: %i[
|
|
49
|
+
id
|
|
50
|
+
custom_id
|
|
51
|
+
customer_id
|
|
52
|
+
txid
|
|
53
|
+
]
|
|
54
|
+
)
|
|
55
|
+
private_constant :ENCODER
|
|
56
|
+
|
|
57
|
+
# Initializes the object
|
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
59
|
+
def initialize(attributes = {})
|
|
60
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def id
|
|
64
|
+
@attributes[:id]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def custom_id
|
|
68
|
+
@attributes[:custom_id]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def customer_id
|
|
72
|
+
@attributes[:customer_id]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def address
|
|
76
|
+
@attributes[:address]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def txid
|
|
80
|
+
@attributes[:txid]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def status
|
|
84
|
+
@attributes[:status]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def charged_amount
|
|
88
|
+
@attributes[:charged_amount]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def charged_currency
|
|
92
|
+
@attributes[:charged_currency]
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def received_amount
|
|
96
|
+
@attributes[:received_amount]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def received_currency
|
|
100
|
+
@attributes[:received_currency]
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def network_fee
|
|
104
|
+
@attributes[:network_fee]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def network_fee_level
|
|
108
|
+
@attributes[:network_fee_level]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def fee
|
|
112
|
+
@attributes[:fee]
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def fee_currency
|
|
116
|
+
@attributes[:fee_currency]
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def exchange
|
|
120
|
+
@attributes[:exchange]
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def risk
|
|
124
|
+
@attributes[:risk]
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def created_at
|
|
128
|
+
@attributes[:created_at]
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
132
|
+
# @return Array for valid properties with the reasons
|
|
133
|
+
def invalid_properties
|
|
134
|
+
properties = []
|
|
135
|
+
|
|
136
|
+
properties.push('invalid value for "address", address cannot be nil.') if address.nil?
|
|
137
|
+
|
|
138
|
+
properties.push('invalid value for "status", status cannot be nil.') if status.nil?
|
|
139
|
+
|
|
140
|
+
if !status.nil? && !%w[new pending on_hold processing sent completed failed cancelled].include?(status)
|
|
141
|
+
properties.push('invalid value for status, must be one of "new", "pending", "on_hold", "processing", "sent", "completed", "failed", "cancelled"')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
properties.push('invalid value for "charged_amount", charged_amount cannot be nil.') if charged_amount.nil?
|
|
145
|
+
|
|
146
|
+
properties.push('invalid value for "charged_currency", charged_currency cannot be nil.') if charged_currency.nil?
|
|
147
|
+
|
|
148
|
+
properties.push('invalid value for "received_amount", received_amount cannot be nil.') if received_amount.nil?
|
|
149
|
+
|
|
150
|
+
if received_currency.nil?
|
|
151
|
+
properties.push('invalid value for "received_currency", received_currency cannot be nil.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
properties.push('invalid value for "network_fee", network_fee cannot be nil.') if network_fee.nil?
|
|
155
|
+
|
|
156
|
+
if network_fee_level.nil?
|
|
157
|
+
properties.push('invalid value for "network_fee_level", network_fee_level cannot be nil.')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if !network_fee_level.nil? && !%w[fast average slow].include?(network_fee_level)
|
|
161
|
+
properties.push('invalid value for network_fee_level, must be one of "fast", "average", "slow"')
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
properties.push('invalid value for "fee", fee cannot be nil.') if fee.nil?
|
|
165
|
+
|
|
166
|
+
properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil?
|
|
167
|
+
|
|
168
|
+
exchange&.invalid_properties&.each do |prop|
|
|
169
|
+
properties.push("invalid value for \"exchange\": #{prop}")
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
risk&.invalid_properties&.each do |prop|
|
|
173
|
+
properties.push("invalid value for \"risk\": #{prop}")
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil?
|
|
177
|
+
|
|
178
|
+
properties
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Check to see if the all the properties in the model are valid
|
|
182
|
+
# @return true if the model is valid
|
|
183
|
+
def valid?
|
|
184
|
+
invalid_properties.empty?
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Builds the object from hash
|
|
188
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
189
|
+
# @return [Cryptopay::CoinWithdrawal] Returns the model itself
|
|
190
|
+
def self.build_from_hash(data)
|
|
191
|
+
attributes = ENCODER.build_from_hash(data)
|
|
192
|
+
new(attributes)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Returns the object in the form of hash
|
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
|
197
|
+
def to_hash
|
|
198
|
+
ENCODER.to_hash(@attributes)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def inspect
|
|
202
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class CoinWithdrawalCallback
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::CoinWithdrawalCallback',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'type': :type,
|
|
12
|
+
'event': :event,
|
|
13
|
+
'data': :data
|
|
14
|
+
},
|
|
15
|
+
types: {
|
|
16
|
+
'type': :String,
|
|
17
|
+
'event': :CoinWithdrawalCallbackEvent,
|
|
18
|
+
'data': :CoinWithdrawal
|
|
19
|
+
},
|
|
20
|
+
nullables: []
|
|
21
|
+
)
|
|
22
|
+
private_constant :ENCODER
|
|
23
|
+
|
|
24
|
+
# Initializes the object
|
|
25
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
26
|
+
def initialize(attributes = {})
|
|
27
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def type
|
|
31
|
+
@attributes[:type]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def event
|
|
35
|
+
@attributes[:event]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def data
|
|
39
|
+
@attributes[:data]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
43
|
+
# @return Array for valid properties with the reasons
|
|
44
|
+
def invalid_properties
|
|
45
|
+
properties = []
|
|
46
|
+
|
|
47
|
+
properties.push('invalid value for "type", type cannot be nil.') if type.nil?
|
|
48
|
+
|
|
49
|
+
if !type.nil? && !['CoinWithdrawal'].include?(type)
|
|
50
|
+
properties.push('invalid value for type, must be one of "CoinWithdrawal"')
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
properties.push('invalid value for "event", event cannot be nil.') if event.nil?
|
|
54
|
+
|
|
55
|
+
if !event.nil? && !%w[created status_changed].include?(event)
|
|
56
|
+
properties.push('invalid value for event, must be one of "created", "status_changed"')
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
properties.push('invalid value for "data", data cannot be nil.') if data.nil?
|
|
60
|
+
|
|
61
|
+
data&.invalid_properties&.each do |prop|
|
|
62
|
+
properties.push("invalid value for \"data\": #{prop}")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
properties
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Check to see if the all the properties in the model are valid
|
|
69
|
+
# @return true if the model is valid
|
|
70
|
+
def valid?
|
|
71
|
+
invalid_properties.empty?
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Builds the object from hash
|
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
76
|
+
# @return [Cryptopay::CoinWithdrawalCallback] Returns the model itself
|
|
77
|
+
def self.build_from_hash(data)
|
|
78
|
+
attributes = ENCODER.build_from_hash(data)
|
|
79
|
+
new(attributes)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Returns the object in the form of hash
|
|
83
|
+
# @return [Hash] Returns the object in the form of hash
|
|
84
|
+
def to_hash
|
|
85
|
+
ENCODER.to_hash(@attributes)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def inspect
|
|
89
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
module CoinWithdrawalCallbackEvent
|
|
8
|
+
CREATED = 'created'
|
|
9
|
+
STATUS_CHANGED = 'status_changed'
|
|
10
|
+
|
|
11
|
+
# Builds the enum from string
|
|
12
|
+
# @param [String] The enum value in the form of the string
|
|
13
|
+
# @return [String] The enum value
|
|
14
|
+
def self.build_from_hash(value)
|
|
15
|
+
value
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class CoinWithdrawalListResult
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::CoinWithdrawalListResult',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'data': :data,
|
|
12
|
+
'meta': :meta
|
|
13
|
+
},
|
|
14
|
+
types: {
|
|
15
|
+
'data': :'Array<CoinWithdrawal>',
|
|
16
|
+
'meta': :Pagination
|
|
17
|
+
},
|
|
18
|
+
nullables: []
|
|
19
|
+
)
|
|
20
|
+
private_constant :ENCODER
|
|
21
|
+
|
|
22
|
+
# Initializes the object
|
|
23
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
24
|
+
def initialize(attributes = {})
|
|
25
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def data
|
|
29
|
+
@attributes[:data]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def meta
|
|
33
|
+
@attributes[:meta]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
37
|
+
# @return Array for valid properties with the reasons
|
|
38
|
+
def invalid_properties
|
|
39
|
+
properties = []
|
|
40
|
+
|
|
41
|
+
properties.push('invalid value for "data", data cannot be nil.') if data.nil?
|
|
42
|
+
|
|
43
|
+
data&.each_with_index do |item, index|
|
|
44
|
+
item.invalid_properties.each do |prop|
|
|
45
|
+
properties.push("invalid value for \"data.#{index}\": #{prop}")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
properties.push('invalid value for "meta", meta cannot be nil.') if meta.nil?
|
|
50
|
+
|
|
51
|
+
meta&.invalid_properties&.each do |prop|
|
|
52
|
+
properties.push("invalid value for \"meta\": #{prop}")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
properties
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Check to see if the all the properties in the model are valid
|
|
59
|
+
# @return true if the model is valid
|
|
60
|
+
def valid?
|
|
61
|
+
invalid_properties.empty?
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Builds the object from hash
|
|
65
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
66
|
+
# @return [Cryptopay::CoinWithdrawalListResult] Returns the model itself
|
|
67
|
+
def self.build_from_hash(data)
|
|
68
|
+
attributes = ENCODER.build_from_hash(data)
|
|
69
|
+
new(attributes)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Returns the object in the form of hash
|
|
73
|
+
# @return [Hash] Returns the object in the form of hash
|
|
74
|
+
def to_hash
|
|
75
|
+
ENCODER.to_hash(@attributes)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def inspect
|
|
79
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class CoinWithdrawalParams
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::CoinWithdrawalParams',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'address': :address,
|
|
12
|
+
'charged_currency': :charged_currency,
|
|
13
|
+
'received_currency': :received_currency,
|
|
14
|
+
'charged_amount': :charged_amount,
|
|
15
|
+
'charged_amount_to_send': :charged_amount_to_send,
|
|
16
|
+
'received_amount': :received_amount,
|
|
17
|
+
'custom_id': :custom_id,
|
|
18
|
+
'customer_id': :customer_id,
|
|
19
|
+
'network_fee_level': :network_fee_level,
|
|
20
|
+
'force_commit': :force_commit
|
|
21
|
+
},
|
|
22
|
+
types: {
|
|
23
|
+
'address': :String,
|
|
24
|
+
'charged_currency': :String,
|
|
25
|
+
'received_currency': :String,
|
|
26
|
+
'charged_amount': :Decimal,
|
|
27
|
+
'charged_amount_to_send': :Decimal,
|
|
28
|
+
'received_amount': :Decimal,
|
|
29
|
+
'custom_id': :String,
|
|
30
|
+
'customer_id': :String,
|
|
31
|
+
'network_fee_level': :NetworkFeeLevel,
|
|
32
|
+
'force_commit': :Boolean
|
|
33
|
+
},
|
|
34
|
+
nullables: %i[
|
|
35
|
+
charged_amount
|
|
36
|
+
charged_amount_to_send
|
|
37
|
+
received_amount
|
|
38
|
+
]
|
|
39
|
+
)
|
|
40
|
+
private_constant :ENCODER
|
|
41
|
+
|
|
42
|
+
# Initializes the object
|
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
44
|
+
def initialize(attributes = {})
|
|
45
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def address
|
|
49
|
+
@attributes[:address]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def charged_currency
|
|
53
|
+
@attributes[:charged_currency]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def received_currency
|
|
57
|
+
@attributes[:received_currency]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def charged_amount
|
|
61
|
+
@attributes[:charged_amount]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def charged_amount_to_send
|
|
65
|
+
@attributes[:charged_amount_to_send]
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def received_amount
|
|
69
|
+
@attributes[:received_amount]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# The payment reference ID in your system
|
|
73
|
+
def custom_id
|
|
74
|
+
@attributes[:custom_id]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# The internal ID of your customer that the wihdrawal relates to
|
|
78
|
+
def customer_id
|
|
79
|
+
@attributes[:customer_id]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def network_fee_level
|
|
83
|
+
@attributes[:network_fee_level]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Set `true` by default. Set `false` for two-step withdrawal and commit it within 30 seconds
|
|
87
|
+
def force_commit
|
|
88
|
+
@attributes[:force_commit]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
92
|
+
# @return Array for valid properties with the reasons
|
|
93
|
+
def invalid_properties
|
|
94
|
+
properties = []
|
|
95
|
+
|
|
96
|
+
properties.push('invalid value for "address", address cannot be nil.') if address.nil?
|
|
97
|
+
|
|
98
|
+
properties.push('invalid value for "charged_currency", charged_currency cannot be nil.') if charged_currency.nil?
|
|
99
|
+
|
|
100
|
+
if received_currency.nil?
|
|
101
|
+
properties.push('invalid value for "received_currency", received_currency cannot be nil.')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if !network_fee_level.nil? && !%w[fast average slow].include?(network_fee_level)
|
|
105
|
+
properties.push('invalid value for network_fee_level, must be one of "fast", "average", "slow"')
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
properties
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Check to see if the all the properties in the model are valid
|
|
112
|
+
# @return true if the model is valid
|
|
113
|
+
def valid?
|
|
114
|
+
invalid_properties.empty?
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Builds the object from hash
|
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
119
|
+
# @return [Cryptopay::CoinWithdrawalParams] Returns the model itself
|
|
120
|
+
def self.build_from_hash(data)
|
|
121
|
+
attributes = ENCODER.build_from_hash(data)
|
|
122
|
+
new(attributes)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Returns the object in the form of hash
|
|
126
|
+
# @return [Hash] Returns the object in the form of hash
|
|
127
|
+
def to_hash
|
|
128
|
+
ENCODER.to_hash(@attributes)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def inspect
|
|
132
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|