Sha256: a98113c3a582e3c03102905af5591930dbb05fc47a6f5623f9fbee2a08496c4a

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require "openapi_client"

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

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

1 entries across 1 versions & 1 rubygems

Version Path
ff-ruby-server-sdk-1.0.0 lib/ff/ruby/server/sdk/api/cf_client.rb