shopify_api 5.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/lib/shopify_api/resources/checkout.rb +4 -1
- data/lib/shopify_api/resources/currency.rb +6 -0
- data/lib/shopify_api/resources/tender_transaction.rb +6 -0
- data/lib/shopify_api/version.rb +1 -1
- data/test/checkouts_test.rb +5 -0
- data/test/currency_test.rb +21 -0
- data/test/detailed_log_subscriber_test.rb +2 -3
- data/test/fixtures/currencies.json +25 -0
- data/test/fixtures/tender_transactions.json +52 -0
- data/test/tender_transaction_test.rb +18 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c6dee9517f8b39f0509a1fc782c3fbd31f0acab
|
4
|
+
data.tar.gz: 9c7c14bccda5997dff52cfc9cfe102856896f134
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d18fbc6064f642bee7575ebbd4fd00919b852c201cebb0ee668e809163a13a289f22c5d886903479d71c0ee87dc3fa507abe14c210d9f9beecd6b418256cd2
|
7
|
+
data.tar.gz: a508c15999e3ca6b83a124fe5198200221bf76625cbc77755d23229b55950792ff6e45dcf547a6f933df0f627a84172aca5665f220fc0c98a2c1d13f1e67b6aa
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== Version 5.2.0
|
2
|
+
|
3
|
+
* Added `ShopifyAPI::Currency` to fetch list of supported currencies on a shop
|
4
|
+
* Added `ShopifyAPI::TenderTransaction` to fetch list of transactions on a shop
|
5
|
+
* Fixed bug with X-Shopify-Checkout-Version on ShopifyAPI::Checkout header being applied to all requests
|
6
|
+
|
1
7
|
== Version 5.1.0
|
2
8
|
|
3
9
|
* Added `ShopifyAPI::Publications`
|
data/lib/shopify_api/version.rb
CHANGED
data/test/checkouts_test.rb
CHANGED
@@ -9,6 +9,11 @@ class CheckoutsTest < Test::Unit::TestCase
|
|
9
9
|
@expected_checkout_id = JSON.parse(load_fixture('checkout'))['checkout']['token']
|
10
10
|
end
|
11
11
|
|
12
|
+
test ".headers includes a version" do
|
13
|
+
assert_equal "2016-09-06", ShopifyAPI::Checkout.headers["X-Shopify-Checkout-Version"]
|
14
|
+
assert_nil ShopifyAPI::Base.headers["X-Shopify-Checkout-Version"]
|
15
|
+
end
|
16
|
+
|
12
17
|
test ":create creates a checkout" do
|
13
18
|
fake 'checkouts', method: :post, status: 201, body: load_fixture('checkout')
|
14
19
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require 'test_helper'
|
4
|
+
class CurrencyTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
fake "currencies", method: :get, body: load_fixture('currencies')
|
8
|
+
end
|
9
|
+
|
10
|
+
context "Currency" do
|
11
|
+
should 'return a list of enabled currencies' do
|
12
|
+
currencies = ShopifyAPI::Currency.all
|
13
|
+
assert_equal 4, currencies.count
|
14
|
+
assert_equal %w(AUD EUR GBP HKD), currencies.map(&:currency)
|
15
|
+
assert_equal [true, true, true, false], currencies.map(&:enabled)
|
16
|
+
currencies.each do |currency|
|
17
|
+
assert_equal "2018-10-03T14:44:08-04:00", currency.rate_updated_at
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -8,7 +8,6 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
8
8
|
super
|
9
9
|
@page = { :page => { :id => 1, :title => 'Shopify API' } }.to_json
|
10
10
|
@ua_header = "\"User-Agent\"=>\"ShopifyAPI/#{ShopifyAPI::VERSION} ActiveResource/#{ActiveResource::VERSION::STRING} Ruby/#{RUBY_VERSION}\""
|
11
|
-
@ver_header = "\"X-Shopify-Checkout-Version\"=>\"2016-09-06\""
|
12
11
|
|
13
12
|
ShopifyAPI::Base.clear_session
|
14
13
|
ShopifyAPI::Base.site = "https://this-is-my-test-shop.myshopify.com/admin"
|
@@ -29,7 +28,7 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
29
28
|
assert_equal 4, @logger.logged(:info).size
|
30
29
|
assert_equal "GET https://this-is-my-test-shop.myshopify.com:443/admin/pages/1.json", @logger.logged(:info)[0]
|
31
30
|
assert_match /\-\-\> 200/, @logger.logged(:info)[1]
|
32
|
-
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}
|
31
|
+
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}}", @logger.logged(:info)[2]
|
33
32
|
assert_match /Response:\n\{\"page\"\:\{((\"id\"\:1)|(\"title\"\:\"Shopify API\")),((\"id\"\:1)|(\"title\"\:\"Shopify API\"))\}\}/, @logger.logged(:info)[3]
|
34
33
|
|
35
34
|
end
|
@@ -44,7 +43,7 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
44
43
|
assert_equal 4, @logger.logged(:info).size
|
45
44
|
assert_equal "GET https://this-is-my-test-shop.myshopify.com:443/admin/pages/2.json", @logger.logged(:info)[0]
|
46
45
|
assert_match /\-\-\> 404/, @logger.logged(:info)[1]
|
47
|
-
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}
|
46
|
+
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}}", @logger.logged(:info)[2]
|
48
47
|
assert_equal "Response:", @logger.logged(:info)[3]
|
49
48
|
end
|
50
49
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"currencies": [
|
3
|
+
{
|
4
|
+
"currency": "AUD",
|
5
|
+
"rate_updated_at": "2018-10-03T14:44:08-04:00",
|
6
|
+
"enabled": true
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"currency": "EUR",
|
10
|
+
"rate_updated_at": "2018-10-03T14:44:08-04:00",
|
11
|
+
"enabled": true
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"currency": "GBP",
|
15
|
+
"rate_updated_at": "2018-10-03T14:44:08-04:00",
|
16
|
+
"enabled": true
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"currency": "HKD",
|
20
|
+
"rate_updated_at": "2018-10-03T14:44:08-04:00",
|
21
|
+
"enabled": false
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
25
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
{
|
2
|
+
"tender_transactions": [
|
3
|
+
{
|
4
|
+
"id": 1,
|
5
|
+
"order_id": 450789469,
|
6
|
+
"amount": "138.46",
|
7
|
+
"currency": "CAD",
|
8
|
+
"user_id": null,
|
9
|
+
"test": true,
|
10
|
+
"processed_at": "2018-08-09T15:43:39-04:00",
|
11
|
+
"updated_at": "2018-08-09T15:43:41-04:00",
|
12
|
+
"remote_reference": "1118366",
|
13
|
+
"payment_method": "credit_card",
|
14
|
+
"payment_details": {
|
15
|
+
"credit_card_number": "•••• •••• •••• 1",
|
16
|
+
"credit_card_company": "Bogus"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"id": 2,
|
21
|
+
"order_id": 450789469,
|
22
|
+
"amount": "128.16",
|
23
|
+
"currency": "CAD",
|
24
|
+
"user_id": null,
|
25
|
+
"test": true,
|
26
|
+
"processed_at": "2018-08-11T15:43:39-04:00",
|
27
|
+
"updated_at": "2018-08-09T15:43:41-04:00",
|
28
|
+
"remote_reference": "1118367",
|
29
|
+
"payment_method": "credit_card",
|
30
|
+
"payment_details": {
|
31
|
+
"credit_card_number": "•••• •••• •••• 2",
|
32
|
+
"credit_card_company": "Bogus"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"id": 3,
|
37
|
+
"order_id": 450789469,
|
38
|
+
"amount": "28.16",
|
39
|
+
"currency": "CAD",
|
40
|
+
"user_id": null,
|
41
|
+
"test": true,
|
42
|
+
"processed_at": "2018-08-12T15:43:39-04:00",
|
43
|
+
"updated_at": "2018-08-09T15:43:41-04:00",
|
44
|
+
"remote_reference": "1118368",
|
45
|
+
"payment_method": "credit_card",
|
46
|
+
"payment_details": {
|
47
|
+
"credit_card_number": "•••• •••• •••• 3",
|
48
|
+
"credit_card_company": "Bogus"
|
49
|
+
}
|
50
|
+
}
|
51
|
+
]
|
52
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class TenderTransactionTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
fake "tender_transactions", method: :get, body: load_fixture('tender_transactions')
|
9
|
+
end
|
10
|
+
|
11
|
+
context "Tender Transaction" do
|
12
|
+
should 'return a list of transactions' do
|
13
|
+
tender_transactions = ShopifyAPI::TenderTransaction.all
|
14
|
+
assert_equal 3, tender_transactions.length
|
15
|
+
assert_equal [1, 2, 3], tender_transactions.map(&:id)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- lib/shopify_api/resources/collection_publication.rb
|
188
188
|
- lib/shopify_api/resources/comment.rb
|
189
189
|
- lib/shopify_api/resources/country.rb
|
190
|
+
- lib/shopify_api/resources/currency.rb
|
190
191
|
- lib/shopify_api/resources/custom_collection.rb
|
191
192
|
- lib/shopify_api/resources/customer.rb
|
192
193
|
- lib/shopify_api/resources/customer_group.rb
|
@@ -244,6 +245,7 @@ files:
|
|
244
245
|
- lib/shopify_api/resources/storefront_access_token.rb
|
245
246
|
- lib/shopify_api/resources/tax_line.rb
|
246
247
|
- lib/shopify_api/resources/tax_service.rb
|
248
|
+
- lib/shopify_api/resources/tender_transaction.rb
|
247
249
|
- lib/shopify_api/resources/theme.rb
|
248
250
|
- lib/shopify_api/resources/transaction.rb
|
249
251
|
- lib/shopify_api/resources/usage_charge.rb
|
@@ -271,6 +273,7 @@ files:
|
|
271
273
|
- test/collection_listing_test.rb
|
272
274
|
- test/collection_publication_test.rb
|
273
275
|
- test/countable_test.rb
|
276
|
+
- test/currency_test.rb
|
274
277
|
- test/custom_collection_test.rb
|
275
278
|
- test/customer_saved_search_test.rb
|
276
279
|
- test/customer_test.rb
|
@@ -301,6 +304,7 @@ files:
|
|
301
304
|
- test/fixtures/collection_listings.json
|
302
305
|
- test/fixtures/collection_publication.json
|
303
306
|
- test/fixtures/collection_publications.json
|
307
|
+
- test/fixtures/currencies.json
|
304
308
|
- test/fixtures/custom_collection.json
|
305
309
|
- test/fixtures/customer_invite.json
|
306
310
|
- test/fixtures/customer_saved_search.json
|
@@ -368,6 +372,7 @@ files:
|
|
368
372
|
- test/fixtures/storefront_access_tokens.json
|
369
373
|
- test/fixtures/tags.json
|
370
374
|
- test/fixtures/tax_service.json
|
375
|
+
- test/fixtures/tender_transactions.json
|
371
376
|
- test/fixtures/transaction.json
|
372
377
|
- test/fixtures/usage_charge.json
|
373
378
|
- test/fixtures/usage_charges.json
|
@@ -412,6 +417,7 @@ files:
|
|
412
417
|
- test/smart_collection_test.rb
|
413
418
|
- test/storefront_access_token_test.rb
|
414
419
|
- test/tax_service_test.rb
|
420
|
+
- test/tender_transaction_test.rb
|
415
421
|
- test/test_helper.rb
|
416
422
|
- test/transaction_test.rb
|
417
423
|
- test/usage_charge_test.rb
|