shopify_api 4.3.6 → 4.3.7
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 +4 -4
- data/CHANGELOG +4 -0
- data/lib/shopify_api/resources/draft_order.rb +4 -0
- data/lib/shopify_api/version.rb +1 -1
- data/test/draft_order_test.rb +25 -0
- data/test/fixtures/draft_order_completed.json +159 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41efd1e1afb47d485a202a84c325a3d312ff4321
|
4
|
+
data.tar.gz: de1ef75a389706909b1dfa40b51bf8ac53dfedfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa91228ac963eceafb36b5cdcae45d468acd9f44e4fa2ff34c7c536b2cafece42a0c4e03c46e6142ed99d403e387892d29016d88aaa575327ed46643e9fec39b
|
7
|
+
data.tar.gz: 83fe534e2642124dbfb5d2c1e6a6538831508ec87d0dc277c50be7353d588d289049c61e40cfab48e2d00fad814a525460b15949c7ff165aa9d3f623feef6683
|
data/CHANGELOG
CHANGED
@@ -6,5 +6,9 @@ module ShopifyAPI
|
|
6
6
|
resource = post(:send_invoice, {}, draft_order_invoice.encode)
|
7
7
|
ShopifyAPI::DraftOrderInvoice.new(ShopifyAPI::DraftOrder.format.decode(resource.body))
|
8
8
|
end
|
9
|
+
|
10
|
+
def complete(options = {})
|
11
|
+
load_attributes_from_response(put(:complete, options, nil))
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
data/lib/shopify_api/version.rb
CHANGED
data/test/draft_order_test.rb
CHANGED
@@ -111,4 +111,29 @@ class DraftOrderTest < Test::Unit::TestCase
|
|
111
111
|
assert_equal 2, metafields.length
|
112
112
|
assert metafields.all? { |m| m.is_a?(ShopifyAPI::Metafield) }
|
113
113
|
end
|
114
|
+
|
115
|
+
def test_complete_draft_order_with_no_params
|
116
|
+
completed_fixture = load_fixture('draft_order_completed')
|
117
|
+
completed_draft = ActiveSupport::JSON.decode(completed_fixture)['draft_order']
|
118
|
+
fake 'draft_orders/517119332/complete', method: :put, status: 200, body: completed_fixture
|
119
|
+
|
120
|
+
@draft_order.complete
|
121
|
+
|
122
|
+
assert_equal completed_draft['status'], @draft_order.status
|
123
|
+
assert_equal completed_draft['order_id'], @draft_order.order_id
|
124
|
+
refute_nil @draft_order.completed_at
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_complete_draft_order_with_params
|
128
|
+
completed_fixture = load_fixture('draft_order_completed')
|
129
|
+
completed_draft = ActiveSupport::JSON.decode(completed_fixture)['draft_order']
|
130
|
+
complete_params = { payment_pending: true }
|
131
|
+
fake 'draft_orders/517119332/complete.json?payment_pending=true', extension: false, method: :put, status: 200, body: completed_fixture
|
132
|
+
|
133
|
+
@draft_order.complete(complete_params)
|
134
|
+
|
135
|
+
assert_equal completed_draft['status'], @draft_order.status
|
136
|
+
assert_equal completed_draft['order_id'], @draft_order.order_id
|
137
|
+
refute_nil @draft_order.completed_at
|
138
|
+
end
|
114
139
|
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
{
|
2
|
+
"draft_order": {
|
3
|
+
"id": 517119332,
|
4
|
+
"note": "This is a note",
|
5
|
+
"email": "montana_hilpert@example.com",
|
6
|
+
"taxes_included": false,
|
7
|
+
"currency": "CAD",
|
8
|
+
"subtotal_price": "1007.41",
|
9
|
+
"total_tax": "0.00",
|
10
|
+
"total_price": "1027.41",
|
11
|
+
"invoice_sent_at": null,
|
12
|
+
"created_at": "2017-02-02T13:14:38-05:00",
|
13
|
+
"updated_at": "2017-02-02T13:14:38-05:00",
|
14
|
+
"tax_exempt": false,
|
15
|
+
"completed_at": "2017-02-02T14:15:16-17:00",
|
16
|
+
"name": "#D1",
|
17
|
+
"status": "completed",
|
18
|
+
"line_items": [
|
19
|
+
{
|
20
|
+
"variant_id": 39072856,
|
21
|
+
"product_id": 632910392,
|
22
|
+
"title": "IPod Nano - 8gb",
|
23
|
+
"variant_title": "green",
|
24
|
+
"sku": "IPOD2008GREEN",
|
25
|
+
"vendor": null,
|
26
|
+
"price": "199.00",
|
27
|
+
"grams": 200,
|
28
|
+
"quantity": 1,
|
29
|
+
"requires_shipping": true,
|
30
|
+
"taxable": true,
|
31
|
+
"gift_card": false,
|
32
|
+
"fulfillment_service": "manual",
|
33
|
+
"tax_lines": [],
|
34
|
+
"applied_discount": null,
|
35
|
+
"name": "IPod Nano - 8gb - green",
|
36
|
+
"properties": [
|
37
|
+
{
|
38
|
+
"name": "Custom Engraving",
|
39
|
+
"value": "Happy Birthday"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"custom": false
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"variant_id": null,
|
46
|
+
"product_id": null,
|
47
|
+
"title": "Custom Item",
|
48
|
+
"variant_title": null,
|
49
|
+
"sku": null,
|
50
|
+
"vendor": null,
|
51
|
+
"price": "494.14",
|
52
|
+
"grams": 0,
|
53
|
+
"quantity": 2,
|
54
|
+
"requires_shipping": false,
|
55
|
+
"taxable": false,
|
56
|
+
"gift_card": false,
|
57
|
+
"fulfillment_service": "manual",
|
58
|
+
"tax_lines": [],
|
59
|
+
"applied_discount": {
|
60
|
+
"description": "A percentage discount for a custom line item",
|
61
|
+
"value": "3.58",
|
62
|
+
"title": "Custom",
|
63
|
+
"amount": "35.38",
|
64
|
+
"value_type": "percentage"
|
65
|
+
},
|
66
|
+
"name": "Custom item",
|
67
|
+
"properties": [],
|
68
|
+
"custom": true
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"shipping_address": {
|
72
|
+
"first_name": "Jan",
|
73
|
+
"address1": "512 Ernestina Forks",
|
74
|
+
"phone": "(639) 372 1289",
|
75
|
+
"city": "Lakefurt",
|
76
|
+
"zip": "24093",
|
77
|
+
"province": "Virginia",
|
78
|
+
"country": "United States",
|
79
|
+
"last_name": "Fisher",
|
80
|
+
"address2": "Apt. 702",
|
81
|
+
"company": "Steuber and Sons",
|
82
|
+
"latitude": 45.416311,
|
83
|
+
"longitude": -75.68683,
|
84
|
+
"name": "Jan Fisher",
|
85
|
+
"country_code": "US",
|
86
|
+
"province_code": "VA"
|
87
|
+
},
|
88
|
+
"billing_address": {
|
89
|
+
"first_name": "Jan",
|
90
|
+
"address1": "512 Ernestina Forks",
|
91
|
+
"phone": "(639) 372 1289",
|
92
|
+
"city": "Lakefurt",
|
93
|
+
"zip": "24093",
|
94
|
+
"province": "Virginia",
|
95
|
+
"country": "United States",
|
96
|
+
"last_name": "Fisher",
|
97
|
+
"address2": "Apt. 702",
|
98
|
+
"company": "Steuber and Sons",
|
99
|
+
"latitude": 45.416311,
|
100
|
+
"longitude": -75.68683,
|
101
|
+
"name": "Jan Fisher",
|
102
|
+
"country_code": "US",
|
103
|
+
"province_code": "VA"
|
104
|
+
},
|
105
|
+
"invoice_url": "https://checkout.myshopify.io/1/invoices/8e72bdccd0ac51067b947ac68c6f3804",
|
106
|
+
"applied_discount": {
|
107
|
+
"description": "A discount on the entire order",
|
108
|
+
"value": "1.48",
|
109
|
+
"title": "Custom",
|
110
|
+
"amount": "1.48",
|
111
|
+
"value_type": "fixed_amount"
|
112
|
+
},
|
113
|
+
"order_id": 450789469,
|
114
|
+
"shipping_line": {
|
115
|
+
"title": "Custom shipping",
|
116
|
+
"price": "20.00",
|
117
|
+
"custom": true,
|
118
|
+
"handle": null
|
119
|
+
},
|
120
|
+
"tax_lines": [],
|
121
|
+
"tags": "",
|
122
|
+
"customer": {
|
123
|
+
"accepts_marketing": false,
|
124
|
+
"created_at": "2014-03-07T16:14:08-05:00",
|
125
|
+
"email": "bob.norman@hostmail.com",
|
126
|
+
"first_name": "Bob",
|
127
|
+
"id": 207119551,
|
128
|
+
"last_name": "Norman",
|
129
|
+
"last_order_id": null,
|
130
|
+
"multipass_identifier": null,
|
131
|
+
"note": null,
|
132
|
+
"orders_count": 0,
|
133
|
+
"state": "disabled",
|
134
|
+
"total_spent": "0.00",
|
135
|
+
"updated_at": "2014-03-07T16:14:08-05:00",
|
136
|
+
"verified_email": true,
|
137
|
+
"tags": "",
|
138
|
+
"last_order_name": null,
|
139
|
+
"default_address": {
|
140
|
+
"address1": "Chestnut Street 92",
|
141
|
+
"address2": "",
|
142
|
+
"city": "Louisville",
|
143
|
+
"company": null,
|
144
|
+
"country": "United States",
|
145
|
+
"first_name": null,
|
146
|
+
"id": 207119551,
|
147
|
+
"last_name": null,
|
148
|
+
"phone": "555-625-1199",
|
149
|
+
"province": "Kentucky",
|
150
|
+
"zip": "40202",
|
151
|
+
"name": null,
|
152
|
+
"province_code": "KY",
|
153
|
+
"country_code": "US",
|
154
|
+
"country_name": "United States",
|
155
|
+
"default": true
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
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.
|
4
|
+
version: 4.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -269,6 +269,7 @@ files:
|
|
269
269
|
- test/fixtures/discount_disabled.json
|
270
270
|
- test/fixtures/discounts.json
|
271
271
|
- test/fixtures/draft_order.json
|
272
|
+
- test/fixtures/draft_order_completed.json
|
272
273
|
- test/fixtures/draft_order_invoice.json
|
273
274
|
- test/fixtures/draft_orders.json
|
274
275
|
- test/fixtures/events.json
|