Module: Bitstamper::Rest::Private::Deposits

Included in:
Client
Defined in:
lib/bitstamper/rest/private/deposits.rb

Instance Method Summary collapse

Instance Method Details

#bch_deposit_addressObject



18
19
20
# File 'lib/bitstamper/rest/private/deposits.rb', line 18

def bch_deposit_address
  deposit_address("bch")
end

#btc_deposit_addressObject



6
7
8
# File 'lib/bitstamper/rest/private/deposits.rb', line 6

def btc_deposit_address
  deposit_address("btc")
end

#deposit_address(currency) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bitstamper/rest/private/deposits.rb', line 26

def deposit_address(currency)
  check_credentials!
  
  currency    =   currency.to_s.downcase
  
  if !::Bitstamper::Constants::AVAILABLE_CRYPTOS.include?(currency)
    raise ::Bitstamper::Errors::InvalidCurrencyError.new("#{currency} is not a tradeable crypto currency on Bitstamp.")
  end
  
  path        =   currency.eql?("btc") ? "/bitcoin_deposit_address" : "/v2/#{currency}_address"
  response    =   post(path)
  response    =   response.is_a?(String) ? {"address" => response} : response
  
  return response
end

#eth_deposit_addressObject



10
11
12
# File 'lib/bitstamper/rest/private/deposits.rb', line 10

def eth_deposit_address
  deposit_address("eth")
end

#ltc_deposit_addressObject



22
23
24
# File 'lib/bitstamper/rest/private/deposits.rb', line 22

def ltc_deposit_address
  deposit_address("ltc")
end

#unconfirmed_bitcoinsObject



42
43
44
45
46
# File 'lib/bitstamper/rest/private/deposits.rb', line 42

def unconfirmed_bitcoins
  check_credentials!
  response    =   post("/unconfirmed_btc")
  Bitstamper::Models::Deposit.parse(response) if response
end

#xrp_deposit_addressObject



14
15
16
# File 'lib/bitstamper/rest/private/deposits.rb', line 14

def xrp_deposit_address
  deposit_address("xrp")
end