Skip to content

Commit 7f98564

Browse files
committed
Implement copilot review comments
1 parent 904d0bd commit 7f98564

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/optimizely/event/entity/event_batch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def build
4848
event_batch.anonymize_ip = @anonymize_ip
4949
event_batch.enrich_decisions = @enrich_decisions
5050
event_batch.visitors = @visitors
51-
event_batch.region = @region || 'US'
51+
event_batch.region = @region.nil? || 'US': @region
5252
event_batch
5353
end
5454

lib/optimizely/event/event_factory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def create_log_event(user_events, logger)
7272
builder.with_visitors(visitors)
7373
event_batch = builder.build
7474

75-
endpoint = ENDPOINTS[user_context[:region].to_sym] || ENDPOINTS[:US]
75+
endpoint = ENDPOINTS[user_context[:region].to_s.upcase.to_sym] || ENDPOINTS[:US]
7676

7777
Event.new(:post, endpoint, event_batch.as_json, POST_HEADERS)
7878
end

lib/optimizely/event_builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def create_impression_event(project_config, experiment, variation_id, user_id, a
131131
impression_params = get_impression_params(project_config, experiment, variation_id)
132132
event_params[:visitors][0][:snapshots].push(impression_params)
133133

134-
endpoint = ENDPOINTS[region.to_sym]
134+
endpoint = ENDPOINTS[region.to_s.upcase.to_sym]
135135

136136
Event.new(:post, endpoint, event_params, POST_HEADERS)
137137
end
@@ -152,7 +152,7 @@ def create_conversion_event(project_config, event, user_id, attributes, event_ta
152152
conversion_params = get_conversion_params(event, event_tags)
153153
event_params[:visitors][0][:snapshots] = [conversion_params]
154154

155-
endpoint = ENDPOINTS[region.to_sym]
155+
endpoint = ENDPOINTS[region.to_s.upcase.to_sym]
156156

157157
Event.new(:post, endpoint, event_params, POST_HEADERS)
158158
end

0 commit comments

Comments
 (0)