shopify_api 9.0.1 → 9.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/docs/graphql.md +5 -0
- data/lib/shopify_api/graphql.rb +6 -2
- data/lib/shopify_api/version.rb +1 -1
- data/test/graphql_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecdf64046f5d81646d89f356cab1bbf7ca3aefddbba51a28901b723f0dec8e4b
|
4
|
+
data.tar.gz: a64041593db78180893580ec8b3581b7927c39452b2ad5004575aa0a7afc209d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 267a96c8839314b7bb195e0e1288d3bad23a9a5e4a524190e59a2ed2e9ffc2ba9f6f78e0a5d93d4edf56dbcbff15f387c2217893b62839c4faa6e969f2ff4fa3
|
7
|
+
data.tar.gz: 42d7b26d80dba411512c86e2be195899527ce106f8450a1b8b4fe6e073a363160431a72771ada837d8f0f008523fa5871b10e5da46c9ebffb3e67d04d724197e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## Version 9.0.2
|
2
|
+
|
3
|
+
* Added optional flag passed to `initialize_clients` to prevent from raising the `InvalidSchema` exception [#693](https://github.com/Shopify/shopify_api/pull/693)
|
4
|
+
|
1
5
|
## Version 9.0.1
|
2
6
|
|
3
7
|
* Added warning message if API version used is unsupported or soon to be unsupported [#685](https://github.com/Shopify/shopify_api/pull/685)
|
data/README.md
CHANGED
@@ -129,7 +129,7 @@ Public and Custom apps need an access token from each shop to access that shop's
|
|
129
129
|
|
130
130
|
After creating the permission URL, the user should be directed to this URL to approve the app.
|
131
131
|
|
132
|
-
Under the hood, the
|
132
|
+
Under the hood, the `create_permission_url` method is preparing the app to make the following request :
|
133
133
|
|
134
134
|
```
|
135
135
|
GET https://SHOP_NAME.myshopify.com/admin/oauth/authorize
|
data/docs/graphql.md
CHANGED
@@ -42,9 +42,14 @@ which enables tools like graphql-client to ensure your queries are valid in deve
|
|
42
42
|
So the first step in making GraphQL queries is having a local JSON file of Shopify's Admin schema.
|
43
43
|
This gem provides a `shopify_api:graphql:dump` Rake task to make it as easy as possible:
|
44
44
|
|
45
|
+
#### Private apps
|
45
46
|
```bash
|
46
47
|
$ rake shopify_api:graphql:dump SHOP_URL="https://API_KEY:PASSWORD@SHOP_NAME.myshopify.com" API_VERSION=2020-01
|
47
48
|
```
|
49
|
+
#### Public apps
|
50
|
+
```bash
|
51
|
+
$ rake shopify_api:graphql:dump SHOP_DOMAIN="SHOP_NAME.myshopify.com" ACCESS_TOKEN="SHOP_TOKEN" API_VERSION=2020-01
|
52
|
+
```
|
48
53
|
|
49
54
|
If successful `db/shopify_graphql_schemas/2020-01.json` will be created.
|
50
55
|
|
data/lib/shopify_api/graphql.rb
CHANGED
@@ -39,7 +39,7 @@ module ShopifyAPI
|
|
39
39
|
@_client_cache = {}
|
40
40
|
end
|
41
41
|
|
42
|
-
def initialize_clients
|
42
|
+
def initialize_clients(raise_on_invalid_schema: true)
|
43
43
|
initialize_client_cache
|
44
44
|
|
45
45
|
Dir.glob(schema_location.join("*.json")).each do |schema_file|
|
@@ -49,7 +49,11 @@ module ShopifyAPI
|
|
49
49
|
if matches
|
50
50
|
api_version = ShopifyAPI::ApiVersion.new(handle: matches[1])
|
51
51
|
else
|
52
|
-
|
52
|
+
if raise_on_invalid_schema
|
53
|
+
raise InvalidSchema, "Invalid schema file name `#{schema_file}`. Does not match format of: `<version>.json`."
|
54
|
+
else
|
55
|
+
next
|
56
|
+
end
|
53
57
|
end
|
54
58
|
|
55
59
|
schema = ::GraphQL::Client.load_schema(schema_file.to_s)
|
data/lib/shopify_api/version.rb
CHANGED
data/test/graphql_test.rb
CHANGED
@@ -53,6 +53,17 @@ class GraphQLTest < Test::Unit::TestCase
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
test '#initialize_clients does not raise if raise_on_invalid_schema is set to false' do
|
57
|
+
version_fixtures('unstable') do |dir|
|
58
|
+
ShopifyAPI::GraphQL.schema_location = dir
|
59
|
+
FileUtils.touch(ShopifyAPI::GraphQL.schema_location.join('nope.json'))
|
60
|
+
|
61
|
+
ShopifyAPI::GraphQL.initialize_clients(raise_on_invalid_schema: false)
|
62
|
+
|
63
|
+
assert ShopifyAPI::GraphQL.client('unstable')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
56
67
|
test '#client returns default schema if only one exists' do
|
57
68
|
version_fixtures('unstable') do |dir|
|
58
69
|
ShopifyAPI::Base.api_version = 'unstable'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0.
|
4
|
+
version: 9.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|