Sha256: 9d92a0d49ef0ea6aca3d686d2c08829021e00135d531f58ff2096d3676c3524e

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 Bytes

Contents

module Deribit
  class WS
    class BaseHandler
      attr_accessor :timestamp, :ws

      def initialize
        update_timestamp
      end

      def process(json, method: nil, ws: nil)
        @ws = ws

        if method && self.respond_to?(method)
          self.send(method, json)
        else
          puts "Received method #{method}: #{json}"
        end

        update_timestamp
      end

      private

      def update_timestamp
        @timestamp = Time.now.to_i
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deribit-v2-2.1.0 lib/deribit/ws/base_handler.rb
deribit-v2-2.0.0 lib/deribit/ws/base_handler.rb