absmartly-sdk 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/example/example.rb +35 -0
- data/lib/a_b_smartly.rb +1 -1
- data/lib/absmartly/version.rb +1 -1
- data/lib/absmartly.rb +8 -1
- metadata +2 -3
- data/lib/absmartly/variant_assigner.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a43518b761dda2ac2d8c0297e39c9b0ce83c48c7f8a173206148d4e28f7db3d
|
4
|
+
data.tar.gz: f770928ce488617ce4381e67a5d12df3bfdfd07fa05bb04e5144dcd186bdfd0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d3b4c6d70f2893a291192e85a2bccd8a9be25381d2a4d7c870d77a8c46853b4249dcbc80c04688204384024be6f505c3e946b75ca54998812ed232a7783f15
|
7
|
+
data.tar.gz: ec9681200650e472a496c36930a2332224d305a5304d2bea53398d12563071762afc9efdfce763b5412a5a10eac20e98d0bfafdac70eae3821464790043fc18e
|
data/Gemfile.lock
CHANGED
data/example/example.rb
CHANGED
@@ -48,3 +48,38 @@ properties = {
|
|
48
48
|
ctx.track("payment", properties)
|
49
49
|
|
50
50
|
ctx.close
|
51
|
+
|
52
|
+
context_data = Absmartly.context_data
|
53
|
+
ctx2 = Absmartly.create_context_with(context_config, context_data)
|
54
|
+
|
55
|
+
treatment = ctx2.treatment("exp_test_ab")
|
56
|
+
puts(treatment) # 0
|
57
|
+
treatment1 = ctx2.treatment("net_seasons")
|
58
|
+
puts(treatment1) # 1
|
59
|
+
treatment2 = ctx2.treatment("Experimento!")
|
60
|
+
puts(treatment2) # 1
|
61
|
+
treatment3 = ctx2.treatment("test")
|
62
|
+
puts(treatment3) # 1
|
63
|
+
|
64
|
+
ctx2.set_unit("db_user_id", 1000013)
|
65
|
+
ctx2.set_units(db_user_id2: 1000013, session_id2: 12311)
|
66
|
+
|
67
|
+
ctx2.set_attribute("user_agent", "Chrome 2022")
|
68
|
+
ctx2.set_attributes(
|
69
|
+
customer_age: "new_customer",
|
70
|
+
customer_point: 20,
|
71
|
+
)
|
72
|
+
|
73
|
+
ctx2.set_override("new_exp", 3)
|
74
|
+
ctx2.set_overrides(
|
75
|
+
exp_test_experiment: 1,
|
76
|
+
exp_another_experiment: 0,
|
77
|
+
)
|
78
|
+
ctx2.publish
|
79
|
+
properties = {
|
80
|
+
value: 125,
|
81
|
+
fee: 125
|
82
|
+
}
|
83
|
+
ctx2.track("payment", properties)
|
84
|
+
|
85
|
+
ctx2.close
|
data/lib/a_b_smartly.rb
CHANGED
@@ -64,7 +64,7 @@ class ABSmartly
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def create_context_with(config, data)
|
67
|
-
Context.create(get_utc_format, config,
|
67
|
+
Context.create(get_utc_format, config, data,
|
68
68
|
@context_data_provider, @context_event_handler, @context_event_logger, @variable_parser,
|
69
69
|
AudienceMatcher.new(@audience_deserializer))
|
70
70
|
end
|
data/lib/absmartly/version.rb
CHANGED
data/lib/absmartly.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "absmartly/version"
|
4
|
-
require_relative "absmartly/variant_assigner"
|
5
4
|
require_relative "a_b_smartly"
|
6
5
|
require_relative "a_b_smartly_config"
|
7
6
|
require_relative "client"
|
@@ -33,6 +32,14 @@ module Absmartly
|
|
33
32
|
sdk.create_context(context_config)
|
34
33
|
end
|
35
34
|
|
35
|
+
def create_context_with(context_config, data)
|
36
|
+
sdk.create_context_with(context_config, data)
|
37
|
+
end
|
38
|
+
|
39
|
+
def context_data
|
40
|
+
sdk.context_data
|
41
|
+
end
|
42
|
+
|
36
43
|
private
|
37
44
|
def client_config
|
38
45
|
@client_config = ClientConfig.create
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: absmartly-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- absmartly
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07
|
11
|
+
date: 2024-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -75,7 +75,6 @@ files:
|
|
75
75
|
- lib/a_b_smartly.rb
|
76
76
|
- lib/a_b_smartly_config.rb
|
77
77
|
- lib/absmartly.rb
|
78
|
-
- lib/absmartly/variant_assigner.rb
|
79
78
|
- lib/absmartly/version.rb
|
80
79
|
- lib/audience_deserializer.rb
|
81
80
|
- lib/audience_matcher.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "murmurhash3"
|
4
|
-
|
5
|
-
module Absmartly
|
6
|
-
# VariantAssigner
|
7
|
-
class VariantAssigner
|
8
|
-
def initialize(_unit)
|
9
|
-
# this._unitHash = murmur3_32(stringToUint8Array(unit).buffer);
|
10
|
-
end
|
11
|
-
|
12
|
-
def assign(split, seed_hi, seed_lo)
|
13
|
-
prob = probability(seed_hi, seed_lo)
|
14
|
-
chooseVariant(split, prob)
|
15
|
-
end
|
16
|
-
|
17
|
-
# private
|
18
|
-
|
19
|
-
# def chooseVariant(split, prob)
|
20
|
-
#
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# def probability(seedHi, seedLo)
|
24
|
-
# const key = this._unitHash;
|
25
|
-
# const buffer = new ArrayBuffer(12)
|
26
|
-
# const view = new DataView(buffer)
|
27
|
-
# view.setUint32(0, seedLo, true)
|
28
|
-
# view.setUint32(4, seedHi, true)
|
29
|
-
# view.setUint32(8, key, true)
|
30
|
-
#
|
31
|
-
# murmur3_32(buffer) * (1.0 / 0xffffffff)
|
32
|
-
# end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
# DataView.new(new_bytes_buffer, src_offset, new_bytes.length)
|