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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41efd1e1afb47d485a202a84c325a3d312ff4321
4
- data.tar.gz: de1ef75a389706909b1dfa40b51bf8ac53dfedfe
3
+ metadata.gz: 35549cc8cbf97caf5ad176ba2f743e181ed74419
4
+ data.tar.gz: 6a90d8fc251927890d1d8340eb9bff7e1140a86d
5
5
  SHA512:
6
- metadata.gz: aa91228ac963eceafb36b5cdcae45d468acd9f44e4fa2ff34c7c536b2cafece42a0c4e03c46e6142ed99d403e387892d29016d88aaa575327ed46643e9fec39b
7
- data.tar.gz: 83fe534e2642124dbfb5d2c1e6a6538831508ec87d0dc277c50be7353d588d289049c61e40cfab48e2d00fad814a525460b15949c7ff165aa9d3f623feef6683
6
+ metadata.gz: 608359e56103200d49bb68abf00660e9c415153d1d4df3200fac45bd0abc30685d61fc52bd36bf24918591b930c80b2e4c77f85e041ba6be7e893471f1bcd237
7
+ data.tar.gz: dcffb206345ecca1015353be4c60264f79eaf20a1349627ea127989d8a53871c7bef7a47caef407ba9f919f918e8c1e3b65bf00f02b8896a3626cd23775b622f
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == Version 4.3.8
2
+
3
+ * Added `ShopifyAPI::ResourceFeedback`
4
+
1
5
  == Version 4.3.7
2
6
 
3
7
  * Added support for `complete` in `ShopifyAPI::DraftOrder`
@@ -81,6 +81,7 @@ module ShopifyAPI
81
81
  end
82
82
 
83
83
  private
84
+
84
85
  def only_id
85
86
  encode(:only => :id, :include => [], :methods => [])
86
87
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "4.3.7"
2
+ VERSION = "4.3.8"
3
3
  end
@@ -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.7
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-02-24 00:00:00.000000000 Z
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