cryptopay-ruby 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -12
  3. data/cryptopay.gemspec +7 -7
  4. data/lib/cryptopay/api/coin_withdrawals.rb +7 -2
  5. data/lib/cryptopay/api/coins.rb +30 -0
  6. data/lib/cryptopay/client.rb +3 -1
  7. data/lib/cryptopay/models/account.rb +4 -0
  8. data/lib/cryptopay/models/account_list_result.rb +14 -2
  9. data/lib/cryptopay/models/channel.rb +20 -0
  10. data/lib/cryptopay/models/channel_params.rb +11 -0
  11. data/lib/cryptopay/models/channel_payment.rb +20 -0
  12. data/lib/cryptopay/models/channel_payment_callback.rb +0 -4
  13. data/lib/cryptopay/models/channel_update_params.rb +2 -0
  14. data/lib/cryptopay/models/channels_config.rb +64 -0
  15. data/lib/cryptopay/models/coin.rb +94 -0
  16. data/lib/cryptopay/models/coin_destination_tag.rb +72 -0
  17. data/lib/cryptopay/models/coin_list_result.rb +70 -0
  18. data/lib/cryptopay/models/coin_network.rb +128 -0
  19. data/lib/cryptopay/models/coin_withdrawal.rb +20 -0
  20. data/lib/cryptopay/models/coin_withdrawal_callback.rb +0 -4
  21. data/lib/cryptopay/models/coin_withdrawal_params.rb +14 -1
  22. data/lib/cryptopay/models/coin_withdrawals_config.rb +64 -0
  23. data/lib/cryptopay/models/customer.rb +3 -1
  24. data/lib/cryptopay/models/customer_params.rb +2 -2
  25. data/lib/cryptopay/models/customer_update_params.rb +2 -2
  26. data/lib/cryptopay/models/exchange_transfer.rb +6 -0
  27. data/lib/cryptopay/models/exchange_transfer_params.rb +6 -0
  28. data/lib/cryptopay/models/invoice.rb +10 -1
  29. data/lib/cryptopay/models/invoice_callback.rb +0 -2
  30. data/lib/cryptopay/models/invoice_params.rb +8 -1
  31. data/lib/cryptopay/models/invoice_recalculation_params.rb +1 -1
  32. data/lib/cryptopay/models/invoice_refund.rb +9 -0
  33. data/lib/cryptopay/models/invoices_config.rb +64 -0
  34. data/lib/cryptopay/models/network_fee.rb +10 -2
  35. data/lib/cryptopay/models/risk_params.rb +1 -1
  36. data/lib/cryptopay/models/risk_type.rb +18 -0
  37. data/lib/cryptopay/models/transaction.rb +13 -0
  38. data/lib/cryptopay/require.rb +9 -0
  39. data/lib/cryptopay/version.rb +1 -1
  40. metadata +39 -30
@@ -11,6 +11,7 @@ module Cryptopay
11
11
  'price_amount': :price_amount,
12
12
  'price_currency': :price_currency,
13
13
  'pay_currency': :pay_currency,
14
+ 'network': :network,
14
15
  'custom_id': :custom_id,
15
16
  'customer_id': :customer_id,
16
17
  'name': :name,
@@ -23,11 +24,12 @@ module Cryptopay
23
24
  'price_amount': :Decimal,
24
25
  'price_currency': :String,
25
26
  'pay_currency': :String,
27
+ 'network': :String,
26
28
  'custom_id': :String,
27
29
  'customer_id': :String,
28
30
  'name': :String,
29
31
  'description': :String,
30
- 'metadata': :Object,
32
+ 'metadata': :'Hash<String, String>',
31
33
  'success_redirect_url': :String,
32
34
  'unsuccess_redirect_url': :String
33
35
  },
@@ -56,6 +58,11 @@ module Cryptopay
56
58
  @attributes[:pay_currency]
57
59
  end
58
60
 
61
+ # Cryptocurrency network
62
+ def network
63
+ @attributes[:network]
64
+ end
65
+
59
66
  # The payment reference ID in your system
60
67
  def custom_id
61
68
  @attributes[:custom_id]
@@ -23,7 +23,7 @@ module Cryptopay
23
23
  @attributes = ENCODER.sanitize(attributes)
24
24
  end
25
25
 
