shopify_api 4.3.9 → 4.4.0

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: 9c3a9cf187de2632f21aae6abccf97761a15646a
4
- data.tar.gz: 50df871acee66ab97b06afdae4a5d1e2de9c46f3
3
+ metadata.gz: 6cad07f2934621fb68951cb99fdf2970d9c37371
4
+ data.tar.gz: 512642295b3aa8d72f6eb12a3be6c1e2da8830ee
5
5
  SHA512:
6
- metadata.gz: caa0e73d8fe90dfdaea35ce6098b13df2c42fb2127e97969ac52a8e71359b0453bcfdd5a7f2cfda1c98c32eff5856db58a23dc24cb35d4b04f95ab10b6dab3ad
7
- data.tar.gz: 2866caca89f807ffba6299fc534e6fc171e399c6c66a6bbdd1e45361c611b9fa36c7ac08de4afd9ac4c8b21bcbe95897663f90445aa60f8ef89cf7142eaf596b
6
+ metadata.gz: ee2b9865d85a9275f26d27acd0386cae09a1bf8e8d55b91df6029bf8300e9d74cbf14995851ff5bb174980c3d6f6b3bc0d41cc5b5c80c39b8f9e725b7a491398
7
+ data.tar.gz: 82f9f02bd6663c01e4949b7a7d93ab2bdca63dce0c0b0739b9cb07ca5bf6a0615b34f340a94b0e611b2cad7cfde221d610ab78d854c02e11c07ac029939cf900
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == Version 4.4.0
2
+
3
+ * Added `ShopifyAPI::CustomerInvite`
4
+ * Support for Customer#send_invite endpoint
5
+
1
6
  == Version 4.3.8
2
7
 
3
8
  * Added `ShopifyAPI::ResourceFeedback`
@@ -20,5 +20,10 @@ module ShopifyAPI
20
20
  end
21
21
  result
22
22
  end
23
+
24
+ def send_invite(customer_invite = ShopifyAPI::CustomerInvite.new)
25
+ resource = post(:send_invite, {}, customer_invite.encode)
26
+ ShopifyAPI::CustomerInvite.new(ShopifyAPI::CustomerInvite.format.decode(resource.body))
27
+ end
23
28
  end
24
29
  end
@@ -0,0 +1,4 @@
1
+ module ShopifyAPI
2
+ class CustomerInvite < Base
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "4.3.9"
2
+ VERSION = "4.4.0"
3
3
  end
@@ -1,6 +1,13 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CustomerTest < Test::Unit::TestCase
4
+ def setup
5
+ super
6
+
7
+ fake 'customers/207119551', body: load_fixture('customers')
8
+
9
+ @customer = ShopifyAPI::Customer.find(207119551)
10
+ end
4
11
 
5
12
  test "search should get a customers collection" do
6
13
  fake "customers/search.json?query=Bob+country%3AUnited+States", :extension => false, :body => load_fixture('customers_search')
@@ -10,11 +17,34 @@ class CustomerTest < Test::Unit::TestCase
10
17
  end
11
18
 
12
19
  test "account_activation_url should create an account activation url" do
13
- fake "customers/207119551", :body => load_fixture('customers')
14
20
  fake "customers/207119551/account_activation_url", :method => :post, :body => load_fixture('customers_account_activation_url')
15
21
 
16
- customer = ShopifyAPI::Customer.find(207119551)
17
22
  activation_url = "http://apple.myshopify.com/account/activate/207119551/86688abf23572680740b1c062fa37111-1458248616"
18
- assert_equal activation_url, customer.account_activation_url
23
+ assert_equal activation_url, @customer.account_activation_url
24
+ end
25
+
26
+ test "#send_invite with no params" do
27
+ customer_invite_fixture = load_fixture('customer_invite')
28
+ customer_invite = ActiveSupport::JSON.decode(customer_invite_fixture)
29
+ fake 'customers/207119551/send_invite', method: :post, body: customer_invite_fixture
30
+
31
+ customer_invite_response = @customer.send_invite
32
+
33
+ assert_equal '{"customer_invite":{}}', FakeWeb.last_request.body
34
+ assert_kind_of ShopifyAPI::CustomerInvite, customer_invite_response
35
+ assert_equal customer_invite['customer_invite']['to'], customer_invite_response.to
36
+ end
37
+
38
+ test "#send_invite with params" do
39
+ customer_invite_fixture = load_fixture('customer_invite')
40
+ customer_invite = ActiveSupport::JSON.decode(customer_invite_fixture)
41
+ fake 'customers/207119551/send_invite', method: :post, body: customer_invite_fixture
42
+
43
+
44
+ customer_invite_response = @customer.send_invite(ShopifyAPI::CustomerInvite.new(customer_invite['customer_invite']))
45
+
46
+ assert_equal customer_invite, ActiveSupport::JSON.decode(FakeWeb.last_request.body)
47
+ assert_kind_of ShopifyAPI::CustomerInvite, customer_invite_response
48
+ assert_equal customer_invite['customer_invite']['to'], customer_invite_response.to
19
49
  end
20
50
  end
@@ -0,0 +1,9 @@
1
+ {
2
+ "customer_invite": {
3
+ "to": "paul.norman@example.com",
4
+ "from": "steve@apple.com",
5
+ "subject": "Welcome to my new store!",
6
+ "custom_message": "This is a test custom message.",
7
+ "bcc": [ ]
8
+ }
9
+ }
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.9
4
+ version: 4.4.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-03-23 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -171,6 +171,7 @@ files:
171
171
  - lib/shopify_api/resources/custom_collection.rb
172
172
  - lib/shopify_api/resources/customer.rb
173
173
  - lib/shopify_api/resources/customer_group.rb
174
+ - lib/shopify_api/resources/customer_invite_message.rb
174
175
  - lib/shopify_api/resources/customer_saved_search.rb
175
176
  - lib/shopify_api/resources/discount.rb
176
177
  - lib/shopify_api/resources/draft_order.rb
@@ -261,6 +262,7 @@ files:
261
262
  - test/fixtures/collection_listing_product_ids.json
262
263
  - test/fixtures/collection_listings.json
263
264
  - test/fixtures/custom_collection.json
265
+ - test/fixtures/customer_invite.json
264
266
  - test/fixtures/customer_saved_search.json
265
267
  - test/fixtures/customer_saved_search_customers.json
266
268
  - test/fixtures/customers.json