Class: Cryptoexchange::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptoexchange/credentials.rb

Class Method Summary collapse

Class Method Details

.get(exchange) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/cryptoexchange/credentials.rb', line 4

def get(exchange)
  unless File.exists?(filename)
    raise Cryptoexchange::CredentialsMissingError, "#{filename} does not exist!"
  end

  exchange_credentials = HashHelper.dig(credentials, exchange)
  raise Cryptoexchange::CredentialsMissingError, "Credentials for #{exchange} does not exist!" unless exchange_credentials

  exchange_credentials
end