26
- # Set `true` by default. Set `false` for two-step recalculation and commit it within 30 seconds
26
+ # Is `false` if omitted. Set `true` to turn off two-step recalculation. Set `false` for two-step recalculation and commit it within 30 seconds
27
27
  def force_commit
28
28
  @attributes[:force_commit]
29
29
  end
@@ -16,6 +16,7 @@ module Cryptopay
16
16
  'fee': :fee,
17
17
  'fee_currency': :fee_currency,
18
18
  'address': :address,
19
+ 'network': :network,
19
20
  'txid': :txid,
20
21
  'risk': :risk,
21
22
  'created_at': :created_at
@@ -29,6 +30,7 @@ module Cryptopay
29
30
  'fee': :Decimal,
30
31
  'fee_currency': :String,
31
32
  'address': :String,
33
+ 'network': :String,
32
34
  'txid': :String,
33
35
  'risk': :Risk,
34
36
  'created_at': :Time
@@ -87,6 +89,11 @@ module Cryptopay
87
89
  @attributes[:address]
88
90
  end
89
91
 
92
+ # Cryptocurrency network
93
+ def network
94
+ @attributes[:network]
95
+ end
96
+
90
97
  # Cryptocurrency transaction ID on the blockchain
91
98
  def txid
92
99
  @attributes[:txid]
@@ -118,6 +125,8 @@ module Cryptopay
118
125
 
119
126
  properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil?
120
127
 
128
+ properties.push('invalid value for "network", network cannot be nil.') if network.nil?
129
+
121
130
  risk&.invalid_properties&.each do |prop|
122
131
  properties.push("invalid value for \"risk\": #{prop}")
123
132
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class InvoicesConfig
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::InvoicesConfig',
10
+ attribute_map: {
11
+ 'enabled': :enabled
12
+ },
13
+ types: {
14
+ 'enabled': :Boolean
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 enabled
27
+ @attributes[:enabled]
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 "enabled", enabled cannot be nil.') if enabled.nil?
36
+
37
+ properties
38
+ end
39
+
40
+ # Check to see if the all the properties in the model are valid
41
+ # @return true if the model is valid
42
+ def valid?
43
+ invalid_properties.empty?
44
+ end
45
+
46
+ # Builds the object from hash
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ # @return [Cryptopay::InvoicesConfig] Returns the model itself
49
+ def self.build_from_hash(data)
50
+ attributes = ENCODER.build_from_hash(data)
51
+ new(attributes)
52
+ end
53
+
54
+ # Returns the object in the form of hash
55
+ # @return [Hash] Returns the object in the form of hash
56
+ def to_hash
57
+ ENCODER.to_hash(@attributes)
58
+ end
59
+
60
+ def inspect
61
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
62
+ end
63
+ end
64
+ end
@@ -10,12 +10,14 @@ module Cryptopay
10
10
  attribute_map: {
11
11
  'level': :level,
12
12
  'fee': :fee,
13
- 'currency': :currency
13
+ 'currency': :currency,
14
+ 'network': :network
14
15
  },
15
16
  types: {
16
17
  'level': :NetworkFeeLevel,
17
18
  'fee': :Decimal,
18
- 'currency': :String
19
+ 'currency': :String,
20
+ 'network': :String
19
21
  },
20
22
  nullables: []
21
23
  )
@@ -39,6 +41,10 @@ module Cryptopay
39
41
  @attributes[:currency]
40
42
  end
41
43
 
44
+ def network
45
+ @attributes[:network]
46
+ end
47
+
42
48
  # Show invalid properties with the reasons. Usually used together with valid?
43
49
  # @return Array for valid properties with the reasons
44
50
  def invalid_properties
@@ -54,6 +60,8 @@ module Cryptopay
54
60
 
55
61
  properties.push('invalid value for "currency", currency cannot be nil.') if currency.nil?
56
62
 
63
+ properties.push('invalid value for "network", network cannot be nil.') if network.nil?
64
+
57
65
  properties
58
66
  end
59
67
 
@@ -15,7 +15,7 @@ module Cryptopay
15
15
  types: {
16
16
  'address': :String,
17
17
  'currency': :String,
18
- 'type': :String
18
+ 'type': :RiskType
19
19
  },
20
20
  nullables: []
