class Ably::Realtime::RecoveryKeyContext
Attributes
Public Class Methods
Source
# File lib/ably/realtime/recovery_key_context.rb, line 24 def self.from_json(obj, logger = nil) begin data = JSON.load obj self.new data['connection_key'], data['msg_serial'], data['channel_serials'] rescue => e logger.warn "unable to decode recovery key, found error #{e}" unless logger.nil? return nil end end
Source
# File lib/ably/realtime/recovery_key_context.rb, line 11 def initialize(connection_key, msg_serial, channel_serials) @connection_key = connection_key @msg_serial = msg_serial @channel_serials = channel_serials if @channel_serials.nil? @channel_serials = {} end end
Public Instance Methods
Source
# File lib/ably/realtime/recovery_key_context.rb, line 20 def to_json { 'connection_key' => @connection_key, 'msg_serial' => @msg_serial, 'channel_serials' => @channel_serials }.to_json end