class Deribit::WS::Handler

Constants

AVAILABLE_METHODS
SILENT

Attributes

timestamp[R]

Public Instance Methods

handle_error(json, error) click to toggle source
# File lib/deribit/ws/handler.rb, line 45
def handle_error(json, error)
  puts "Alert! #{error.class} on message: '#{json.try(:fetch, :message)}', #{json.inspect}. Message: #{error.full_message}"
end
method_missing(m, *json, &block) click to toggle source
Calls superclass method
# File lib/deribit/ws/handler.rb, line 27
def method_missing(m, *json, &block)
  return false  if SILENT.include?(m.to_sym)
  
  puts "Delegating #{m}"
  if AVAILABLE_METHODS.include?(m.to_sym)
    notice(json)
  else
    super
  end
end
notice(json) click to toggle source
# File lib/deribit/ws/handler.rb, line 38
def notice(json)
  return json.each { |e| notice(e) }  if json.is_a?(Array)

  msg = json.is_a?(String) ? json : json[:message]
  puts "Notice: #{msg}"  if msg && !SILENT.include?(msg.to_sym)
end
update_timestamp!() click to toggle source
# File lib/deribit/ws/handler.rb, line 49
def update_timestamp!
  @timestamp = Time.now.to_i
end