21
21
  )
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ module RiskType
8
+ SOURCE_OF_FUNDS = 'source_of_funds'
9
+ DESTINATION_OF_FUNDS = 'destination_of_funds'
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
@@ -57,38 +57,47 @@ module Cryptopay
57
57
  @attributes = ENCODER.sanitize(attributes)
58
58
  end
59
59
 
60
+ # Account transaction ID
60
61
  def id
61
62
  @attributes[:id]
62
63
  end
63
64
 
65
+ # Transaction description
64
66
  def custom_id
65
67
  @attributes[:custom_id]
66
68
  end
67
69
 
70
+ # The reference ID of your customer
68
71
  def customer_id
69
72
  @attributes[:customer_id]
70
73
  end
71
74
 
75
+ # Transaction amount
72
76
  def amount
73
77
  @attributes[:amount]
74
78
  end
75
79
 
80
+ # Transaction currency
76
81
  def currency
77
82
  @attributes[:currency]
78
83
  end
79
84
 
85
+ # Account subtotal
80
86
  def balance
81
87
  @attributes[:balance]
82
88
  end
83
89
 
90
+ # Transaction fee details
84
91
  def fee
85
92
  @attributes[:fee]
86
93
  end
87
94
 
95
+ # Transaction fee currency
88
96
  def fee_currency
89
97
  @attributes[:fee_currency]
90
98
  end
91
99
 
100
+ # Transaction reference ID in Cryptopay
92
101
  def reference_id
93
102
  @attributes[:reference_id]
94
103
  end
@@ -97,14 +106,17 @@ module Cryptopay
97
106
  @attributes[:reference_type]
98
107
  end
99
108
 
109
+ # Transaction description
100
110
  def description
101
111
  @attributes[:description]
102
112
  end
103
113
 
114
+ # Transaction status
104
115
  def status
105
116
  @attributes[:status]
106
117
  end
107
118
 
119
+ # Transaction status context
108
120
  def status_context
109
121
  @attributes[:status_context]
110
122
  end
@@ -113,6 +125,7 @@ module Cryptopay
113
125
  @attributes[:risk]
114
126
  end
115
127
 
128
+ # Transaction creation date and time
116
129
  def created_at
117
130
  @attributes[:created_at]
118
131
  end
@@ -20,6 +20,11 @@ require 'cryptopay/models/channel_payment_status_context'
20
20
  require 'cryptopay/models/channel_result'
21
21
  require 'cryptopay/models/channel_status'
22
22
  require 'cryptopay/models/channel_update_params'
23
+ require 'cryptopay/models/channels_config'
24
+ require 'cryptopay/models/coin'
25
+ require 'cryptopay/models/coin_destination_tag'
26
+ require 'cryptopay/models/coin_list_result'
27
+ require 'cryptopay/models/coin_network'
23
28
  require 'cryptopay/models/coin_withdrawal'
24
29
  require 'cryptopay/models/coin_withdrawal_callback'
25
30
  require 'cryptopay/models/coin_withdrawal_callback_event'
@@ -27,6 +32,7 @@ require 'cryptopay/models/coin_withdrawal_list_result'
27
32
  require 'cryptopay/models/coin_withdrawal_params'
28
33
  require 'cryptopay/models/coin_withdrawal_result'
29
34
  require 'cryptopay/models/coin_withdrawal_status'
35
+ require 'cryptopay/models/coin_withdrawals_config'
30
36
  require 'cryptopay/models/customer'
31
37
  require 'cryptopay/models/customer_list_result'
32
38
  require 'cryptopay/models/customer_params'
@@ -52,6 +58,7 @@ require 'cryptopay/models/invoice_result'
52
58
  require 'cryptopay/models/invoice_status'
53
59
  require 'cryptopay/models/invoice_status_context'
54
60
  require 'cryptopay/models/invoice_transaction'
61
+ require 'cryptopay/models/invoices_config'
55
62
  require 'cryptopay/models/network_fee'
56
63
  require 'cryptopay/models/network_fee_level'
57
64
  require 'cryptopay/models/network_fee_list_result'
@@ -63,6 +70,7 @@ require 'cryptopay/models/risk'
63
70
  require 'cryptopay/models/risk_level'
64
71
  require 'cryptopay/models/risk_params'
65
72
  require 'cryptopay/models/risk_result'
73
+ require 'cryptopay/models/risk_type'
66
74
  require 'cryptopay/models/transaction'
