Sha256: d47f069b1c7f260e80d491da458721d40d4b30f8c525f78a993eb536e672eac5

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 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 "InnerClientUpdater error occurred"
  end

  def update(message)

    @client_callback.update(message, false)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ff-ruby-server-sdk-1.4.6 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.4.5 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.4.4 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.4.3 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.4.2 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.4.1 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.4.0 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.3.2 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.3.1 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.2.1 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.2.0 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.1.4 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.1.3 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.1.2 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.1.1 lib/ff/ruby/server/sdk/api/inner_client_updater.rb
ff-ruby-server-sdk-1.1.0 lib/ff/ruby/server/sdk/api/inner_client_updater.rb