shopify_api 4.3.3 → 4.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dca094e5f7ccf2da9550944633cf38e5c0c8cab
4
- data.tar.gz: a7418ed1edea504c03d484f6b2ba57aa2f672424
3
+ metadata.gz: 386841f534181fd55d441707f8390b584eec290b
4
+ data.tar.gz: 6340fe9f3b19364404d631e2c2b5e0183ba393fe
5
5
  SHA512:
6
- metadata.gz: efcb9714f45426ddab3e895e919329fda0b66c7b920780180e9624d494ad4b5cb523f371ee336edeaced6850e7758b7840dd2db3a38b79fd12166cf59d805319
7
- data.tar.gz: 04202532fef99c805d47946a62095636b0bb1e3fe03d9671a23e7126432411eebd0cad2acf7ea1e45da73c6b9b268fec4dd2fece6ac04bfbe1d407157c5d5ac4
6
+ metadata.gz: 9fc10a61d17cb844293e3ab24b96164c6ed8b2a6c07df16ca92360886564122aaeea75326076fdbf056444753749b850c99bd5bfca44079cd13228ab1a5f8e0b
7
+ data.tar.gz: 1dba2ca970417275864f71ab97f136423801104c69f3e3c18a1643964564cf0520e1b35a41fdebf1cbbe8be8a3ea2d773f3215649ba780e99fe6616227d3833c
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == Version 4.3.4
2
+
3
+ * Added `ShopifyAPI::ProductListing`
4
+ * Added `ShopifyAPI::CollectionListing`
5
+
1
6
  == Version 4.3.3
2
7
 
3
8
  * Added `ShopifyAPI::StorefrontAccessToken`
