From 749e7f5f1623e64d7c1fc8017b4108d612955b34 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Mon, 27 Mar 2023 17:05:43 +0200 Subject: [PATCH] [API] Remove deprecated ApiHelpers::ATTRIBUTES Please use Spree::Api::Config now. Ref https://github.com/solidusio/solidus/pull/4039 --- api/app/helpers/spree/api/api_helpers.rb | 45 ------------------------ api/spec/helpers/api_helpers_spec.rb | 16 --------- 2 files changed, 61 deletions(-) delete mode 100644 api/spec/helpers/api_helpers_spec.rb diff --git a/api/app/helpers/spree/api/api_helpers.rb b/api/app/helpers/spree/api/api_helpers.rb index 15fc99d469c..d20089cd242 100644 --- a/api/app/helpers/spree/api/api_helpers.rb +++ b/api/app/helpers/spree/api/api_helpers.rb @@ -3,51 +3,6 @@ module Spree module Api module ApiHelpers - ATTRIBUTES = [ - :product_attributes, - :product_property_attributes, - :variant_attributes, - :image_attributes, - :option_value_attributes, - :order_attributes, - :line_item_attributes, - :option_type_attributes, - :payment_attributes, - :payment_method_attributes, - :shipment_attributes, - :taxonomy_attributes, - :taxon_attributes, - :address_attributes, - :country_attributes, - :state_attributes, - :adjustment_attributes, - :inventory_unit_attributes, - :customer_return_attributes, - :return_authorization_attributes, - :creditcard_attributes, - :payment_source_attributes, - :user_attributes, - :property_attributes, - :stock_location_attributes, - :stock_movement_attributes, - :stock_item_attributes, - :promotion_attributes, - :store_attributes, - :store_credit_history_attributes, - :variant_property_attributes - ] - - ATTRIBUTES.each do |attribute| - define_method attribute do - Spree::Api::Config.send(attribute) - end - - define_singleton_method attribute do - Spree::Deprecation.warn("Please use Spree::Api::Config::#{attribute} instead.") - Spree::Api::Config.send(attribute) - end - end - def required_fields_for(model) required_fields = model._validators.select do |_field, validations| validations.any? { |validation| validation.is_a?(ActiveModel::Validations::PresenceValidator) } diff --git a/api/spec/helpers/api_helpers_spec.rb b/api/spec/helpers/api_helpers_spec.rb deleted file mode 100644 index 14ea0b67faa..00000000000 --- a/api/spec/helpers/api_helpers_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Spree::Api::ApiHelpers, type: :helper do - describe 'attributes access' do - Spree::Api::ApiHelpers::ATTRIBUTES.each do |attribute| - it "warns about deprecated access for #{attribute}" do - expect(Spree::Deprecation).to receive(:warn). - with("Please use Spree::Api::Config::#{attribute} instead.") - - expect(Spree::Api::ApiHelpers.send(attribute)).to eq( - Spree::Api::Config.send(attribute) - ) - end - end - end -end