shopify_api 5.2.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +1 -0
- data/.github/probots.yml +2 -0
- data/.gitignore +2 -0
- data/CHANGELOG +4 -0
- data/lib/active_resource/detailed_log_subscriber.rb +25 -2
- data/lib/shopify_api/connection.rb +5 -3
- data/lib/shopify_api/version.rb +1 -1
- data/service.yml +8 -0
- data/shopify_api.gemspec +2 -0
- data/test/detailed_log_subscriber_test.rb +19 -1
- data/test/test_helper.rb +1 -0
- metadata +34 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9c77838f7f17c68d5a215c1f7be62d2cbd7d14307435694070f8252efe222af
|
4
|
+
data.tar.gz: 0dc09a8b02adb8471380384683150949fe081eb8304bb1e7a0fd82ee1af28e48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d75774779c87aec609443674312a27d4c9b8530745ff7127bcb149ba6a01b84ebdfe0a986a04b07b7aa5be4c6e9ba8e88cafdd3f4ec41c530c87c12cd6ffe940
|
7
|
+
data.tar.gz: c22a07f6fb4af17fa6c9d76fc8e6e806e339e948a6d64481c5d29525d109cb0cff44dadf2b0b99ee18a16c94bf45941c47aeb821ab71c1f99ea1c43a67fcb75e
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @shopify/app-partner-dev-tools-education
|
data/.github/probots.yml
ADDED
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
module ActiveResource
|
2
2
|
class DetailedLogSubscriber < ActiveSupport::LogSubscriber
|
3
3
|
def request(event)
|
4
|
+
log_request_response_details(event)
|
5
|
+
warn_on_deprecated_header(event)
|
6
|
+
end
|
7
|
+
|
8
|
+
def logger
|
9
|
+
ActiveResource::Base.logger
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def log_request_response_details(event)
|
4
15
|
data = event.payload[:data]
|
5
16
|
headers = data.extract_options!
|
6
17
|
request_body = data.first
|
@@ -10,8 +21,20 @@ module ActiveResource
|
|
10
21
|
info "Response:\n#{event.payload[:response].body}"
|
11
22
|
end
|
12
23
|
|
13
|
-
def
|
14
|
-
|
24
|
+
def warn_on_deprecated_header(event)
|
25
|
+
payload = event.payload
|
26
|
+
|
27
|
+
payload[:response].each do |header_name, header_value|
|
28
|
+
case header_name.downcase
|
29
|
+
when 'x-shopify-api-deprecated-reason'
|
30
|
+
warning_message = <<~MSG
|
31
|
+
[DEPRECATED] ShopifyAPI made a call to #{payload[:method].upcase} #{payload[:path]}, and this call made
|
32
|
+
use of a deprecated endpoint, behaviour, or parameter. See #{header_value} for more details.
|
33
|
+
MSG
|
34
|
+
|
35
|
+
warn warning_message
|
36
|
+
end
|
37
|
+
end
|
15
38
|
end
|
16
39
|
end
|
17
40
|
end
|
@@ -13,15 +13,17 @@ module ShopifyAPI
|
|
13
13
|
module RequestNotification
|
14
14
|
def request(method, path, *arguments)
|
15
15
|
super.tap do |response|
|
16
|
-
notify_about_request(response, arguments)
|
16
|
+
notify_about_request(method, path, response, arguments)
|
17
17
|
end
|
18
18
|
rescue => e
|
19
|
-
notify_about_request(e.response, arguments) if e.respond_to?(:response)
|
19
|
+
notify_about_request(method, path, e.response, arguments) if e.respond_to?(:response)
|
20
20
|
raise
|
21
21
|
end
|
22
22
|
|
23
|
-
def notify_about_request(response, arguments)
|
23
|
+
def notify_about_request(method, path, response, arguments)
|
24
24
|
ActiveSupport::Notifications.instrument("request.active_resource_detailed") do |payload|
|
25
|
+
payload[:method] = method
|
26
|
+
payload[:path] = path
|
25
27
|
payload[:response] = response
|
26
28
|
payload[:data] = arguments
|
27
29
|
end
|
data/lib/shopify_api/version.rb
CHANGED
data/service.yml
ADDED
data/shopify_api.gemspec
CHANGED
@@ -30,7 +30,6 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
30
30
|
assert_match /\-\-\> 200/, @logger.logged(:info)[1]
|
31
31
|
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}}", @logger.logged(:info)[2]
|
32
32
|
assert_match /Response:\n\{\"page\"\:\{((\"id\"\:1)|(\"title\"\:\"Shopify API\")),((\"id\"\:1)|(\"title\"\:\"Shopify API\"))\}\}/, @logger.logged(:info)[3]
|
33
|
-
|
34
33
|
end
|
35
34
|
|
36
35
|
test "logging on #find with an error" do
|
@@ -46,4 +45,23 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
46
45
|
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}}", @logger.logged(:info)[2]
|
47
46
|
assert_equal "Response:", @logger.logged(:info)[3]
|
48
47
|
end
|
48
|
+
|
49
|
+
test "warns when the server responds with a x-shopify-api-deprecated-reason header" do
|
50
|
+
fake(
|
51
|
+
"pages/1",
|
52
|
+
method: :get,
|
53
|
+
body: @page,
|
54
|
+
x_shopify_api_deprecated_reason: 'https://help.shopify.com/en/api/getting-started/api-deprecations'
|
55
|
+
)
|
56
|
+
|
57
|
+
ShopifyAPI::Page.find(1)
|
58
|
+
|
59
|
+
assert_equal 1, @logger.logged(:warn).size
|
60
|
+
|
61
|
+
assert_match %r{\[DEPRECATED\] ShopifyAPI made a call to GET \/admin\/pages\/1.json}, @logger.logged(:warn).first
|
62
|
+
assert_match(
|
63
|
+
%r{See https:\/\/help.shopify.com\/en\/api\/getting-started\/api-deprecations for more details.},
|
64
|
+
@logger.logged(:warn).first
|
65
|
+
)
|
66
|
+
end
|
49
67
|
end
|
data/test/test_helper.rb
CHANGED
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: 5.2.
|
4
|
+
version: 5.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry-byebug
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description: The Shopify API gem allows Ruby developers to programmatically access
|
126
154
|
the admin section of Shopify stores. The API is implemented as JSON or XML over
|
127
155
|
HTTP using all four verbs (GET/POST/PUT/DELETE). Each resource, like Order, Product,
|
@@ -135,6 +163,8 @@ extra_rdoc_files:
|
|
135
163
|
- README.md
|
136
164
|
files:
|
137
165
|
- ".document"
|
166
|
+
- ".github/CODEOWNERS"
|
167
|
+
- ".github/probots.yml"
|
138
168
|
- ".gitignore"
|
139
169
|
- ".rubocop.yml"
|
140
170
|
- ".travis.yml"
|
@@ -254,6 +284,7 @@ files:
|
|
254
284
|
- lib/shopify_api/resources/webhook.rb
|
255
285
|
- lib/shopify_api/session.rb
|
256
286
|
- lib/shopify_api/version.rb
|
287
|
+
- service.yml
|
257
288
|
- shipit.rubygems.yml
|
258
289
|
- shopify_api.gemspec
|
259
290
|
- test/abandoned_checkouts_test.rb
|
@@ -445,7 +476,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
445
476
|
version: '0'
|
446
477
|
requirements: []
|
447
478
|
rubyforge_project:
|
448
|
-
rubygems_version: 2.6
|
479
|
+
rubygems_version: 2.7.6
|
449
480
|
signing_key:
|
450
481
|
specification_version: 4
|
451
482
|
summary: ShopifyAPI is a lightweight gem for accessing the Shopify admin REST web
|