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