@@ -0,0 +1,9 @@
1
+ module ShopifyAPI
2
+ class CollectionListing < Base
3
+ init_prefix :application
4
+
5
+ def product_ids(options = {})
6
+ get("#{collection_id}/product_ids", options[:params])
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module ShopifyAPI
2
+ class ProductListing < Base
3
+ init_prefix :application
4
+
5
+ def self.product_ids(options = {})
6
+ get(:product_ids, options[:params])
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "4.3.3"
2
+ VERSION = "4.3.4"
3
3
  end
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+
3
+ class CollectionListingTest < Test::Unit::TestCase
4
+
5
+ def test_get_collection_listings
6
+ fake "applications/999/collection_listings", method: :get, status: 201, body: load_fixture('collection_listings')
7
+
8
+ collection_listings = ShopifyAPI::CollectionListing.find(:all, params: { application_id: 999 })
9
+
10
+ assert_equal 1, collection_listings.count
11
+ assert_equal 1, collection_listings.first.collection_id
12
+ assert_equal 'Home page', collection_listings.first.title
13
+ end
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')
18
+
19
+ collection_listing = ShopifyAPI::CollectionListing.find(1, params: { application_id: 999 })
20
+
21
+ assert_equal 1, collection_listing.collection_id
22
+ assert_equal 'Home page', collection_listing.title
23
+ assert_equal [1, 2], collection_listing.product_ids
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ {
2
+ "collection_id": 1,
3
+ "updated_at": "2017-01-09T13:59:09-05:00",
4
+ "body_html": null,
5
+ "default_product_image": null,
6
+ "handle": "frontpage",
7
+ "image": null,
8
+ "title": "Home page",
9
+ "sort_order": "alpha-asc",
10
+ "published_at": "2017-01-09T13:59:09-05:00"
11
+ }
@@ -0,0 +1,13 @@
1
+ [
2
+ {
3
+ "collection_id": 1,
4
+ "updated_at": "2017-01-09T13:59:09-05:00",
5
+ "body_html": null,
6
+ "default_product_image": null,
7
+ "handle": "frontpage",
8
+ "image": null,
9
+ "title": "Home page",
10
+ "sort_order": "alpha-asc",
11
+ "published_at": "2017-01-09T13:59:09-05:00"
12
+ }
13
+ ]
@@ -0,0 +1,86 @@
1
+ {
2
+ "product_id": 2,
3
+ "created_at": "2017-01-06T14:52:56-05:00",
4
+ "updated_at": "2017-01-06T14:52:56-05:00",
5
+ "body_html": null,
6
+ "handle": "synergistic-silk-chair",
7
+ "product_type": "morph magnetic solutions",
8
+ "title": "Synergistic Silk Chair",
9
+ "vendor": "O'Hara, Fritsch and Hudson",
10
+ "available": true,
11
+ "tags": "",
12
+ "published_at": "2017-01-06T14:52:53-05:00",
13
+ "images": [
14
+
15
+ ],
16
+ "options": [
17
+ {
18
+ "id": 2,
19
+ "name": "Color or something",
20
+ "product_id": 2,
21
+ "position": 1
22
+ }
23
+ ],
24
+ "variants": [
25
+ {
26
+ "id": 3,
27
+ "title": "Aerodynamic Copper Clock",
28
+ "option_values": [
29
+ {
30
+ "option_id": 2,
31
+ "name": "Color or something",
32
+ "value": "Aerodynamic Copper Clock"
33
+ }
34
+ ],
35
+ "price": "179.99",
36
+ "formatted_price": "$179.99",
37
+ "compare_at_price": null,
38
+ "grams": 8400,
39
+ "requires_shipping": true,
40
+ "sku": "",
41
+ "barcode": null,
42
+ "taxable": true,
43
+ "position": 1,
44
+ "available": true,
45
+ "inventory_policy": "deny",
46
+ "inventory_quantity": 810,
47
+ "inventory_management": "shopify",
48
+ "fulfillment_service": "manual",
49
+ "weight": 8.4,
50
+ "weight_unit": "kg",
51
+ "image_id": null,
52
+ "created_at": "2017-01-04T17:07:47-05:00",
53
+ "updated_at": "2017-01-04T17:07:47-05:00"
54
+ },
55
+ {
56
+ "id": 4,
57
+ "title": "Awesome Concrete Knife",
58
+ "option_values": [
59
+ {
60
+ "option_id": 2,
61
+ "name": "Color or something",
62
+ "value": "Awesome Concrete Knife"
63
+ }
64
+ ],
65
+ "price": "179.99",
66
+ "formatted_price": "$179.99",
67
+ "compare_at_price": null,
68
+ "grams": 8400,
69
+ "requires_shipping": true,
70
+ "sku": "",
71
+ "barcode": null,
72
+ "taxable": true,
73
+ "position": 2,
74
+ "available": true,
75
+ "inventory_policy": "deny",
76
+ "inventory_quantity": 1,
77
+ "inventory_management": null,
78
+ "fulfillment_service": "manual",
79
+ "weight": 8.4,
80
+ "weight_unit": "kg",
81
+ "image_id": null,
82
+ "created_at": "2017-01-04T17:07:47-05:00",
83
+ "updated_at": "2017-01-04T17:07:47-05:00"
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1 @@
1
+ [2, 1]
@@ -0,0 +1,174 @@
1
+ [
2
+ {
3
+ "product_id": 2,
4
+ "created_at": "2017-01-06T14:52:56-05:00",
5
+ "updated_at": "2017-01-06T14:52:56-05:00",
6
+ "body_html": null,
7
+ "handle": "synergistic-silk-chair",
8
+ "product_type": "morph magnetic solutions",
9
+ "title": "Synergistic Silk Chair",
10
+ "vendor": "O'Hara, Fritsch and Hudson",
11
+ "available": true,
12
+ "tags": "",
13
+ "published_at": "2017-01-06T14:52:53-05:00",
14
+ "images": [
15
+
16
+ ],
17
+ "options": [
18
+ {
19
+ "id": 2,
20
+ "name": "Color or something",
21
+ "product_id": 2,
22
+ "position": 1
23
+ }
24
+ ],
25
+ "variants": [
26
+ {
27
+ "id": 3,
28
+ "title": "Aerodynamic Copper Clock",
29
+ "option_values": [
30
+ {
31
+ "option_id": 2,
32
+ "name": "Color or something",
33
+ "value": "Aerodynamic Copper Clock"
34
+ }
35
+ ],
36
+ "price": "179.99",
37
+ "formatted_price": "$179.99",
38
+ "compare_at_price": null,
39
+ "grams": 8400,
40
+ "requires_shipping": true,
41
+ "sku": "",
42
+ "barcode": null,
43
+ "taxable": true,
44
+ "position": 1,
45
+ "available": true,
46
+ "inventory_policy": "deny",
47
+ "inventory_quantity": 810,
48
+ "inventory_management": "shopify",
49
+ "fulfillment_service": "manual",
50
+ "weight": 8.4,
51
+ "weight_unit": "kg",
52
+ "image_id": null,
53
+ "created_at": "2017-01-04T17:07:47-05:00",
54
+ "updated_at": "2017-01-04T17:07:47-05:00"
55
+ },
56
+ {
57
+ "id": 4,
58
+ "title": "Awesome Concrete Knife",
59
+ "option_values": [
60
+ {
61
+ "option_id": 2,
62
+ "name": "Color or something",
63
+ "value": "Awesome Concrete Knife"
64
+ }
65
+ ],
66
+ "price": "179.99",
67
+ "formatted_price": "$179.99",
68
+ "compare_at_price": null,
69
+ "grams": 8400,
70
+ "requires_shipping": true,
71
+ "sku": "",
72
+ "barcode": null,
73
+ "taxable": true,
74
+ "position": 2,
75
+ "available": true,
76
+ "inventory_policy": "deny",
77
+ "inventory_quantity": 1,
78
+ "inventory_management": null,
79
+ "fulfillment_service": "manual",
80
+ "weight": 8.4,
81
+ "weight_unit": "kg",
82
+ "image_id": null,
83
+ "created_at": "2017-01-04T17:07:47-05:00",
84
+ "updated_at": "2017-01-04T17:07:47-05:00"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "product_id": 1,
90
+ "created_at": "2017-01-06T14:52:54-05:00",
91
+ "updated_at": "2017-01-06T14:52:54-05:00",
92
+ "body_html": null,
93
+ "handle": "rustic-copper-bottle",
94
+ "product_type": "maximize viral channels",
95
+ "title": "Rustic Copper Bottle",
96
+ "vendor": "Kuphal and Sons",
97
+ "available": true,
98
+ "tags": "",
99
+ "published_at": "2017-01-06T14:52:52-05:00",
100
+ "images": [
101
+
102
+ ],
103
+ "options": [
104
+ {
105
+ "id": 1,
106
+ "name": "Color or something",
107
+ "product_id": 1,
108
+ "position": 1
109
+ }
110
+ ],
111
+ "variants": [
112
+ {
113
+ "id": 1,
114
+ "title": "Awesome Bronze Hat",
115
+ "option_values": [
116
+ {
117
+ "option_id": 1,
118
+ "name": "Color or something",
119
+ "value": "Awesome Bronze Hat"
120
+ }
121
+ ],
122
+ "price": "111.99",
123
+ "formatted_price": "$111.99",
124
+ "compare_at_price": null,
125
+ "grams": 1800,
126
+ "requires_shipping": true,
127
+ "sku": "",
128
+ "barcode": null,
129
+ "taxable": true,
130
+ "position": 1,
131
+ "available": true,
132
+ "inventory_policy": "deny",
133
+ "inventory_quantity": 65,
134
+ "inventory_management": "shopify",
135
+ "fulfillment_service": "manual",
136
+ "weight": 1.8,
137
+ "weight_unit": "kg",
138
+ "image_id": null,
139
+ "created_at": "2017-01-04T17:07:07-05:00",
140
+ "updated_at": "2017-01-04T17:07:07-05:00"
141
+ },
142
+ {
143
+ "id": 2,
144
+ "title": "Rustic Marble Bottle",
145
+ "option_values": [
146
+ {
147
+ "option_id": 1,
148
+ "name": "Color or something",
149
+ "value": "Rustic Marble Bottle"
150
+ }
151
+ ],
152
+ "price": "111.99",
153
+ "formatted_price": "$111.99",
154
+ "compare_at_price": null,
155
+ "grams": 1800,
156
+ "requires_shipping": true,
157
+ "sku": "",
158
+ "barcode": null,
159
+ "taxable": true,
160
+ "position": 2,
161
+ "available": true,
162
+ "inventory_policy": "deny",
163
+ "inventory_quantity": 1,
164
+ "inventory_management": null,
165
+ "fulfillment_service": "manual",
166
+ "weight": 1.8,
167
+ "weight_unit": "kg",
168
+ "image_id": null,
169
+ "created_at": "2017-01-04T17:07:07-05:00",
170
+ "updated_at": "2017-01-04T17:07:07-05:00"
171
+ }
172
+ ]
173
+ }
174
+ ]
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class ProductListingTest < Test::Unit::TestCase
4
+
5
+ def test_get_product_listings
6
+ fake "applications/999/product_listings", method: :get, status: 201, body: load_fixture('product_listings')
7
+
8
+ product_listings = ShopifyAPI::ProductListing.find(:all, params: { application_id: 999 })
9
+ assert_equal 2, product_listings.count
10
+ assert_equal 2, product_listings.first.product_id
11
+ assert_equal 1, product_listings.last.product_id
12
+ assert_equal 'Synergistic Silk Chair', product_listings.first.title
13
+ assert_equal 'Rustic Copper Bottle', product_listings.last.title
14
+ end
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')
18
+
19
+ product_listing = ShopifyAPI::ProductListing.find(2, params: { application_id: 999 })
20
+ assert_equal 'Synergistic Silk Chair', product_listing.title
21
+ end
22
+
23
+ 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')
25
+
26
+ product_ids = ShopifyAPI::ProductListing.product_ids(params: { application_id: 999 })
27
+ assert_equal 2, product_ids.count
28
+ assert_equal 2, product_ids.first
29
+ assert_equal 1, product_ids.last
30
+ end
31
+ 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.3
4
+ version: 4.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-02 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -151,6 +151,7 @@ files:
151
151
  - lib/shopify_api/resources/cart.rb
152
152
  - lib/shopify_api/resources/checkout.rb
153
153
  - lib/shopify_api/resources/collect.rb
154
+ - lib/shopify_api/resources/collection_listing.rb
154
155
  - lib/shopify_api/resources/comment.rb
155
156
  - lib/shopify_api/resources/country.rb
156
157
  - lib/shopify_api/resources/custom_collection.rb
@@ -177,6 +178,7 @@ files:
177
178
  - lib/shopify_api/resources/payment_details.rb
178
179
  - lib/shopify_api/resources/policy.rb
179
180
  - lib/shopify_api/resources/product.rb
181
+ - lib/shopify_api/resources/product_listing.rb
180
182
  - lib/shopify_api/resources/province.rb
181
183
  - lib/shopify_api/resources/receipt.rb
182
184
  - lib/shopify_api/resources/recurring_application_charge.rb
@@ -214,6 +216,7 @@ files:
214
216
  - test/cart_test.rb
215
217
  - test/checkouts_test.rb
216
218
  - test/collect_test.rb
219
+ - test/collection_listing_test.rb
217
220
  - test/countable_test.rb
218
221
  - test/custom_collection_test.rb
219
222
  - test/customer_saved_search_test.rb
@@ -236,6 +239,9 @@ files:
236
239
  - test/fixtures/carts.json
237
240
  - test/fixtures/checkouts.json
238
241
  - test/fixtures/collect.json
242
+ - test/fixtures/collection_listing.json
243
+ - test/fixtures/collection_listing_product_ids.json
244
+ - test/fixtures/collection_listings.json
239
245
  - test/fixtures/custom_collection.json
240
246
  - test/fixtures/customer_saved_search.json
241
247
  - test/fixtures/customer_saved_search_customers.json
@@ -263,6 +269,9 @@ files:
263
269
  - test/fixtures/orders.json
264
270
  - test/fixtures/policies.json
265
271
  - test/fixtures/product.json
272
+ - test/fixtures/product_listing.json
273
+ - test/fixtures/product_listing_product_ids.json
274
+ - test/fixtures/product_listings.json
266
275
  - test/fixtures/recurring_application_charge.json
267
276
  - test/fixtures/recurring_application_charge_adjustment.json
268
277
  - test/fixtures/recurring_application_charges.json
@@ -298,6 +307,7 @@ files:
298
307
  - test/order_risk_test.rb
299
308
  - test/order_test.rb
300
309
  - test/policy_test.rb
310
+ - test/product_listing_test.rb
301
311
  - test/product_test.rb
302
312
  - test/recurring_application_charge_test.rb
303
313
  - test/redirect_test.rb