Sha256: 49dffb2cafcb5688f9346deb106fe3a6d3e8fb9995bcaeda4c0e01791da799e1

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

require "openapi_client"

require_relative "../common/closeable"
require_relative "inner_client"

class CfClient < Closeable

  # Static:
  class << self

    @@instance = CfClient.new

    def instance

      @@instance
    end
  end

  # Static - End

  def initialize(api_key = nil, config = nil, connector = nil)

    if config == nil

      @config = ConfigBuilder.new.build
    else

      @config = config
    end

    @client = InnerClient.new(api_key, config, connector)

    @config.logger.debug "Client (1): " + @client.to_s
  end

  def init(api_key = nil, config = nil, connector = nil)

    if @client == nil

      @config = config

      @client = InnerClient.new(

        api_key = api_key,
        config = config,
        connector = connector
      )

      @config.logger.debug "Client (2): " + @client.to_s
    end
  end

  def wait_for_initialization

    if @client != nil

      @client.wait_for_initialization
    end
  end

  def bool_variation(identifier, target, default_value)

    @client.bool_variation(identifier, target, default_value)
  end

  def string_variation(identifier, target, default_value)

    @client.string_variation(identifier, target, default_value)
  end

  def number_variation(identifier, target, default_value)

    @client.number_variation(identifier, target, default_value)
  end

  def json_variation(identifier, target, default_value)

    @client.json_variation(identifier, target, default_value)
  end

  def destroy

    close
  end

  def close

    if @client != nil

      @client.close
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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