shopify_api 4.3.7 → 4.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/shopify_api/resources/base.rb +1 -0
- data/lib/shopify_api/resources/resource_feedback.rb +18 -0
- data/lib/shopify_api/version.rb +1 -1
- data/test/resource_feedback_test.rb +28 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35549cc8cbf97caf5ad176ba2f743e181ed74419
|
4
|
+
data.tar.gz: 6a90d8fc251927890d1d8340eb9bff7e1140a86d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 608359e56103200d49bb68abf00660e9c415153d1d4df3200fac45bd0abc30685d61fc52bd36bf24918591b930c80b2e4c77f85e041ba6be7e893471f1bcd237
|
7
|
+
data.tar.gz: dcffb206345ecca1015353be4c60264f79eaf20a1349627ea127989d8a53871c7bef7a47caef407ba9f919f918e8c1e3b65bf00f02b8896a3626cd23775b622f
|
data/CHANGELOG
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopifyAPI
|
4
|
+
class ResourceFeedback < Base
|
5
|
+
class ExistingFeedbackSaved < StandardError; end
|
6
|
+
include DisablePrefixCheck
|
7
|
+
|
8
|
+
conditional_prefix :product, false
|
9
|
+
|
10
|
+
EXISTING_FEEDBACK_SAVED_ERROR_MESSAGE = 'WARNING: Attempted call to ShopifyAPI::ResourceFeedback#save' \
|
11
|
+
'after it was already persisted. Updating an existing ShopifyAPI::ResourceFeedback is not supported.'
|
12
|
+
|
13
|
+
def save
|
14
|
+
return super unless persisted?
|
15
|
+
raise ExistingFeedbackSaved.new(EXISTING_FEEDBACK_SAVED_ERROR_MESSAGE)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/shopify_api/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
class ResourceFeedbackTest < Test::Unit::TestCase
|
2
|
+
def test_save_with_resource_feedbacks_endpoint
|
3
|
+
body = { resource_feedback: {} }.to_json
|
4
|
+
fake 'resource_feedbacks', method: :post, body: body
|
5
|
+
ShopifyAPI::ResourceFeedback.new.save
|
6
|
+
assert_request_body body
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_save_with_product_id_resource_feedbacks_endpoint
|
10
|
+
body = { resource_feedback: {} }.to_json
|
11
|
+
fake 'products/42/resource_feedbacks', method: :post, body: body
|
12
|
+
ShopifyAPI::ResourceFeedback.new(product_id: 42).save
|
13
|
+
assert_request_body body
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_save_raises_exception_when_already_persisted
|
17
|
+
body = { resource_feedback: {} }.to_json
|
18
|
+
fake 'resource_feedbacks', method: :post, body: body
|
19
|
+
resource_feedback = ShopifyAPI::ResourceFeedback.new
|
20
|
+
resource_feedback.save
|
21
|
+
assert_request_body body
|
22
|
+
|
23
|
+
ShopifyAPI::ResourceFeedback.any_instance.expects(:persisted?).returns(true)
|
24
|
+
assert_raises ShopifyAPI::ResourceFeedback::ExistingFeedbackSaved do
|
25
|
+
resource_feedback.save
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
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: 4.3.
|
4
|
+
version: 4.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/shopify_api/resources/recurring_application_charge.rb
|
201
201
|
- lib/shopify_api/resources/redirect.rb
|
202
202
|
- lib/shopify_api/resources/refund.rb
|
203
|
+
- lib/shopify_api/resources/resource_feedback.rb
|
203
204
|
- lib/shopify_api/resources/rule.rb
|
204
205
|
- lib/shopify_api/resources/script_tag.rb
|
205
206
|
- lib/shopify_api/resources/shipping_address.rb
|
@@ -333,6 +334,7 @@ files:
|
|
333
334
|
- test/recurring_application_charge_test.rb
|
334
335
|
- test/redirect_test.rb
|
335
336
|
- test/refund_test.rb
|
337
|
+
- test/resource_feedback_test.rb
|
336
338
|
- test/script_tag_test.rb
|
337
339
|
- test/session_test.rb
|
338
340
|
- test/shipping_zone_test.rb
|