Skip to content

Commit

Permalink
Merge pull request #927 from Shopify/fix_admin_version_module_name
Browse files Browse the repository at this point in the history
Fix AdminVersions module name
  • Loading branch information
paulomarg authored Apr 11, 2022
2 parents f4c2008 + eb43306 commit 7703c5e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 14 additions & 9 deletions lib/shopify_api/admin_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions lib/shopify_api/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/admin_versions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7703c5e

Please sign in to comment.