shopify_api 4.7.0 → 4.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/lib/shopify_api/metafields.rb +4 -2
- data/lib/shopify_api/resources/shop.rb +3 -3
- data/lib/shopify_api/version.rb +1 -1
- data/test/draft_order_test.rb +14 -2
- data/test/fixtures/metafields.json +10 -0
- data/test/product_test.rb +14 -2
- data/test/shop_test.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd02395f105ed2a9d1c738643c5e2ce33f2b7107
|
4
|
+
data.tar.gz: 31e993b794581c144dc83ce3fb023aa92cf3904f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d6325e60332700d5902c83cc8883ddc5cf6c751408f0784aefa50ea646613a8e9c0ae1211009649edd9bc3fd031571f0d45842aa72c2aedc931765c1e2fc5b8
|
7
|
+
data.tar.gz: b177c8c1c42d318ec9fb935d2dc6aa198fa973bbc6766dcad3412503c3254727a321ecb5f0cd0a94af260dfa373a759166065e497cddbccc4b6e10103e9bca09
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== Version 4.7.1
|
2
|
+
|
3
|
+
* Added support for URL parameter (e.g. limit & page) to ShopifyAPI::Metafields
|
4
|
+
* Added support for URL parameter (e.g. limit & page) to metafield operator in ShopifyAPI::Shop
|
5
|
+
|
1
6
|
== Version 4.7.0
|
2
7
|
|
3
8
|
* Removed the mandatory `application_id` parameter from `ShopifyAPI::ProductListing` and `ShopifyAPI::CollectionListing`
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module ShopifyAPI
|
2
2
|
module Metafields
|
3
|
-
def metafields
|
4
|
-
|
3
|
+
def metafields(**options)
|
4
|
+
options.merge! resource: self.class.collection_name, resource_id: id
|
5
|
+
|
6
|
+
Metafield.find :all, params: options
|
5
7
|
end
|
6
8
|
|
7
9
|
def add_metafield(metafield)
|
@@ -6,10 +6,10 @@ module ShopifyAPI
|
|
6
6
|
find(:one, options.merge({from: "/admin/shop.#{format.extension}"}))
|
7
7
|
end
|
8
8
|
|
9
|
-
def metafields
|
10
|
-
Metafield.find
|
9
|
+
def metafields(**options)
|
10
|
+
Metafield.find :all, params: options
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def add_metafield(metafield)
|
14
14
|
raise ArgumentError, "You can only add metafields to resource that has been saved" if new?
|
15
15
|
metafield.save
|
data/lib/shopify_api/version.rb
CHANGED
data/test/draft_order_test.rb
CHANGED
@@ -103,15 +103,27 @@ class DraftOrderTest < Test::Unit::TestCase
|
|
103
103
|
assert_equal '123@example.com', field.value
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
106
|
+
def test_get_all_metafields_for_draft_order
|
107
107
|
fake 'draft_orders/517119332/metafields', body: load_fixture('metafields')
|
108
108
|
|
109
109
|
metafields = @draft_order.metafields
|
110
110
|
|
111
|
-
assert_equal
|
111
|
+
assert_equal 3, metafields.length
|
112
112
|
assert metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) }
|
113
113
|
end
|
114
114
|
|
115
|
+
def test_get_2_metafields_for_draft_order
|
116
|
+
body = ActiveSupport::JSON.decode load_fixture 'metafields'
|
117
|
+
body['metafields'].slice! 2, 1
|
118
|
+
|
119
|
+
fake 'draft_orders/517119332/metafields.json?limit=2', body: body.to_json, extension: false
|
120
|
+
|
121
|
+
metafields = @draft_order.metafields limit: 2
|
122
|
+
|
123
|
+
assert_equal 2, metafields.length
|
124
|
+
assert metafields.all?{ |m| m.is_a? ShopifyAPI::Metafield }
|
125
|
+
end
|
126
|
+
|
115
127
|
def test_complete_draft_order_with_no_params
|
116
128
|
completed_fixture = load_fixture('draft_order_completed')
|
117
129
|
completed_draft = ActiveSupport::JSON.decode(completed_fixture)['draft_order']
|
@@ -19,6 +19,16 @@
|
|
19
19
|
"description": null,
|
20
20
|
"key": "phone",
|
21
21
|
"value_type": "string"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"created_at": "2017-04-24T20:14:24.031-04:00",
|
25
|
+
"updated_at": "2017-04-24T20:14:24.031-04:00",
|
26
|
+
"namespace": "contact",
|
27
|
+
"id": "72544103001",
|
28
|
+
"value": "Ottawa",
|
29
|
+
"description": null,
|
30
|
+
"key": "City",
|
31
|
+
"value_type": "string"
|
22
32
|
}
|
23
33
|
]
|
24
34
|
}
|
data/test/product_test.rb
CHANGED
@@ -19,13 +19,25 @@ class ProductTest < Test::Unit::TestCase
|
|
19
19
|
assert_equal "123@example.com", field.value
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def test_get_all_metafields_for_product
|
23
23
|
fake "products/632910392/metafields", :body => load_fixture('metafields')
|
24
24
|
|
25
25
|
metafields = @product.metafields
|
26
26
|
|
27
|
+
assert_equal 3, metafields.length
|
28
|
+
assert metafields.all?{ |m| m.is_a? ShopifyAPI::Metafield }
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_get_2_metafields_for_product
|
32
|
+
body = ActiveSupport::JSON.decode load_fixture 'metafields'
|
33
|
+
body['metafields'].slice! 2, 1
|
34
|
+
|
35
|
+
fake 'products/632910392/metafields.json?limit=2', body: body.to_json, extension: false
|
36
|
+
|
37
|
+
metafields = @product.metafields limit: 2
|
38
|
+
|
27
39
|
assert_equal 2, metafields.length
|
28
|
-
assert metafields.all?{|m| m.is_a?
|
40
|
+
assert metafields.all?{ |m| m.is_a? ShopifyAPI::Metafield }
|
29
41
|
end
|
30
42
|
|
31
43
|
def test_update_loaded_variant
|
data/test/shop_test.rb
CHANGED
@@ -25,15 +25,27 @@ class ShopTest < Test::Unit::TestCase
|
|
25
25
|
assert_equal "apple.myshopify.com", @shop.myshopify_domain
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def test_get_all_metafields_for_shop
|
29
29
|
fake "metafields"
|
30
30
|
|
31
31
|
metafields = @shop.metafields
|
32
32
|
|
33
|
-
assert_equal
|
33
|
+
assert_equal 3, metafields.length
|
34
34
|
assert metafields.all?{|m| m.is_a?(ShopifyAPI::Metafield)}
|
35
35
|
end
|
36
36
|
|
37
|
+
def test_get_2_metafields_for_shop
|
38
|
+
body = ActiveSupport::JSON.decode load_fixture 'metafields'
|
39
|
+
body['metafields'].slice! 2, 1
|
40
|
+
|
41
|
+
fake 'metafields.json?limit=2', body: body.to_json, extension: false
|
42
|
+
|
43
|
+
metafields = @shop.metafields limit: 2
|
44
|
+
|
45
|
+
assert_equal 2, metafields.length
|
46
|
+
assert metafields.all?{ |m| m.is_a? ShopifyAPI::Metafield }
|
47
|
+
end
|
48
|
+
|
37
49
|
def test_add_metafield
|
38
50
|
fake "metafields", :method => :post, :status => 201, :body =>load_fixture('metafield')
|
39
51
|
|
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.7.
|
4
|
+
version: 4.7.1
|
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-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|