From 9b0a9d1f32ba1d3abc9e3074713d88e352fce3cf Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 14 Jan 2026 14:42:22 -0600 Subject: [PATCH] cleanup around app-config --- ruby/lib/jam_ruby/lib/capi_transmitter.rb | 10 +++++----- web/lib/tasks/test_capi.rake | 4 ++-- web/spec/support/app_config.rb | 12 ++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ruby/lib/jam_ruby/lib/capi_transmitter.rb b/ruby/lib/jam_ruby/lib/capi_transmitter.rb index fe64d5a97..20bb32feb 100644 --- a/ruby/lib/jam_ruby/lib/capi_transmitter.rb +++ b/ruby/lib/jam_ruby/lib/capi_transmitter.rb @@ -6,8 +6,8 @@ class CapiTransmitter def self.send_event(event_name, user, custom_data = {}, event_source_url = nil) begin - pixel_id = APP_CONFIG[:facebook_pixel_id] - access_token = APP_CONFIG[:facebook_access_token] + pixel_id = APP_CONFIG.facebook_pixel_id + access_token = APP_CONFIG.facebook_access_token if pixel_id.blank? || access_token.blank? Rails.logger.warn("CapiTransmitter: Missing Facebook Pixel ID or Access Token. Skipping event #{event_name}.") @@ -16,8 +16,8 @@ class CapiTransmitter # Construct the User Data object user_data = { - client_ip_address: user.current_sign_in_ip, - client_user_agent: user.user_agent # Note: User model might not have user_agent stored directly, might need to pass it or rely on what's available + # client_ip_address: user.current_sign_in_ip, + # client_user_agent: user.user_agent # Note: User model might not have user_agent stored directly, might need to pass it or rely on what's available } # Enhance user data with hashed PII if available @@ -49,7 +49,7 @@ class CapiTransmitter http = Net::HTTP.new(url.host, url.port) - if APP_CONFIG[:facebook_conversion_api_tls] == false + if APP_CONFIG.facebook_conversion_api_tls == false http.verify_mode = OpenSSL::SSL::VERIFY_NONE else http.use_ssl = true diff --git a/web/lib/tasks/test_capi.rake b/web/lib/tasks/test_capi.rake index d57b7a320..64b2bb06a 100644 --- a/web/lib/tasks/test_capi.rake +++ b/web/lib/tasks/test_capi.rake @@ -2,8 +2,8 @@ namespace :capi do desc "Test Facebook CAPI connection" task :test_connection => :environment do puts "Testing CAPI connection..." - pixel_id = APP_CONFIG[:facebook_pixel_id] - access_token = APP_CONFIG[:facebook_access_token] + pixel_id = APP_CONFIG.facebook_pixel_id + access_token = APP_CONFIG.facebook_access_token puts "Pixel ID: #{pixel_id}" puts "Access Token: #{access_token.try(:truncate, 10)}" diff --git a/web/spec/support/app_config.rb b/web/spec/support/app_config.rb index 38ddedd3c..5bba7c870 100644 --- a/web/spec/support/app_config.rb +++ b/web/spec/support/app_config.rb @@ -180,6 +180,18 @@ def web_config def max_invites_to_receiver_per_day 1000 # a low number only hinders test; the ruby rspec test have a lower value and test this feature end + + def facebook_pixel_id + '1234567890' + end + + def facebook_access_token + 'dummy_token' + end + + def facebook_conversion_api_tls + true + end end klass.new end