Skip to content

Commit 0ea82ad

Browse files
Merge pull request #16 from Flagsmith/release/3.0.2
Release 3.0.2
2 parents d96b019 + e6850a6 commit 0ea82ad

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

Gemfile.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
flagsmith (3.0.1)
4+
flagsmith (3.0.2)
55
faraday
66
faraday-retry
77
faraday_middleware
@@ -40,7 +40,7 @@ GEM
4040
faraday (~> 1.0)
4141
gem-release (2.2.0)
4242
method_source (1.0.0)
43-
multipart-post (2.2.0)
43+
multipart-post (2.2.3)
4444
parallel (1.20.1)
4545
parser (3.0.0.0)
4646
ast (~> 2.4.1)
@@ -50,7 +50,7 @@ GEM
5050
rainbow (3.0.0)
5151
rake (13.0.3)
5252
regexp_parser (2.0.3)
53-
rexml (3.2.4)
53+
rexml (3.2.5)
5454
rspec (3.10.0)
5555
rspec-core (~> 3.10.0)
5656
rspec-expectations (~> 3.10.0)

example/Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ GEM
172172
public_suffix (4.0.7)
173173
puma (5.6.4)
174174
nio4r (~> 2.0)
175-
rack (2.2.3)
175+
rack (2.2.3.1)
176176
rack-test (1.1.0)
177177
rack (>= 1.0, < 3)
178178
rainbow (3.1.1)

lib/flagsmith/sdk/analytics_processor.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def flush
3131
@last_flushed = Time.now
3232
end
3333

34-
def track_feature(feature_id)
35-
@analytics_data[feature_id] = @analytics_data.fetch(feature_id, 0) + 1
34+
def track_feature(feature_name)
35+
@analytics_data[feature_name] = @analytics_data.fetch(feature_name, 0) + 1
3636
flush if (Time.now - @last_flushed) > TIMER * 1000
3737
end
3838
end

lib/flagsmith/sdk/models/flags.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def feature_value(feature_name)
122122
def get_flag(feature_name)
123123
key = Flagsmith::Flags::Collection.normalize_key(feature_name)
124124
flag = flags.fetch(key)
125-
@analytics_processor.track_feature(flag.feature_id) if @analytics_processor && flag.feature_id
125+
@analytics_processor.track_feature(flag.feature_name) if @analytics_processor && flag.feature_id
126126
flag
127127
rescue KeyError
128128
return @default_flag_handler.call(feature_name) if @default_flag_handler

lib/flagsmith/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Flagsmith
4-
VERSION = '3.0.1'
4+
VERSION = '3.0.2'
55
end

spec/sdk/analytics_processor_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@
1919
end
2020

2121
it 'test_analytics_processor_track_feature_updates_analytics_data' do
22-
subject.track_feature(1)
23-
expect(subject.analytics_data[1]).to eq(1)
22+
subject.track_feature("my_feature")
23+
expect(subject.analytics_data["my_feature"]).to eq(1)
2424

25-
subject.track_feature(1)
26-
expect(subject.analytics_data[1]).to eq(2)
25+
subject.track_feature("my_feature")
26+
expect(subject.analytics_data["my_feature"]).to eq(2)
2727
end
2828

2929
it 'test_analytics_processor_flush_clears_analytics_data' do
30-
subject.track_feature(1)
30+
subject.track_feature("my_feature")
3131
subject.flush
3232
expect(subject.analytics_data).to eql({})
3333
end
3434

3535
it 'test_analytics_processor_flush_post_request_data_match_ananlytics_data' do
36-
subject.track_feature(1)
37-
subject.track_feature(2)
36+
subject.track_feature("my_feature_1")
37+
subject.track_feature("my_feature_2")
3838
expect(flagsmith.api_client).to receive(:post).exactly(1).times do |uri_path, body|
3939
expect(uri_path).to eq('analytics/flags/')
40-
expect(body).to eq({ 1 => 1, 2 => 1 }.to_json)
40+
expect(body).to eq({ "my_feature_1" => 1, "my_feature_2" => 1 }.to_json)
4141
end
4242
subject.flush
4343
end

0 commit comments

Comments
 (0)