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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38767c160ec90d95eef7de111c88159b0e3c9cb2d5c5e652dfa4358e18ce79d0
4
- data.tar.gz: b43efeb96b3a0afa293f654ec3544fa3c5742ad9be26a944ea9f9f101c290afa
3
+ metadata.gz: ecdf64046f5d81646d89f356cab1bbf7ca3aefddbba51a28901b723f0dec8e4b
4
+ data.tar.gz: a64041593db78180893580ec8b3581b7927c39452b2ad5004575aa0a7afc209d
5
5
  SHA512:
6
- metadata.gz: 99051f65afc34c7c00e28f1bd2cb73e0e009786468f386372003557f1de1c05b587ae9c46e0bf7c49531269e778fa2528a92aca176f9ffcba1acd59f6383b103
7
- data.tar.gz: 440ca081056e1d68a3d3cc5164fb5ad7ef07f46a9aa076bc5c16290d2e6deef86d474fac2e836a72d4ebf3d1a72c21946429bc73b18b97120f67df2912009e4d
6
+ metadata.gz: 267a96c8839314b7bb195e0e1288d3bad23a9a5e4a524190e59a2ed2e9ffc2ba9f6f78e0a5d93d4edf56dbcbff15f387c2217893b62839c4faa6e969f2ff4fa3
7
+ data.tar.gz: 42d7b26d80dba411512c86e2be195899527ce106f8450a1b8b4fe6e073a363160431a72771ada837d8f0f008523fa5871b10e5da46c9ebffb3e67d04d724197e
@@ -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 the `create_permission_url` method is preparing the app to make the following request :
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
@@ -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
 
@@ -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
- raise InvalidSchema, "Invalid schema file name `#{schema_file}`. Does not match format of: `<version>.json`."
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)
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "9.0.1"
2
+ VERSION = "9.0.2"
3
3
  end
@@ -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.1
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-02-24 00:00:00.000000000 Z
11
+ date: 2020-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource