optimizely-sdk 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01adaffe5e054d857678ed1b489ed18ed2edd4f8
4
- data.tar.gz: 54adf65efba02815c56f590bb55928c2a00c3900
3
+ metadata.gz: 237d61dfbd7da5d8b12e1a9e2b913a684a2700bd
4
+ data.tar.gz: e8620f5eb74a80a2e6d0a2b584bdfe369e4ad9ca
5
5
  SHA512:
6
- metadata.gz: f3b16cb239fb9d5c391ca4359a964454cb71a9e7871a5645a86fd675000547f0fededbd7448826afd5a86000db272f59a7439bf09897e335fbfa50c52b745dcd
7
- data.tar.gz: 8e64266fb986573b13ca9cabec300632f0c7890aaec9bf74849acca984470ae98ba09d1cdb550b01c1f4f724c3a29a9efe830d3b7f6813b09776ae5c62e610d6
6
+ metadata.gz: 7ceffdff73cf4b58b609f3c40105134df1e97eee3105222749c6e72c7f54ab9aa00cf2de18b1821aba6f0d0cdd30b9f7872cc570886d7dc76f2ae00ad828baaf
7
+ data.tar.gz: 11bc03a8f8af4c5758778e2c59fc090f6d39d52d818c267950d1ff98db1b043068d0bcef30ed8babcc7584e02200f0fcead4310c58d727bba9d21da6fcf642a1
data/lib/optimizely.rb CHANGED
@@ -63,8 +63,8 @@ module Optimizely
63
63
  validate_instantiation_options(datafile, skip_json_validation)
64
64
  rescue InvalidInputError => e
65
65
  @is_valid = false
66
- logger = SimpleLogger.new
67
- logger.log(Logger::ERROR, e.message)
66
+ @logger = SimpleLogger.new
67
+ @logger.log(Logger::ERROR, e.message)
68
68
  return
69
69
  end
70
70
 
@@ -72,15 +72,15 @@ module Optimizely
72
72
  @config = ProjectConfig.new(datafile, @logger, @error_handler)
73
73
  rescue
74
74
  @is_valid = false
75
- logger = SimpleLogger.new
76
- logger.log(Logger::ERROR, InvalidInputError.new('datafile').message)
75
+ @logger = SimpleLogger.new
76
+ @logger.log(Logger::ERROR, InvalidInputError.new('datafile').message)
77
77
  return
78
78
  end
79
79
 
80
80
  unless @config.parsing_succeeded?
81
81
  @is_valid = false
82
- logger = SimpleLogger.new
83
- logger.log(Logger::ERROR, InvalidDatafileVersionError.new.message)
82
+ @logger = SimpleLogger.new
83
+ @logger.log(Logger::ERROR, InvalidDatafileVersionError.new.message)
84
84
  return
85
85
  end
86
86
 
@@ -100,8 +100,7 @@ module Optimizely
100
100
  # Returns nil if experiment is not Running, if user is not in experiment, or if datafile is invalid.
101
101
 
102
102
  unless @is_valid
103
- logger = SimpleLogger.new
104
- logger.log(Logger::ERROR, InvalidDatafileError.new('activate').message)
103
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('activate').message)
105
104
  return nil
106
105
  end
107
106
 
@@ -137,8 +136,7 @@ module Optimizely
137
136
  # Returns nil if experiment is not Running, if user is not in experiment, or if datafile is invalid.
138
137
 
139
138
  unless @is_valid
140
- logger = SimpleLogger.new
141
- logger.log(Logger::ERROR, InvalidDatafileError.new('get_variation').message)
139
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('get_variation').message)
142
140
  return nil
143
141
  end
144
142
 
@@ -200,8 +198,7 @@ module Optimizely
200
198
  # event_tags - Hash representing metadata associated with the event.
201
199
 
202
200
  unless @is_valid
203
- logger = SimpleLogger.new
204
- logger.log(Logger::ERROR, InvalidDatafileError.new('track').message)
201
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('track').message)
205
202
  return nil
206
203
  end
207
204
 
@@ -259,8 +256,7 @@ module Optimizely
259
256
  # False if the feature is disabled.
260
257
  # False if the feature is not found.
261
258
  unless @is_valid
262
- logger = SimpleLogger.new
263
- logger.log(Logger::ERROR, InvalidDatafileError.new('is_feature_enabled').message)
259
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('is_feature_enabled').message)
264
260
  return false
265
261
  end
266
262
 
@@ -315,8 +311,7 @@ module Optimizely
315
311
  enabled_features = []
316
312
 
317
313
  unless @is_valid
318
- logger = SimpleLogger.new
319
- logger.log(Logger::ERROR, InvalidDatafileError.new('get_enabled_features').message)
314
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('get_enabled_features').message)
320
315
  return enabled_features
321
316
  end
322
317
 
@@ -343,6 +338,11 @@ module Optimizely
343
338
  # Returns the string variable value.
344
339
  # Returns nil if the feature flag or variable are not found.
345
340
 
341
+ unless @is_valid
342
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('get_feature_variable_string').message)
343
+ return nil
344
+ end
345
+
346
346
  variable_value = get_feature_variable_for_type(
347
347
  feature_flag_key,
348
348
  variable_key,
@@ -365,6 +365,11 @@ module Optimizely
365
365
  # Returns the boolean variable value.
366
366
  # Returns nil if the feature flag or variable are not found.
367
367
 
368
+ unless @is_valid
369
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('get_feature_variable_boolean').message)
370
+ return nil
371
+ end
372
+
368
373
  variable_value = get_feature_variable_for_type(
369
374
  feature_flag_key,
370
375
  variable_key,
@@ -387,6 +392,11 @@ module Optimizely
387
392
  # Returns the double variable value.
388
393
  # Returns nil if the feature flag or variable are not found.
389
394
 
395
+ unless @is_valid
396
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('get_feature_variable_double').message)
397
+ return nil
398
+ end
399
+
390
400
  variable_value = get_feature_variable_for_type(
391
401
  feature_flag_key,
392
402
  variable_key,
@@ -409,6 +419,11 @@ module Optimizely
409
419
  # Returns the integer variable value.
410
420
  # Returns nil if the feature flag or variable are not found.
411
421
 
422
+ unless @is_valid
423
+ @logger.log(Logger::ERROR, InvalidDatafileError.new('get_feature_variable_integer').message)
424
+ return nil
425
+ end
426
+
412
427
  variable_value = get_feature_variable_for_type(
413
428
  feature_flag_key,
414
429
  variable_key,
@@ -17,5 +17,5 @@
17
17
  #
18
18
  module Optimizely
19
19
  CLIENT_ENGINE = 'ruby-sdk'
20
- VERSION = '2.0.2'
20
+ VERSION = '2.0.3'
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimizely-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Optimizely
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-19 00:00:00.000000000 Z
11
+ date: 2018-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler