Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AdminVersions module name #927

Merged
merged 2 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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