Class: Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ff/ruby/server/sdk/api/config.rb

Constant Summary collapse

@@min_frequency =
60

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Static - End



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 24

def initialize
  super

  @config_url = "https://config.ff.harness.io/api/1.0"
  @event_url = "https://events.ff.harness.io/api/1.0"

  @stream_enabled = true

  @poll_interval_in_seconds = @@min_frequency

  @analytics_enabled = true

  @frequency = @@min_frequency

  @buffer_size = 10000

  @all_attributes_private = false

  @private_attributes = Set[]

  @connection_timeout = 10 * 1000

  @read_timeout = 30 * 1000

  @write_timeout = 10 * 1000

  @debugging = false

  @logger = Logger.new(STDOUT)

  @metrics_service_acceptable_duration = 10 * 1000

  @cache = DefaultCache.new(@logger)

  # TODO: Storage goes here

  @store = nil
end

Instance Attribute Details

#all_attributes_privateObject

Returns the value of attribute all_attributes_private.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def all_attributes_private
  @all_attributes_private
end

#analytics_enabledObject

Returns the value of attribute analytics_enabled.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def analytics_enabled
  @analytics_enabled
end

#buffer_sizeObject

Returns the value of attribute buffer_size.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def buffer_size
  @buffer_size
end

#cacheObject

Returns the value of attribute cache.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def cache
  @cache
end

#config_urlObject

Returns the value of attribute config_url.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def config_url
  @config_url
end

#connection_timeoutObject

Returns the value of attribute connection_timeout.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def connection_timeout
  @connection_timeout
end

#debuggingObject

Returns the value of attribute debugging.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def debugging
  @debugging
end

#event_urlObject

Returns the value of attribute event_url.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def event_url
  @event_url
end

#frequencyObject

Returns the value of attribute frequency.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def frequency
  @frequency
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def logger
  @logger
end

#metrics_service_acceptable_durationObject

Returns the value of attribute metrics_service_acceptable_duration.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def metrics_service_acceptable_duration
  @metrics_service_acceptable_duration
end

#poll_interval_in_secondsObject

Returns the value of attribute poll_interval_in_seconds.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def poll_interval_in_seconds
  @poll_interval_in_seconds
end

#private_attributesObject

Returns the value of attribute private_attributes.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def private_attributes
  @private_attributes
end

#read_timeoutObject

Returns the value of attribute read_timeout.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def read_timeout
  @read_timeout
end

#ssl_ca_certObject

Returns the value of attribute ssl_ca_cert.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def ssl_ca_cert
  @ssl_ca_cert
end

#storeObject

Returns the value of attribute store.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def store
  @store
end

#stream_enabledObject

Returns the value of attribute stream_enabled.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def stream_enabled
  @stream_enabled
end

#write_timeoutObject

Returns the value of attribute write_timeout.



7
8
9
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 7

def write_timeout
  @write_timeout
end

Class Method Details

.min_frequencyObject



17
18
19
20
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 17

def min_frequency

  @@min_frequency
end

Instance Method Details

#auth_settingsObject



108
109
110
111
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 108

def auth_settings

  {}
end

#base_url(args) ⇒ Object



113
114
115
116
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 113

def base_url(args)

  @config_url
end

#cert_fileObject



88
89
90
91
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 88

def cert_file

  nil
end

#client_side_validationObject



103
104
105
106
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 103

def client_side_validation

  nil
end

#describeObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 118

def describe

  to_s + "\n" +
    "\tmin_frequency = " + @@min_frequency.to_s + "\n" +
    "\tconfig_url = " + @config_url + "\n" +
    "\tevent_url = " + @event_url + "\n" +
    "\tstream_enabled = " + @stream_enabled.to_s + "\n" +
    "\tpoll_interval_in_seconds = " + @poll_interval_in_seconds.to_s + "\n" +
    "\tanalytics_enabled = " + @analytics_enabled.to_s + "\n" +
    "\tfrequency = " + @frequency.to_s + "\n" +
    "\tget_frequency = " + get_frequency.to_s + "\n" +
    "\tbuffer_size = " + @buffer_size.to_s + "\n" +
    "\tall_attributes_private = " + @all_attributes_private.to_s + "\n" +
    "\tprivate_attributes = " + @private_attributes.to_s + "\n" +
    "\tconnection_timeout = " + @connection_timeout.to_s + "\n" +
    "\tread_timeout = " + @read_timeout.to_s + "\n" +
    "\twrite_timeout = " + @write_timeout.to_s + "\n" +
    "\tdebug = " + @debugging.to_s + "\n" +
    "\tmetrics_service_acceptable_duration = " + @metrics_service_acceptable_duration.to_s + "\n" +
    "\tcache = " + @cache.to_s + "\n" +
    "\tstore = " + @store.to_s
end

#get_frequencyObject



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

def get_frequency

  [@frequency, @@min_frequency].max
end

#key_fileObject



93
94
95
96
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 93

def key_file

  nil
end

#params_encodingObject



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

def params_encoding

  nil
end

#timeoutObject



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

def timeout

  @connection_timeout
end

#verify_sslObject



83
84
85
86
# File 'lib/ff/ruby/server/sdk/api/config.rb', line 83

def verify_ssl

  true
end

#verify_ssl_hostObject



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

def verify_ssl_host

  true
end