Module: Coinpayments

Defined in:
lib/coinpayments.rb,
lib/coinpayments/version.rb,
lib/coinpayments/configuration.rb,
lib/generators/coinpayments/install_generator.rb

Defined Under Namespace

Classes: Configuration, InstallGenerator

Constant Summary collapse

VERSION =
"0.0.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configuration=(value) ⇒ Object

Sets the attribute configuration

Parameters:

  • value

    the value to set the attribute configuration to.



10
11
12
# File 'lib/coinpayments.rb', line 10

def configuration=(value)
  @configuration = value
end

Class Method Details

.balances(options = {}) ⇒ Object



44
45
46
# File 'lib/coinpayments.rb', line 44

def self.balances(options = {})
  api_call(options)
end

.configure {|configuration| ... } ⇒ Object

Yields:

  • (configuration)


14
15
16
# File 'lib/coinpayments.rb', line 14

def self.configure
  yield(configuration) if block_given?
end

.create_mass_withdrawal(withdrawals) ⇒ Object



58
59
60
# File 'lib/coinpayments.rb', line 58

def self.create_mass_withdrawal(withdrawals)
  api_call(withdrawals)
end

.create_transaction(amount, currency1, currency2, options = {}) ⇒ Object



48
49
50
51
# File 'lib/coinpayments.rb', line 48

def self.create_transaction(amount, currency1, currency2, options = {})
  args = { amount: amount, currency1: currency1, currency2: currency2 }.merge!(options)
  api_call(args)
end

.create_withdrawal(amount, currency, address, options = {}) ⇒ Object



53
54
55
56
# File 'lib/coinpayments.rb', line 53

def self.create_withdrawal(amount, currency, address, options = {})
  args = { amount: amount, currency: currency, address: address }.merge!(options)
  api_call(args)
end

.get_callback_address(currency, options = {}) ⇒ Object



67
68
69
70
# File 'lib/coinpayments.rb', line 67

def self.get_callback_address(currency, options = {})
  args = { currency: currency }.merge!(options)
  api_call(args)
end

.get_tx_info(txid) ⇒ Object



62
63
64
65
# File 'lib/coinpayments.rb', line 62

def self.get_tx_info(txid)
  args = { txid: txid }
  api_call(args)
end

.get_withdrawal_info(id) ⇒ Object



72
73
74
75
# File 'lib/coinpayments.rb', line 72

def self.get_withdrawal_info(id)
  args = { id: id }
  api_call(args)
end

.rates(options = {}) ⇒ Object



40
41
42
# File 'lib/coinpayments.rb', line 40

def self.rates(options = {})
  api_call(options)
end

.sign(callback_body) ⇒ Object



77
78
79
80
# File 'lib/coinpayments.rb', line 77

def self.sign(callback_body)
  OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha512'),
                          configuration.secret_phrase,callback_body)
end