class Cryptoexchange::Services::Authentication
Public Class Methods
new(action, exchange)
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 3 def initialize(action, exchange) @action = action @exchange = exchange end
Public Instance Methods
headers(payload)
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 12 def headers(payload) raise NotImplementedError, 'header method is not defined!' end
is_missing_credentials?()
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 20 def is_missing_credentials? missing_credentials.length > 0 end
missing_credentials()
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 24 def missing_credentials credentials = Cryptoexchange::Credentials.get(@exchange).keys.map(&:to_sym) required_credentials.select do |required| !credentials.include?(required) end end
raise_credentials_missing_error()
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 31 def raise_credentials_missing_error raise Cryptoexchange::CredentialsMissingError, "#{missing_credentials.join(', ')} are required!" end
required_credentials()
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 35 def required_credentials # NOTE: For demonstration purposes case @action when :pairs, :market, :order_book, :trades [] end end
signature(payload)
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 8 def signature(payload) raise NotImplementedError, 'signature method is not defined!' end
validate_credentials!()
click to toggle source
# File lib/cryptoexchange/services/authentication.rb, line 16 def validate_credentials! raise_credentials_missing_error if is_missing_credentials? end