Skip to content

Commit ffa1944

Browse files
rashidspmikeproeng37
authored andcommitted
Removes deprecated revenue value support (#95)
1 parent 7c0e854 commit ffa1944

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

lib/optimizely.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,6 @@ def track(event_key, user_id, attributes = nil, event_tags = nil)
201201
return nil
202202
end
203203

204-
if event_tags && event_tags.is_a?(Numeric)
205-
event_tags = {
206-
'revenue' => event_tags
207-
}
208-
@logger.log(Logger::WARN, 'Event value is deprecated in track call. Use event tags to pass in revenue value instead.')
209-
end
210-
211204
return nil unless user_inputs_valid?(attributes, event_tags)
212205

213206
experiment_ids = @config.get_experiment_ids_for_event(event_key)

spec/project_spec.rb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,6 @@ class InvalidErrorHandler; end
406406
expect(project_instance.event_dispatcher).to have_received(:dispatch_event).with(Optimizely::Event.new(:post, conversion_log_url, params, post_headers)).once
407407
end
408408

409-
it 'should properly track an event by calling dispatch_event with right params with deprecated revenue provided' do
410-
params = @expected_track_event_params
411-
params[:visitors][0][:snapshots][0][:events][0].merge!(revenue: 42,
412-
tags: {'revenue' => 42})
413-
414-
allow(project_instance.event_dispatcher).to receive(:dispatch_event).with(instance_of(Optimizely::Event))
415-
project_instance.track('test_event', 'test_user', nil, 42)
416-
expect(project_instance.event_dispatcher).to have_received(:dispatch_event).with(Optimizely::Event.new(:post, conversion_log_url, params, post_headers)).once
417-
expect(spy_logger).to have_received(:log).once.with(Logger::WARN, 'Event value is deprecated in track call. Use event tags to pass in revenue value instead.')
418-
end
419-
420409
it 'should properly track an event by calling dispatch_event with right params with attributes provided' do
421410
params = @expected_track_event_params
422411
params[:visitors][0][:attributes] = [{
@@ -474,6 +463,9 @@ class InvalidErrorHandler; end
474463
it 'should raise an exception when called with event tags in an invalid format' do
475464
expect { project_instance.track('test_event', 'test_user', nil, 'invalid_tags') }
476465
.to raise_error(Optimizely::InvalidEventTagFormatError)
466+
expect { project_instance.track('test_event', 'test_user', nil, 42) }
467+
.to raise_error(Optimizely::InvalidEventTagFormatError)
468+
expect(spy_logger).to have_received(:log).twice.with(Logger::ERROR, 'Provided event tags are in an invalid format.')
477469
end
478470

479471
it 'should return false when called with event tags in an invalid format' do

0 commit comments

Comments
 (0)