From 4b46ce1fd9d3e20d885dc25cd97b8218d58bdb8b Mon Sep 17 00:00:00 2001 From: Paulo Margarido <64600052+paulomarg@users.noreply.github.com> Date: Mon, 11 Apr 2022 12:11:45 -0400 Subject: [PATCH 1/2] Fix AdminVersions loading --- lib/shopify_api/admin_versions.rb | 23 ++++++++++++++--------- lib/shopify_api/context.rb | 4 ++-- test/admin_versions_test.rb | 4 ++-- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/shopify_api/admin_versions.rb b/lib/shopify_api/admin_versions.rb index 6dc4e09e9..c05b02feb 100644 --- a/lib/shopify_api/admin_versions.rb +++ b/lib/shopify_api/admin_versions.rb @@ -2,14 +2,19 @@ # frozen_string_literal: true module ShopifyAPI - SUPPORTED_ADMIN_VERSIONS = T.let([ - "unstable", - "2022-04", - "2022-01", - "2021-10", - "2021-07", - "2021-04", - ], T::Array[String]) + module AdminVersions + SUPPORTED_ADMIN_VERSIONS = T.let([ + "unstable", + "2022-04", + "2022-01", + "2021-10", + "2021-07", + "2021-04", + ], T::Array[String]) - LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-01", String) + LATEST_SUPPORTED_ADMIN_VERSION = T.let("2022-01", String) + end + + SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS + LATEST_SUPPORTED_ADMIN_VERSION = ShopifyAPI::AdminVersions::LATEST_SUPPORTED_ADMIN_VERSION end diff --git a/lib/shopify_api/context.rb b/lib/shopify_api/context.rb index e72ff978d..6c95d63c5 100644 --- a/lib/shopify_api/context.rb +++ b/lib/shopify_api/context.rb @@ -52,9 +52,9 @@ def setup( private_shop: nil, user_agent_prefix: nil ) - unless SUPPORTED_ADMIN_VERSIONS.include?(api_version) + unless ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS.include?(api_version) raise Errors::UnsupportedVersionError, - "Invalid vession #{api_version}, supported versions: #{SUPPORTED_ADMIN_VERSIONS}" + "Invalid vession #{api_version}, supported versions: #{ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS}" end @api_key = api_key diff --git a/test/admin_versions_test.rb b/test/admin_versions_test.rb index 3cd9795aa..6c0ab20e9 100644 --- a/test/admin_versions_test.rb +++ b/test/admin_versions_test.rb @@ -6,11 +6,11 @@ module ShopifyAPITest class AdminVersionsTest < Minitest::Test def test_supported_admin_versions - assert_instance_of(Array, ShopifyAPI::SUPPORTED_ADMIN_VERSIONS) + assert_instance_of(Array, ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS) end def test_supported_latest_supported_admin_version - assert_instance_of(String, ShopifyAPI::LATEST_SUPPORTED_ADMIN_VERSION) + assert_instance_of(String, ShopifyAPI::AdminVersions::LATEST_SUPPORTED_ADMIN_VERSION) end end end From eb43306d1d635b3e87a762789610f128462133cf Mon Sep 17 00:00:00 2001 From: Paulo Margarido <64600052+paulomarg@users.noreply.github.com> Date: Mon, 11 Apr 2022 12:18:57 -0400 Subject: [PATCH 2/2] Added changelog line --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94dee7ab8..1291bf19b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#919](https://github.com/Shopify/shopify_api/pull/919) Allow REST resources to configure a deny list of attributes to be excluded when saving - [#920](https://github.com/Shopify/shopify_api/pull/920) Set all values received from the API response to REST resource objects, and allow setting / getting attributes with special characters (such as `?`) +- [#927](https://github.com/Shopify/shopify_api/pull/927) Fix the `ShopifyAPI::AdminVersions` module for backward compatibility ## Version 10.0.0