67
75
  require 'cryptopay/models/transaction_list_result'
68
76
  require 'cryptopay/models/transaction_reference_type'
@@ -71,6 +79,7 @@ require 'cryptopay/models/transaction_reference_type'
71
79
  require 'cryptopay/api/accounts'
72
80
  require 'cryptopay/api/channels'
73
81
  require 'cryptopay/api/coin_withdrawals'
82
+ require 'cryptopay/api/coins'
74
83
  require 'cryptopay/api/customers'
75
84
  require 'cryptopay/api/exchange_transfers'
76
85
  require 'cryptopay/api/invoices'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptopay
4
- VERSION = '0.1.0'
4
+ VERSION = '1.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptopay-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cryptopay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-17 00:00:00.000000000 Z
11
+ date: 2022-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -34,100 +34,100 @@ dependencies:
34
34
  name: dotenv
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '2.7'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '2.7'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pry-byebug
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '3.9'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '3.9'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '13.0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '13.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rspec
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '3.11'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: '3.11'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rubocop
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0'
95
+ version: '1.25'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0'
102
+ version: '1.25'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: vcr
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: '6.0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0'
116
+ version: '6.0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: webmock
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">="
121
+ - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0'
123
+ version: '3.14'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ">="
128
+ - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0'
130
+ version: '3.14'
131
131
  description: ''
132
132
  email: support@cryptopay.me
133
133
  executables: []
@@ -148,6 +148,7 @@ files:
148
148
  - lib/cryptopay/api/accounts.rb
149
149
  - lib/cryptopay/api/channels.rb
150
150
  - lib/cryptopay/api/coin_withdrawals.rb
151
+ - lib/cryptopay/api/coins.rb
151
152
  - lib/cryptopay/api/customers.rb
152
153
  - lib/cryptopay/api/exchange_transfers.rb
153
154
  - lib/cryptopay/api/invoices.rb
@@ -177,6 +178,11 @@ files:
177
178
  - lib/cryptopay/models/channel_result.rb
178
179
  - lib/cryptopay/models/channel_status.rb
179
180
  - lib/cryptopay/models/channel_update_params.rb
181
+ - lib/cryptopay/models/channels_config.rb
182
+ - lib/cryptopay/models/coin.rb
183
+ - lib/cryptopay/models/coin_destination_tag.rb
184
+ - lib/cryptopay/models/coin_list_result.rb
185
+ - lib/cryptopay/models/coin_network.rb
180
186
  - lib/cryptopay/models/coin_withdrawal.rb
181
187
  - lib/cryptopay/models/coin_withdrawal_callback.rb
182
188
  - lib/cryptopay/models/coin_withdrawal_callback_event.rb
@@ -184,6 +190,7 @@ files:
184
190
  - lib/cryptopay/models/coin_withdrawal_params.rb
185
191
  - lib/cryptopay/models/coin_withdrawal_result.rb
186
192
  - lib/cryptopay/models/coin_withdrawal_status.rb
193
+ - lib/cryptopay/models/coin_withdrawals_config.rb
187
194
  - lib/cryptopay/models/customer.rb
188
195
  - lib/cryptopay/models/customer_list_result.rb
189
196
  - lib/cryptopay/models/customer_params.rb
@@ -209,6 +216,7 @@ files:
209
216
  - lib/cryptopay/models/invoice_status.rb
210
217
  - lib/cryptopay/models/invoice_status_context.rb
211
218
  - lib/cryptopay/models/invoice_transaction.rb
219
+ - lib/cryptopay/models/invoices_config.rb
212
220
  - lib/cryptopay/models/network_fee.rb
213
221
  - lib/cryptopay/models/network_fee_level.rb
214
222
  - lib/cryptopay/models/network_fee_list_result.rb
@@ -220,6 +228,7 @@ files:
220
228
  - lib/cryptopay/models/risk_level.rb
221
229
  - lib/cryptopay/models/risk_params.rb
222
230
  - lib/cryptopay/models/risk_result.rb
231
+ - lib/cryptopay/models/risk_type.rb
223
232
  - lib/cryptopay/models/transaction.rb
224
233
  - lib/cryptopay/models/transaction_list_result.rb
225
234
  - lib/cryptopay/models/transaction_reference_type.rb