eppo-server-sdk 0.3.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +22 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/Cargo.lock +2015 -0
- data/Cargo.toml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +22 -0
- data/Rakefile +53 -0
- data/Steepfile +27 -0
- data/ext/eppo_client/Cargo.toml +19 -0
- data/ext/eppo_client/build.rs +5 -0
- data/ext/eppo_client/extconf.rb +6 -0
- data/ext/eppo_client/src/client.rs +178 -0
- data/ext/eppo_client/src/lib.rs +34 -0
- data/lib/eppo_client/assignment_logger.rb +7 -3
- data/lib/eppo_client/client.rb +159 -205
- data/lib/eppo_client/config.rb +4 -4
- data/lib/eppo_client/custom_errors.rb +0 -17
- data/lib/eppo_client/validation.rb +2 -2
- data/lib/eppo_client/version.rb +2 -1
- data/lib/eppo_client.rb +7 -45
- data/sig/eppo_server_sdk.rbs +96 -0
- metadata +26 -172
- data/lib/eppo_client/configuration_requestor.rb +0 -108
- data/lib/eppo_client/configuration_store.rb +0 -35
- data/lib/eppo_client/constants.rb +0 -20
- data/lib/eppo_client/http_client.rb +0 -75
- data/lib/eppo_client/lru_cache.rb +0 -28
- data/lib/eppo_client/poller.rb +0 -48
- data/lib/eppo_client/rules.rb +0 -119
- data/lib/eppo_client/shard.rb +0 -30
- data/lib/eppo_client/variation_type.rb +0 -39
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module EppoClient
|
6
|
-
# The class for configuring the Eppo client singleton
|
7
|
-
module VariationType
|
8
|
-
STRING_TYPE = 'string'
|
9
|
-
NUMERIC_TYPE = 'numeric'
|
10
|
-
BOOLEAN_TYPE = 'boolean'
|
11
|
-
JSON_TYPE = 'json'
|
12
|
-
|
13
|
-
module_function
|
14
|
-
|
15
|
-
# rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
|
16
|
-
def expected_type?(assigned_variation, expected_variation_type)
|
17
|
-
case expected_variation_type
|
18
|
-
when STRING_TYPE
|
19
|
-
assigned_variation.typed_value.is_a?(String)
|
20
|
-
when NUMERIC_TYPE
|
21
|
-
assigned_variation.typed_value.is_a?(Numeric)
|
22
|
-
when BOOLEAN_TYPE
|
23
|
-
assigned_variation.typed_value.is_a?(TrueClass) ||
|
24
|
-
assigned_variation.typed_value.is_a?(FalseClass)
|
25
|
-
when JSON_TYPE
|
26
|
-
begin
|
27
|
-
parsed_json = JSON.parse(assigned_variation.value)
|
28
|
-
JSON.dump(assigned_variation.typed_value)
|
29
|
-
parsed_json == assigned_variation.typed_value
|
30
|
-
rescue JSON::JSONError
|
31
|
-
false
|
32
|
-
end
|
33
|
-
else
|
34
|
-
false
|
35
|
-
end
|
36
|
-
end
|
37
|
-
# rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity
|
38
|
-
end
|
39
|
-
end
|