Module: CryptocoinPayable::Adapters

Defined in:
lib/cryptocoin_payable/adapters.rb,
lib/cryptocoin_payable/adapters/base.rb,
lib/cryptocoin_payable/adapters/bitcoin.rb,
lib/cryptocoin_payable/adapters/ethereum.rb,
lib/cryptocoin_payable/adapters/bitcoin_cash.rb

Defined Under Namespace

Classes: Base, Bitcoin, BitcoinCash, Ethereum

Class Method Summary collapse

Class Method Details

.bitcoin_adapterObject



20
21
22
# File 'lib/cryptocoin_payable/adapters.rb', line 20

def self.bitcoin_adapter
  @bitcoin_adapter ||= Bitcoin.new
end

.bitcoin_cash_adapterObject



16
17
18
# File 'lib/cryptocoin_payable/adapters.rb', line 16

def self.bitcoin_cash_adapter
  @bitcoin_cash_adapter ||= BitcoinCash.new
end

.ethereum_adapterObject



24
25
26
# File 'lib/cryptocoin_payable/adapters.rb', line 24

def self.ethereum_adapter
  @ethereum_adapter ||= Ethereum.new
end

.for(coin_type) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/cryptocoin_payable/adapters.rb', line 3

def self.for(coin_type)
  case coin_type.to_sym
  when :bch
    bitcoin_cash_adapter
  when :btc
    bitcoin_adapter
  when :eth
    ethereum_adapter
  else
    raise "Invalid coin type #{coin_type}"
  end
end