diff --git a/.ruby-version b/.ruby-version index 818bd47..0aec50e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.6 +3.1.4 diff --git a/Gemfile b/Gemfile index a65f413..00088ae 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ end git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby "3.0.6" +ruby "3.1.4" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 7.0.7" diff --git a/Gemfile.lock b/Gemfile.lock index 67c2cae..b193146 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -123,7 +123,7 @@ GEM builder (3.2.4) bundle-audit (0.1.0) bundler-audit - bundler-audit (0.8.0) + bundler-audit (0.9.1) bundler (>= 1.2.0, < 3) thor (~> 1.0) byebug (9.1.0) @@ -231,6 +231,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + json (2.7.1) jwt (1.5.6) kaminari (1.2.2) activesupport (>= 4.1.0) @@ -244,9 +245,11 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) + language_server-protocol (3.17.0.3) libdatadog (0.7.0.1.1) libddwaf (1.3.0.2.0) ffi (~> 1.0) + lint_roller (1.1.0) lograge (0.11.1) actionpack (>= 4) activesupport (>= 4) @@ -307,9 +310,10 @@ GEM orm_adapter (0.5.0) ougai (1.7.1) oj (~> 3.4) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) + racc pg (1.2.3) pry (0.11.3) coderay (~> 1.1.0) @@ -356,7 +360,7 @@ GEM rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.1.0) ransack (4.1.1) activerecord (>= 6.1.5) @@ -373,7 +377,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.9.2) redis (>= 4, < 6) - regexp_parser (2.1.1) + regexp_parser (2.9.0) reline (0.3.8) io-console (~> 0.5) request_store (1.4.1) @@ -407,21 +411,23 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.10.2) - rubocop (1.18.3) + rubocop (1.59.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.7.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.8.0) - parser (>= 3.0.1.1) - rubocop-performance (1.11.4) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - ruby-progressbar (1.11.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) safe_yaml (1.0.4) @@ -469,9 +475,18 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - standard (1.1.5) - rubocop (= 1.18.3) - rubocop-performance (= 1.11.4) + standard (1.33.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.59.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.3) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.3.1) + lint_roller (~> 1.1) + rubocop-performance (~> 1.20.2) standardrb (1.0.0) standard stimulus-rails (1.2.2) @@ -490,7 +505,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) - unicode-display_width (2.0.0) + unicode-display_width (2.5.0) unicode_utils (1.4.0) uri (0.10.3) version_gem (1.1.3) @@ -574,7 +589,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 3.0.6p216 + ruby 3.1.4p223 BUNDLED WITH 2.3.11 diff --git a/app/admin/field.rb b/app/admin/field.rb index 1bfa950..5a3c25d 100644 --- a/app/admin/field.rb +++ b/app/admin/field.rb @@ -29,7 +29,7 @@ def option_value_collection f.inputs do f.input :name, required: true f.input :input, as: :select, label: "Input Type", required: true, collection: Field::INPUT_TYPES, - include_blank: false + include_blank: false f.input :label f.input :placeholder, hint: "Value displayed when field is empty. Not used with select or radio." f.input :global_registry_attribute, hint: "Name of attribute on Person entity_type. Use '.' for nested " \ @@ -38,7 +38,7 @@ def option_value_collection end f.has_many :field_options, heading: "Options (select, radio)", allow_destroy: true, - sortable: :position do |options_f| + sortable: :position do |options_f| options_f.inputs do options_f.input :option_value, as: :select, label: "Option Value Label | Name", collection: option_value_collection end diff --git a/app/admin/form.rb b/app/admin/form.rb index af0f7e7..e3cdf41 100644 --- a/app/admin/form.rb +++ b/app/admin/form.rb @@ -63,8 +63,8 @@ f.inputs do f.input :name, required: true, hint: "Name used internally for form" f.input :campaign_codes, label: "Adobe Campaign", as: :select, include_blank: false, - collection: Service.active_admin_collection, multiple: true, - input_html: {class: :select2} + collection: Service.active_admin_collection, multiple: true, + input_html: {class: :select2} f.input :style, as: :select, collection: %w[basic inline], include_blank: false f.input :title, input_html: {maxlength: 2048, rows: 2}, hint: "Allows HTML. Optional" f.input :body, label: "Body Text", input_html: {maxlength: 4096, rows: 3}, hint: "Allows HTML. Optional" @@ -74,12 +74,12 @@ f.input :origin, hint: "Subscription origin. You must create another form if you want different origins on the " \ "same campaign." f.input :success, label: "Success Message", - input_html: {maxlength: 4096, rows: 3, value: f.object.success || Form::DEFAULT_SUCCESS}, - hint: "Allows HTML. Optional" - f.input :use_recaptcha, as: :boolean, label: "Use reCAPTCHA?", input_html: {'data-toggle': "#recaptcha_keys"}, - hint: 'If using recaptcha v2, requires configuring an Invisible ' \ - "reCAPTCHA".html_safe # rubocop:disable Rails/OutputSafety + input_html: {maxlength: 4096, rows: 3, value: f.object.success || Form::DEFAULT_SUCCESS}, + hint: "Allows HTML. Optional" + f.input :use_recaptcha, as: :boolean, label: "Use reCAPTCHA?", input_html: {"data-toggle": "#recaptcha_keys"}, + hint: 'If using recaptcha v2, requires configuring an Invisible ' \ + "reCAPTCHA".html_safe # rubocop:disable Rails/OutputSafety f.input :recaptcha_v3, label: "Use new v3 reCAPTCHA" f.input :recaptcha_v3_threshold, hint: "1.0 is very likely a good interaction, 0.0 is very likely a bot. Submissions less than this value will be rejected." f.inputs name: "reCAPTCHA Keys", id: "recaptcha_keys", style: f.object.use_recaptcha ? "" : "display: none;" do @@ -93,18 +93,18 @@ fields_f.inputs do fields_f.input :field, include_blank: false, input_html: {class: "form_form_fields_select"}, - collection: Field.all.map { |field| [field.name, field.id, 'data-field-type': field.input] } + collection: Field.all.map { |field| [field.name, field.id, "data-field-type": field.input] } fields_f.input :label, hint: "Override field label. Leave blank to use default field label." fields_f.input :placeholder, hint: "Override field placeholder." fields_f.input :help, hint: "Optional help message." fields_f.input :required, as: :boolean, label: "Is field required?" fields_f.input :persist, as: :boolean, label: "Store/retrieve value from other forms?" fields_f.has_many :campaign_options, allow_destroy: true, sortable: :position, - heading: "Campaigns" do |campaigns_f| + heading: "Campaigns" do |campaigns_f| campaigns_f.inputs do campaigns_f.input :campaign_code, label: "Campaign", as: :select, include_blank: false, - collection: Service.active_admin_collection, - input_html: {class: :select2} + collection: Service.active_admin_collection, + input_html: {class: :select2} campaigns_f.input :label, hint: "Override Campaign name. Leave blank to use default name." end end diff --git a/app/controllers/forms_controller.rb b/app/controllers/forms_controller.rb index 6951f88..4e91f88 100644 --- a/app/controllers/forms_controller.rb +++ b/app/controllers/forms_controller.rb @@ -63,7 +63,7 @@ def campaign_codes codes = @form.campaign_codes || [] names = @form.form_fields.joins(:field).where(fields: {input: "campaign"})&.map { |field| field.name } names.each do |name| - codes += (@profile.params[name] || []) + codes += @profile.params[name] || [] end codes end diff --git a/app/models/master_person_id.rb b/app/models/master_person_id.rb index 0ea929d..0248f05 100644 --- a/app/models/master_person_id.rb +++ b/app/models/master_person_id.rb @@ -24,8 +24,8 @@ def find_or_create_id def find_entities_by_email params = {entity_type: :person, fields: "master_person:relationship", - 'filters[email_address][email]': email_address, - 'filters[owned_by]': "all", per_page: 1} + "filters[email_address][email]": email_address, + "filters[owned_by]": "all", per_page: 1} Array.wrap(GlobalRegistry::Entity.get(params)&.dig("entities")) rescue RestClient::BadRequest [] diff --git a/config/application.rb b/config/application.rb index 9a8c6ba..e297a8c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -32,7 +32,7 @@ class Application < Rails::Application # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") - redis_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "redis.yml"))).result, [Symbol], [], true)["cache"] + redis_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "redis.yml"))).result, permitted_classes: [Symbol], aliases: true)["cache"] redis_conf[:url] = "redis://" + redis_conf[:host] + "/" + redis_conf[:db].to_s config.cache_store = :redis_cache_store, redis_conf diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index b4de370..d9b5ca1 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -2,6 +2,6 @@ require "redis" -redis_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "redis.yml"))).result, [Symbol], [], true)["session"] +redis_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "redis.yml"))).result, permitted_classes: [Symbol], aliases: true)["session"] Rails.application.config.session_store :redis_store, servers: [redis_conf], expire_after: 2.hours diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index b6de1f3..77aefab 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -4,7 +4,7 @@ require "sidekiq-unique-jobs" require "datadog/statsd" -redis_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "redis.yml"))).result, [Symbol], [], true)["sidekiq"] +redis_conf = YAML.safe_load(ERB.new(File.read(Rails.root.join("config", "redis.yml"))).result, permitted_classes: [Symbol], aliases: true)["sidekiq"] redis_settings = {url: Redis.new(redis_conf).id} diff --git a/spec/models/master_person_id_spec.rb b/spec/models/master_person_id_spec.rb index e6aa4ce..20ad319 100644 --- a/spec/models/master_person_id_spec.rb +++ b/spec/models/master_person_id_spec.rb @@ -36,7 +36,7 @@ body = { entities: { person: { - 'master_person:relationship': [ + "master_person:relationship": [ {master_person: {id: id}} ] } @@ -46,8 +46,8 @@ .with(query: { entity_type: "person", fields: "master_person:relationship", - 'filters[email_address][email]': email_address, - 'filters[owned_by]': "all", + "filters[email_address][email]": email_address, + "filters[owned_by]": "all", per_page: 1 }) .to_return(body: body.to_json) @@ -74,8 +74,8 @@ .with(query: { entity_type: "person", fields: "master_person:relationship", - 'filters[email_address][email]': @email_address, - 'filters[owned_by]': "all", + "filters[email_address][email]": @email_address, + "filters[owned_by]": "all", per_page: 1 }) form = build(:form) @@ -87,7 +87,7 @@ it "calls global registry" do # Prepare person = {person: { - 'master_person:relationship': [ + "master_person:relationship": [ {master_person: {id: @id}} ] }} diff --git a/spec/workers/adobe_campaign_worker_spec.rb b/spec/workers/adobe_campaign_worker_spec.rb index 368559d..96fb581 100644 --- a/spec/workers/adobe_campaign_worker_spec.rb +++ b/spec/workers/adobe_campaign_worker_spec.rb @@ -41,7 +41,7 @@ expect(campaign_worker.params).to eq(params) expect(campaign_worker.campaign_codes).to eq([campaign_code]) expect(campaign_worker.master_person_id).to eq(master_person_id) - expect(campaign_worker.instance_variable_get("@adobe_profile")).to eq(adobe_profile) + expect(campaign_worker.instance_variable_get(:@adobe_profile)).to eq(adobe_profile) end it "supports multiple campaign_codes" do @@ -75,7 +75,7 @@ expect(campaign_worker.params).to eq(params) expect(campaign_worker.campaign_codes).to eq(campaign_codes) expect(campaign_worker.master_person_id).to eq(master_person_id) - expect(campaign_worker.instance_variable_get("@adobe_profile")).to eq(adobe_profile) + expect(campaign_worker.instance_variable_get(:@adobe_profile)).to eq(adobe_profile) end it "should do nothing if the form does not exist" do