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,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class InvoiceRefundParams
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::InvoiceRefundParams',
10
+ attribute_map: {
11
+ 'address': :address
12
+ },
13
+ types: {
14
+ 'address': :String
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
+ # External wallet address. If not specified, the refund will be performed to your cryptocurrency account
27
+ def address
28
+ @attributes[:address]
29
+ end
30
+
31
+ # Show invalid properties with the reasons. Usually used together with valid?
32
+ # @return Array for valid properties with the reasons
33
+ def invalid_properties
34
+ []
35
+ end
36
+
37
+ # Check to see if the all the properties in the model are valid
38
+ # @return true if the model is valid
39
+ def valid?
40
+ invalid_properties.empty?
41
+ end
42
+
43
+ # Builds the object from hash
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ # @return [Cryptopay::InvoiceRefundParams] Returns the model itself
46
+ def self.build_from_hash(data)
47
+ attributes = ENCODER.build_from_hash(data)
48
+ new(attributes)
49
+ end
50
+
51
+ # Returns the object in the form of hash
52
+ # @return [Hash] Returns the object in the form of hash
53
+ def to_hash
54
+ ENCODER.to_hash(@attributes)
55
+ end
56
+
57
+ def inspect
58
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
59
+ end
60
+ end
61
+ 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 InvoiceRefundResult
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::InvoiceRefundResult',
10
+ attribute_map: {
11
+ 'data': :data
12
+ },
13
+ types: {
14
+ 'data': :InvoiceRefund
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::InvoiceRefundResult] 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,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class InvoiceResult
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::InvoiceResult',
10
+ attribute_map: {
11
+ 'data': :data
12
+ },
13
+ types: {
14
+ 'data': :Invoice
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::InvoiceResult] 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 InvoiceStatus
8
+ NEW = 'new'
9
+ COMPLETED = 'completed'
10
+ UNRESOLVED = 'unresolved'
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,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ module InvoiceStatusContext
8
+ OVERPAID = 'overpaid'
9
+ UNDERPAID = 'underpaid'
10
+ PAID_LATE = 'paid_late'
11
+ ILLICIT_RESOURCE = 'illicit_resource'
12
+
13
+ # Builds the enum from string
14
+ # @param [String] The enum value in the form of the string
15
+ # @return [String] The enum value
16
+ def self.build_from_hash(value)
17
+ value
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ # Cryptocurrency transaction hash and its risk level details
8
+ class InvoiceTransaction
9
+ ENCODER = Encoder.new(
10
+ name: 'Cryptopay::InvoiceTransaction',
11
+ attribute_map: {
12
+ 'txid': :txid,
13
+ 'risk': :risk
14
+ },
15
+ types: {
16
+ 'txid': :String,
17
+ 'risk': :Risk
18
+ },
19
+ nullables: []
20
+ )
21
+ private_constant :ENCODER
22
+
23
+ # Initializes the object
24
+ # @param [Hash] attributes Model attributes in the form of hash
25
+ def initialize(attributes = {})
26
+ @attributes = ENCODER.sanitize(attributes)
27
+ end
28
+
29
+ # Transaction hash
30
+ def txid
31
+ @attributes[:txid]
32
+ end
33
+
34
+ def risk
35
+ @attributes[:risk]
36
+ end
37
+
38
+ # Show invalid properties with the reasons. Usually used together with valid?
39
+ # @return Array for valid properties with the reasons
40
+ def invalid_properties
41
+ properties = []
42
+
43
+ properties.push('invalid value for "txid", txid cannot be nil.') if txid.nil?
44
+
45
+ risk&.invalid_properties&.each do |prop|
46
+ properties.push("invalid value for \"risk\": #{prop}")
47
+ end
48
+
49
+ properties
50
+ end
51
+
52
+ # Check to see if the all the properties in the model are valid
53
+ # @return true if the model is valid
54
+ def valid?
55
+ invalid_properties.empty?
56
+ end
57
+
58
+ # Builds the object from hash
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ # @return [Cryptopay::InvoiceTransaction] Returns the model itself
61
+ def self.build_from_hash(data)
62
+ attributes = ENCODER.build_from_hash(data)
63
+ new(attributes)
64
+ end
65
+
66
+ # Returns the object in the form of hash
67
+ # @return [Hash] Returns the object in the form of hash
68
+ def to_hash
69
+ ENCODER.to_hash(@attributes)
70
+ end
71
+
72
+ def inspect
73
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class NetworkFee
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::NetworkFee',
10
+ attribute_map: {
11
+ 'level': :level,
12
+ 'fee': :fee,
13
+ 'currency': :currency
14
+ },
15
+ types: {
16
+ 'level': :NetworkFeeLevel,
17
+ 'fee': :Decimal,
18
+ 'currency': :String
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 level
31
+ @attributes[:level]
32
+ end
33
+
34
+ def fee
35
+ @attributes[:fee]
36
+ end
37
+
38
+ def currency
39
+ @attributes[:currency]
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 "level", level cannot be nil.') if level.nil?
48
+
49
+ if !level.nil? && !%w[fast average slow].include?(level)
50
+ properties.push('invalid value for level, must be one of "fast", "average", "slow"')
51
+ end
52
+
53
+ properties.push('invalid value for "fee", fee cannot be nil.') if fee.nil?
54
+
55
+ properties.push('invalid value for "currency", currency cannot be nil.') if currency.nil?
56
+
57
+ properties
58
+ end
59
+
60
+ # Check to see if the all the properties in the model are valid
61
+ # @return true if the model is valid
62
+ def valid?
63
+ invalid_properties.empty?
64
+ end
65
+
66
+ # Builds the object from hash
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ # @return [Cryptopay::NetworkFee] Returns the model itself
69
+ def self.build_from_hash(data)
70
+ attributes = ENCODER.build_from_hash(data)
71
+ new(attributes)
72
+ end
73
+
74
+ # Returns the object in the form of hash
75
+ # @return [Hash] Returns the object in the form of hash
76
+ def to_hash
77
+ ENCODER.to_hash(@attributes)
78
+ end
79
+
80
+ def inspect
81
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ module NetworkFeeLevel
8
+ FAST = 'fast'
9
+ AVERAGE = 'average'
10
+ SLOW = 'slow'
11
+
12
+ # Builds the enum from string
13
+ # @param [String] The enum value in the form of the string
14
+ # @return [String] The enum value
15
+ def self.build_from_hash(value)
16
+ value
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class NetworkFeeListResult
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::NetworkFeeListResult',
10
+ attribute_map: {
11
+ 'data': :data
12
+ },
13
+ types: {
14
+ 'data': :'Array<NetworkFee>'
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&.each_with_index do |item, index|
38
+ item.invalid_properties.each do |prop|
39
+ properties.push("invalid value for \"data.#{index}\": #{prop}")
40
+ end
41
+ end
42
+
43
+ properties
44
+ end
45
+
46
+ # Check to see if the all the properties in the model are valid
47
+ # @return true if the model is valid
48
+ def valid?
49
+ invalid_properties.empty?
50
+ end
51
+
52
+ # Builds the object from hash
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ # @return [Cryptopay::NetworkFeeListResult] Returns the model itself
55
+ def self.build_from_hash(data)
56
+ attributes = ENCODER.build_from_hash(data)
57
+ new(attributes)
58
+ end
59
+
60
+ # Returns the object in the form of hash
61
+ # @return [Hash] Returns the object in the form of hash
62
+ def to_hash
63
+ ENCODER.to_hash(@attributes)
64
+ end
65
+
66
+ def inspect
67
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class Pagination
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::Pagination',
10
+ attribute_map: {
11
+ 'total': :total,
12
+ 'has_more': :has_more
13
+ },
14
+ types: {
15
+ 'total': :Integer,
16
+ 'has_more': :Boolean
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 total
29
+ @attributes[:total]
30
+ end
31
+
32
+ def has_more
33
+ @attributes[:has_more]
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 "total", total cannot be nil.') if total.nil?
42
+
43
+ properties.push('invalid value for "has_more", has_more cannot be nil.') if has_more.nil?
44
+
45
+ properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ invalid_properties.empty?
52
+ end
53
+
54
+ # Builds the object from hash
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ # @return [Cryptopay::Pagination] Returns the model itself
57
+ def self.build_from_hash(data)
58
+ attributes = ENCODER.build_from_hash(data)
59
+ new(attributes)
60
+ end
61
+
62
+ # Returns the object in the form of hash
63
+ # @return [Hash] Returns the object in the form of hash
64
+ def to_hash
65
+ ENCODER.to_hash(@attributes)
66
+ end
67
+
68
+ def inspect
69
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class Rate
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::Rate',
10
+ attribute_map: {
11
+ 'buy_rate': :buy_rate,
12
+ 'sell_rate': :sell_rate
13
+ },
14
+ types: {
15
+ 'buy_rate': :Decimal,
16
+ 'sell_rate': :Decimal
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
+ # Buy rate
29
+ def buy_rate
30
+ @attributes[:buy_rate]
31
+ end
32
+
33
+ # Buy rate
34
+ def sell_rate
35
+ @attributes[:sell_rate]
36
+ end
37
+
38
+ # Show invalid properties with the reasons. Usually used together with valid?
39
+ # @return Array for valid properties with the reasons
40
+ def invalid_properties
41
+ properties = []
42
+
43
+ properties.push('invalid value for "buy_rate", buy_rate cannot be nil.') if buy_rate.nil?
44
+
45
+ properties.push('invalid value for "sell_rate", sell_rate cannot be nil.') if sell_rate.nil?
46
+
47
+ properties
48
+ end
49
+
50
+ # Check to see if the all the properties in the model are valid
51
+ # @return true if the model is valid
52
+ def valid?
53
+ invalid_properties.empty?
54
+ end
55
+
56
+ # Builds the object from hash
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ # @return [Cryptopay::Rate] Returns the model itself
59
+ def self.build_from_hash(data)
60
+ attributes = ENCODER.build_from_hash(data)
61
+ new(attributes)
62
+ end
63
+
64
+ # Returns the object in the form of hash
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_hash
67
+ ENCODER.to_hash(@attributes)
68
+ end
69
+
70
+ def inspect
71
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
72
+ end
73
+ end
74
+ 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 RateResult
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::RateResult',
10
+ attribute_map: {
11
+ 'data': :data
12
+ },
13
+ types: {
14
+ 'data': :Rate
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::RateResult] 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