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



18
19
20
# File 'lib/cryptocoin_payable/adapters.rb', line 18

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

.ethereum_adapterObject



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

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

.for(coin_type) ⇒ Object



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

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