Sha256: f13910ed729ff050433d66fea3cf63bf85a3803e9cf221c473ed100367c4b992

Contents?: true

Size: 1.56 KB

Versions: 9

Compression:

Stored size: 1.56 KB

Contents

require_relative "../../generated/lib/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

9 entries across 9 versions & 1 rubygems

Version Path
ff-ruby-server-sdk-1.3.2 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.3.1 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.2.1 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.2.0 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.1.4 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.1.3 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.1.2 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.1.1 lib/ff/ruby/server/sdk/api/cf_client.rb
ff-ruby-server-sdk-1.1.0 lib/ff/ruby/server/sdk/api/cf_client.rb