shopify_api 4.6.0 → 4.7.0

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: aa938b8a6b1e983a6b569571b2f0c8d191a374c6
4
- data.tar.gz: e15f2478aeaac3834b047a007ee30847fb947896
3
+ metadata.gz: b372c851db7445d6687816c3d008810155b61504
4
+ data.tar.gz: 488e2b61967bed7464f0ebf24cec6554e0f961da
5
5
  SHA512:
6
- metadata.gz: 3f3cbeba1953b0c4b65e8a0f62909e804cc59c3d8ea1d136c74604d64c98ed9cee9cd403fb350b885d2eab7cae71d1a625ec1c7cbc9f97b0fc2d7f9a5d1ce64f
7
- data.tar.gz: f7deef5d9438c1b6a7e000aa59e9580c6194e47a2268e95c10dc6138201691acb73faac2c27140611688aa1857cbcf7e9b7fd0f4b94f6691a5246d425f658380
6
+ metadata.gz: 1b6e947edf820c32391fc11e8c4f4c4b2acb4899db0a174fa25b456ec0e23a221b27c5442ad98a33b2361ecd0d2db87615af59051c9412b837c4264ed99e329c
7
+ data.tar.gz: '099a49bff83d8115709f24b5a48afd90f3bef9e7fe35448a4ab5341785b1fc9bb64dbce1f7c31b3e8fb5d7eaeb6cb26fea44ae129bcbea8309666535012e3f8d'
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == Version 4.7.0
2
+
3
+ * Removed the mandatory `application_id` parameter from `ShopifyAPI::ProductListing` and `ShopifyAPI::CollectionListing`
4
+ * Fixed a bug related to the non-standard primary key for `ShopifyAPI::ProductListing` and `ShopifyAPI::CollectionListing`
5
+
1
6
  == Version 4.6.0
2
7
 
3
8
  * Added `ShopifyAPI::Report`
@@ -1,9 +1,9 @@
1
1
  module ShopifyAPI
2
2
  class CollectionListing < Base
3
- init_prefix :application
3
+ self.primary_key = :collection_id
4
4
 
5
- def product_ids(options = {})
6
- get("#{collection_id}/product_ids", options[:params])
5
+ def product_ids
6
+ get(:product_ids)
7
7
  end
8
8
  end
9
9
  end
@@ -1,9 +1,9 @@
1
1
  module ShopifyAPI
2
2
  class ProductListing < Base
3
- init_prefix :application
3
+ self.primary_key = :product_id
4
4
 
5
- def self.product_ids(options = {})
6
- get(:product_ids, options[:params])
5
+ def self.product_ids
6
+ get(:product_ids)
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "4.6.0"
2
+ VERSION = "4.7.0"
3
3
  end
@@ -3,23 +3,39 @@ require 'test_helper'
3
3
  class CollectionListingTest < Test::Unit::TestCase
4
4
 
5
5
  def test_get_collection_listings
6
- fake "applications/999/collection_listings", method: :get, status: 201, body: load_fixture('collection_listings')
6
+ fake "collection_listings", method: :get, status: 201, body: load_fixture('collection_listings')
7
7
 
8
- collection_listings = ShopifyAPI::CollectionListing.find(:all, params: { application_id: 999 })
8
+ collection_listings = ShopifyAPI::CollectionListing.find(:all)
9
9
 
10
10
  assert_equal 1, collection_listings.count
11
11
  assert_equal 1, collection_listings.first.collection_id
12
12
  assert_equal 'Home page', collection_listings.first.title
13
13
  end
14
14
 
15
- def test_get_collection_listing_for_collection_id
16
- fake "applications/999/collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing')
17
- fake "applications/999/collection_listings//1/product_ids", method: :get, status: 201, body: load_fixture('collection_listing_product_ids')
15
+ def test_get_collection_listing
16
+ fake "collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing')
18
17
 
19
- collection_listing = ShopifyAPI::CollectionListing.find(1, params: { application_id: 999 })
18
+ collection_listing = ShopifyAPI::CollectionListing.find(1)
20
19
 
21
20
  assert_equal 1, collection_listing.collection_id
22
21
  assert_equal 'Home page', collection_listing.title
22
+ end
23
+
24
+ def test_get_collection_listing_reload
25
+ fake "collection_listings/1", method: :get, status: 201, body: load_fixture('collection_listing')
26
+
27
+ collection_listing = ShopifyAPI::CollectionListing.new(collection_id: 1)
28
+ collection_listing.reload
29
+
30
+ assert_equal 1, collection_listing.collection_id
31
+ assert_equal 'Home page', collection_listing.title
32
+ end
33
+
34
+ def test_get_collection_listing_product_ids
35
+ fake "collection_listings/1/product_ids", method: :get, status: 201, body: load_fixture('collection_listing_product_ids')
36
+
37
+ collection_listing = ShopifyAPI::CollectionListing.new(collection_id: 1)
38
+
23
39
  assert_equal [1, 2], collection_listing.product_ids
24
40
  end
25
41
  end
@@ -3,9 +3,9 @@ require 'test_helper'
3
3
  class ProductListingTest < Test::Unit::TestCase
4
4
 
5
5
  def test_get_product_listings
6
- fake "applications/999/product_listings", method: :get, status: 201, body: load_fixture('product_listings')
6
+ fake "product_listings", method: :get, status: 201, body: load_fixture('product_listings')
7
7
 
8
- product_listings = ShopifyAPI::ProductListing.find(:all, params: { application_id: 999 })
8
+ product_listings = ShopifyAPI::ProductListing.find(:all)
9
9
  assert_equal 2, product_listings.count
10
10
  assert_equal 2, product_listings.first.product_id
11
11
  assert_equal 1, product_listings.last.product_id
@@ -13,17 +13,26 @@ class ProductListingTest < Test::Unit::TestCase
13
13
  assert_equal 'Rustic Copper Bottle', product_listings.last.title
14
14
  end
15
15
 
16
- def test_get_product_listing_for_product_id
17
- fake "applications/999/product_listings/2", method: :get, status: 201, body: load_fixture('product_listing')
16
+ def test_get_product_listing
17
+ fake "product_listings/2", method: :get, status: 201, body: load_fixture('product_listing')
18
+
19
+ product_listing = ShopifyAPI::ProductListing.find(2)
20
+ assert_equal 'Synergistic Silk Chair', product_listing.title
21
+ end
22
+
23
+ def test_reload_product_listing
24
+ fake "product_listings/2", method: :get, status: 201, body: load_fixture('product_listing')
25
+
26
+ product_listing = ShopifyAPI::ProductListing.new(product_id: 2)
27
+ product_listing.reload
18
28
 
19
- product_listing = ShopifyAPI::ProductListing.find(2, params: { application_id: 999 })
20
29
  assert_equal 'Synergistic Silk Chair', product_listing.title
21
30
  end
22
31
 
23
32
  def test_get_product_listing_product_ids
24
- fake "applications/999/product_listings/product_ids", method: :get, status: 201, body: load_fixture('product_listing_product_ids')
33
+ fake "product_listings/product_ids", method: :get, status: 201, body: load_fixture('product_listing_product_ids')
25
34
 
26
- product_ids = ShopifyAPI::ProductListing.product_ids(params: { application_id: 999 })
35
+ product_ids = ShopifyAPI::ProductListing.product_ids
27
36
  assert_equal 2, product_ids.count
28
37
  assert_equal 2, product_ids.first
29
38
  assert_equal 1, product_ids.last
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.6.0
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource