Class: CfClient

Inherits:
Closeable show all
Defined in:
lib/ff/ruby/server/sdk/api/cf_client.rb

Constant Summary collapse

@@instance =
CfClient.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil, config = nil, connector = nil) ⇒ CfClient

Static - End



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 21

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

Class Method Details

.instanceObject



13
14
15
16
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 13

def instance

  @@instance
end

Instance Method Details

#bool_variation(identifier, target, default_value) ⇒ Object



59
60
61
62
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 59

def bool_variation(identifier, target, default_value)

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

#closeObject



84
85
86
87
88
89
90
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 84

def close

  if @client != nil

    @client.close
  end
end

#destroyObject



79
80
81
82
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 79

def destroy

  close
end

#init(api_key = nil, config = nil, connector = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 36

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

#json_variation(identifier, target, default_value) ⇒ Object



74
75
76
77
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 74

def json_variation(identifier, target, default_value)

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

#number_variation(identifier, target, default_value) ⇒ Object



69
70
71
72
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 69

def number_variation(identifier, target, default_value)

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

#string_variation(identifier, target, default_value) ⇒ Object



64
65
66
67
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 64

def string_variation(identifier, target, default_value)

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

#wait_for_initialization(timeout_ms: nil) ⇒ Object



53
54
55
56
57
# File 'lib/ff/ruby/server/sdk/api/cf_client.rb', line 53

def wait_for_initialization(timeout_ms: nil)
  if @client != nil
    @client.wait_for_initialization(timeout: timeout_ms)
  end
end