Sha256: df14a25d85b7920d084a9bd00936d48e67bacddd2308c603efd8aef15e67cace

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require "logger"

require_relative "../connector/updater"

class InnerClientUpdater < Updater

  def initialize(

    poll_processor,
    client_callback,
    logger = nil
  )

    unless poll_processor.kind_of?(PollingProcessor)

      raise "The 'poll_processor' parameter must be of '" + PollingProcessor.to_s + "' data type"
    end

    unless client_callback.kind_of?(ClientCallback)

      raise "The 'client_callback' parameter must be of '" + ClientCallback.to_s + "' data type"
    end

    if logger != nil

      @logger = logger
    else

      @logger = Logger.new(STDOUT)
    end

    @poll_processor = poll_processor
    @client_callback = client_callback
  end

  def on_connected

    @poll_processor.stop
  end

  def on_disconnected

    unless @client_callback.is_closing

      @poll_processor.start
    end
  end

  def on_ready

    @client_callback.on_update_processor_ready()
  end

  def on_error

    @logger.error "Error occurred"
  end

  def update(message)

    @client_callback.update(message, false)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ff-ruby-server-sdk-1.0.6 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.5 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.4 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.3 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.2 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.2.rc1 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.1 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.0.0 lib/ff/ruby/server/sdk/api/inner_client_updater.rb