shopify_api 4.9.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/probots.yml +2 -0
  4. data/.gitignore +3 -0
  5. data/.rubocop.yml +8 -0
  6. data/.travis.yml +0 -4
  7. data/CHANGELOG +67 -0
  8. data/README.md +48 -26
  9. data/lib/active_resource/detailed_log_subscriber.rb +25 -2
  10. data/lib/shopify_api/connection.rb +5 -3
  11. data/lib/shopify_api/limits.rb +1 -2
  12. data/lib/shopify_api/resources/abandoned_checkout.rb +7 -0
  13. data/lib/shopify_api/resources/access_scope.rb +5 -0
  14. data/lib/shopify_api/resources/api_permission.rb +9 -0
  15. data/lib/shopify_api/resources/asset.rb +8 -8
  16. data/lib/shopify_api/resources/billing_address.rb +1 -1
  17. data/lib/shopify_api/resources/checkout.rb +27 -1
  18. data/lib/shopify_api/resources/collection_publication.rb +10 -0
  19. data/lib/shopify_api/resources/currency.rb +6 -0
  20. data/lib/shopify_api/resources/custom_collection.rb +3 -3
  21. data/lib/shopify_api/resources/{customer_invite_message.rb → customer_invite.rb} +0 -0
  22. data/lib/shopify_api/resources/graphql.rb +22 -0
  23. data/lib/shopify_api/resources/image.rb +2 -2
  24. data/lib/shopify_api/resources/inventory_item.rb +6 -0
  25. data/lib/shopify_api/resources/inventory_level.rb +55 -0
  26. data/lib/shopify_api/resources/line_item.rb +9 -1
  27. data/lib/shopify_api/resources/location.rb +4 -0
  28. data/lib/shopify_api/resources/o_auth.rb +8 -0
  29. data/lib/shopify_api/resources/order.rb +16 -4
  30. data/lib/shopify_api/resources/payment.rb +7 -0
  31. data/lib/shopify_api/resources/ping.rb +3 -0
  32. data/lib/shopify_api/resources/ping/conversation.rb +42 -0
  33. data/lib/shopify_api/resources/ping/delivery_confirmation_details.rb +10 -0
  34. data/lib/shopify_api/resources/ping/message.rb +8 -0
  35. data/lib/shopify_api/resources/product.rb +4 -4
  36. data/lib/shopify_api/resources/product_publication.rb +10 -0
  37. data/lib/shopify_api/resources/publication.rb +5 -0
  38. data/lib/shopify_api/resources/shipping_line.rb +1 -1
  39. data/lib/shopify_api/resources/shipping_rate.rb +7 -0
  40. data/lib/shopify_api/resources/shop.rb +4 -4
  41. data/lib/shopify_api/resources/smart_collection.rb +6 -2
  42. data/lib/shopify_api/resources/tender_transaction.rb +6 -0
  43. data/lib/shopify_api/session.rb +16 -17
  44. data/lib/shopify_api/version.rb +1 -1
  45. data/service.yml +8 -0
  46. data/shopify_api.gemspec +4 -1
  47. data/test/abandoned_checkouts_test.rb +29 -0
  48. data/test/api_permission_test.rb +9 -0
  49. data/test/checkouts_test.rb +72 -4
  50. data/test/collection_publication_test.rb +40 -0
  51. data/test/currency_test.rb +21 -0
  52. data/test/detailed_log_subscriber_test.rb +19 -1
  53. data/test/fixtures/abandoned_checkout.json +184 -0
  54. data/test/fixtures/abandoned_checkouts.json +186 -0
  55. data/test/fixtures/checkout.json +160 -0
  56. data/test/fixtures/checkouts.json +25 -49
  57. data/test/fixtures/collection_publication.json +11 -0
  58. data/test/fixtures/collection_publications.json +13 -0
  59. data/test/fixtures/currencies.json +25 -0
  60. data/test/fixtures/inventory_level.json +7 -0
  61. data/test/fixtures/inventory_levels.json +24 -0
  62. data/test/fixtures/order_with_properties.json +373 -0
  63. data/test/fixtures/payment.json +7 -0
  64. data/test/fixtures/payments.json +9 -0
  65. data/test/fixtures/ping/conversation.json +1 -0
  66. data/test/fixtures/ping/failed_delivery_confirmation.json +1 -0
  67. data/test/fixtures/ping/message.json +1 -0
  68. data/test/fixtures/ping/successful_delivery_confirmation.json +1 -0
  69. data/test/fixtures/product_publication.json +11 -0
  70. data/test/fixtures/product_publications.json +13 -0
  71. data/test/fixtures/publications.json +9 -0
  72. data/test/fixtures/shipping_rates.json +12 -0
  73. data/test/fixtures/smart_collection_products.json +155 -0
  74. data/test/fixtures/tender_transactions.json +52 -0
  75. data/test/inventory_level_test.rb +59 -0
  76. data/test/location_test.rb +14 -0
  77. data/test/order_test.rb +29 -1
  78. data/test/payment_test.rb +19 -0
  79. data/test/ping/conversation_test.rb +71 -0
  80. data/test/ping/message_test.rb +23 -0
  81. data/test/product_publication_test.rb +40 -0
  82. data/test/product_test.rb +10 -0
  83. data/test/publication_test.rb +12 -0
  84. data/test/session_test.rb +11 -37
  85. data/test/shipping_rate_test.rb +17 -0
  86. data/test/smart_collection_test.rb +25 -0
  87. data/test/tender_transaction_test.rb +18 -0
  88. data/test/test_helper.rb +8 -5
  89. data/test/variant_test.rb +4 -1
  90. metadata +102 -10
  91. data/lib/shopify_api/resources/discount.rb +0 -11
  92. data/test/discount_test.rb +0 -52
  93. data/test/fixtures/discount.json +0 -17
  94. data/test/fixtures/discount_disabled.json +0 -17
  95. data/test/fixtures/discounts.json +0 -34
@@ -0,0 +1,186 @@
1
+ {
2
+ "checkouts": [
3
+ {
4
+ "buyer_accepts_marketing": false,
5
+ "cart_token": "68778783ad298f1c80c3bafcddeea02f",
6
+ "closed_at": null,
7
+ "completed_at": null,
8
+ "created_at": "2012-10-12T07:05:27-04:00",
9
+ "currency": "USD",
10
+ "email": "bob.norman@hostmail.com",
11
+ "gateway": null,
12
+ "id": 450789469,
13
+ "landing_site": null,
14
+ "note": null,
15
+ "referring_site": null,
16
+ "shipping_lines": [
17
+ {
18
+ "title": "Free Shipping",
19
+ "price": "0.00",
20
+ "code": "Free Shipping",
21
+ "source": "shopify"
22
+ }
23
+ ],
24
+ "source": null,
25
+ "source_identifier": null,
26
+ "source_name": "web",
27
+ "source_url": null,
28
+ "subtotal_price": "398.00",
29
+ "taxes_included": false,
30
+ "token": "2a1ace52255252df566af0faaedfbfa7",
31
+ "total_discounts": "0.00",
32
+ "total_line_items_price": "398.00",
33
+ "total_price": "409.94",
34
+ "total_tax": "11.94",
35
+ "total_weight": 400,
36
+ "updated_at": "2012-10-12T07:05:27-04:00",
37
+ "line_items": [
38
+ {
39
+ "applied_discounts": [
40
+
41
+ ],
42
+ "compare_at_price": null,
43
+ "fulfillment_service": "manual",
44
+ "gift_card": false,
45
+ "grams": 200,
46
+ "id": 49148385,
47
+ "line_price": "199.00",
48
+ "price": "199.00",
49
+ "product_id": 632910392,
50
+ "properties": null,
51
+ "quantity": 1,
52
+ "requires_shipping": true,
53
+ "sku": "IPOD2008RED",
54
+ "tax_lines": [
55
+
56
+ ],
57
+ "taxable": true,
58
+ "title": "IPod Nano - 8GB",
59
+ "variant_id": 49148385,
60
+ "variant_title": "Red",
61
+ "vendor": "Apple"
62
+ },
63
+ {
64
+ "applied_discounts": [
65
+
66
+ ],
67
+ "compare_at_price": null,
68
+ "fulfillment_service": "manual",
69
+ "gift_card": false,
70
+ "grams": 200,
71
+ "id": 808950810,
72
+ "line_price": "199.00",
73
+ "price": "199.00",
74
+ "product_id": 632910392,
75
+ "properties": null,
76
+ "quantity": 1,
77
+ "requires_shipping": true,
78
+ "sku": "IPOD2008PINK",
79
+ "tax_lines": [
80
+
81
+ ],
82
+ "taxable": true,
83
+ "title": "IPod Nano - 8GB",
84
+ "variant_id": 808950810,
85
+ "variant_title": "Pink",
86
+ "vendor": "Apple"
87
+ }
88
+ ],
89
+ "name": "#450789469",
90
+ "note_attributes": [
91
+ {
92
+ "name": "custom engraving",
93
+ "value": "Happy Birthday"
94
+ },
95
+ {
96
+ "name": "colour",
97
+ "value": "green"
98
+ }
99
+ ],
100
+ "discount_codes": [
101
+ {
102
+ "code": "TENOFF",
103
+ "amount": "10.00"
104
+ }
105
+ ],
106
+ "abandoned_checkout_url": "https://checkout.local/orders/690933842/2a1ace52255252df566af0faaedfbfa7?recovered=1",
107
+ "tax_lines": [
108
+ {
109
+ "price": "11.94",
110
+ "rate": 0.06,
111
+ "title": "State Tax"
112
+ }
113
+ ],
114
+ "billing_address": {
115
+ "address1": "Chestnut Street 92",
116
+ "address2": "",
117
+ "city": "Louisville",
118
+ "company": null,
119
+ "country": "United States",
120
+ "first_name": "Bob",
121
+ "last_name": "Norman",
122
+ "latitude": "45.41634",
123
+ "longitude": "-75.6868",
124
+ "phone": "555-625-1199",
125
+ "province": "Kentucky",
126
+ "zip": "40202",
127
+ "name": "Bob Norman",
128
+ "country_code": "US",
129
+ "province_code": "KY"
130
+ },
131
+ "shipping_address": {
132
+ "address1": "Chestnut Street 92",
133
+ "address2": "",
134
+ "city": "Louisville",
135
+ "company": null,
136
+ "country": "United States",
137
+ "first_name": "Bob",
138
+ "last_name": "Norman",
139
+ "latitude": "45.41634",
140
+ "longitude": "-75.6868",
141
+ "phone": "555-625-1199",
142
+ "province": "Kentucky",
143
+ "zip": "40202",
144
+ "name": "Bob Norman",
145
+ "country_code": "US",
146
+ "province_code": "KY"
147
+ },
148
+ "customer": {
149
+ "accepts_marketing": false,
150
+ "created_at": "2014-03-07T16:12:37-05:00",
151
+ "email": "bob.norman@hostmail.com",
152
+ "first_name": "Bob",
153
+ "id": 207119551,
154
+ "last_name": "Norman",
155
+ "last_order_id": null,
156
+ "multipass_identifier": null,
157
+ "note": null,
158
+ "orders_count": 0,
159
+ "state": "disabled",
160
+ "total_spent": "0.00",
161
+ "updated_at": "2014-03-07T16:12:37-05:00",
162
+ "verified_email": true,
163
+ "tags": "",
164
+ "last_order_name": null,
165
+ "default_address": {
166
+ "address1": "Chestnut Street 92",
167
+ "address2": "",
168
+ "city": "Louisville",
169
+ "company": null,
170
+ "country": "United States",
171
+ "first_name": null,
172
+ "id": 207119551,
173
+ "last_name": null,
174
+ "phone": "555-625-1199",
175
+ "province": "Kentucky",
176
+ "zip": "40202",
177
+ "name": null,
178
+ "province_code": "KY",
179
+ "country_code": "US",
180
+ "country_name": "United States",
181
+ "default": true
182
+ }
183
+ }
184
+ }
185
+ ]
186
+ }
@@ -0,0 +1,160 @@
1
+ {
2
+ "checkout": {
3
+ "applied_discount": "0.00",
4
+ "clone_url": "",
5
+ "completed_at": null,
6
+ "created_at": "2012-10-12T07:05:27-04:00",
7
+ "credit_card": null,
8
+ "currency": "USD",
9
+ "presentment_currency": "USD",
10
+ "email": "bob.norman@hostmail.com",
11
+ "note": null,
12
+ "shipping_line": [
13
+ {
14
+ "title": "Free Shipping",
15
+ "price": "0.00",
16
+ "code": "Free Shipping",
17
+ "source": "shopify"
18
+ }
19
+ ],
20
+ "shipping_rates": [
21
+ {
22
+ "id": "canada_post-INT.TP.BOGUS-4.00",
23
+ "price": "4.00",
24
+ "title": "Small Packet International Air Bogus"
25
+ },
26
+ {
27
+ "id": "canada_post-INT.TP.BOGUS-8.00",
28
+ "price": "8.00",
29
+ "title": "Medium Packet International Air Bogus"
30
+ }
31
+ ],
32
+ "source_identifier": null,
33
+ "source_name": "web",
34
+ "source_url": null,
35
+ "subtotal_price": "398.00",
36
+ "shipping_policy_url": null,
37
+ "taxes_included": false,
38
+ "token": "2a1ace52255252df566af0faaedfbfa7",
39
+ "total_line_items_price": "398.00",
40
+ "total_price": "409.94",
41
+ "total_tax": "11.94",
42
+ "updated_at": "2012-10-12T07:05:27-04:00",
43
+ "line_items": [
44
+ {
45
+ "applied_discounts": [
46
+
47
+ ],
48
+ "compare_at_price": null,
49
+ "fulfillment_service": "manual",
50
+ "gift_card": false,
51
+ "grams": 200,
52
+ "id": 49148385,
53
+ "line_price": "199.00",
54
+ "price": "199.00",
55
+ "product_id": 632910392,
56
+ "properties": null,
57
+ "quantity": 1,
58
+ "requires_shipping": true,
59
+ "sku": "IPOD2008RED",
60
+ "tax_lines": [
61
+
62
+ ],
63
+ "taxable": true,
64
+ "title": "IPod Nano - 8GB",
65
+ "variant_id": 49148385,
66
+ "variant_title": "Red",
67
+ "vendor": "Apple"
68
+ },
69
+ {
70
+ "applied_discounts": [
71
+
72
+ ],
73
+ "compare_at_price": null,
74
+ "fulfillment_service": "manual",
75
+ "gift_card": false,
76
+ "grams": 200,
77
+ "id": 808950810,
78
+ "line_price": "199.00",
79
+ "price": "199.00",
80
+ "product_id": 632910392,
81
+ "properties": null,
82
+ "quantity": 1,
83
+ "requires_shipping": true,
84
+ "sku": "IPOD2008PINK",
85
+ "tax_lines": [
86
+
87
+ ],
88
+ "taxable": true,
89
+ "title": "IPod Nano - 8GB",
90
+ "variant_id": 808950810,
91
+ "variant_title": "Pink",
92
+ "vendor": "Apple"
93
+ }
94
+ ],
95
+ "name": "#450789469",
96
+ "note_attributes": [
97
+ {
98
+ "name": "custom engraving",
99
+ "value": "Happy Birthday"
100
+ },
101
+ {
102
+ "name": "colour",
103
+ "value": "green"
104
+ }
105
+ ],
106
+ "discount_code": [
107
+ {
108
+ "code": "TENOFF",
109
+ "amount": "10.00"
110
+ }
111
+ ],
112
+ "tax_lines": [
113
+ {
114
+ "price": "11.94",
115
+ "rate": 0.06,
116
+ "title": "State Tax"
117
+ }
118
+ ],
119
+ "billing_address": {
120
+ "address1": "Chestnut Street 92",
121
+ "address2": "",
122
+ "city": "Louisville",
123
+ "company": null,
124
+ "country": "United States",
125
+ "first_name": "Bob",
126
+ "last_name": "Norman",
127
+ "latitude": "45.41634",
128
+ "longitude": "-75.6868",
129
+ "phone": "555-625-1199",
130
+ "province": "Kentucky",
131
+ "zip": "40202",
132
+ "name": "Bob Norman",
133
+ "country_code": "US",
134
+ "province_code": "KY"
135
+ },
136
+ "shipping_address": {
137
+ "address1": "Chestnut Street 92",
138
+ "address2": "",
139
+ "city": "Louisville",
140
+ "company": null,
141
+ "country": "United States",
142
+ "first_name": "Bob",
143
+ "last_name": "Norman",
144
+ "latitude": "45.41634",
145
+ "longitude": "-75.6868",
146
+ "phone": "555-625-1199",
147
+ "province": "Kentucky",
148
+ "zip": "40202",
149
+ "name": "Bob Norman",
150
+ "country_code": "US",
151
+ "province_code": "KY"
152
+ },
153
+ "customer_id": null,
154
+ "customer_locale": "en-CA",
155
+ "device_id": "12",
156
+ "order": null,
157
+ "order_id": null,
158
+ "order_status_url": ""
159
+ }
160
+ }
@@ -1,19 +1,16 @@
1
1
  {
2
2
  "checkouts": [
3
3
  {
4
- "buyer_accepts_marketing": false,
5
- "cart_token": "68778783ad298f1c80c3bafcddeea02f",
6
- "closed_at": null,
4
+ "applied_discount": "0.00",
5
+ "clone_url": "",
7
6
  "completed_at": null,
8
7
  "created_at": "2012-10-12T07:05:27-04:00",
8
+ "credit_card": null,
9
9
  "currency": "USD",
10
+ "presentment_currency": "USD",
10
11
  "email": "bob.norman@hostmail.com",
11
- "gateway": null,
12
- "id": 450789469,
13
- "landing_site": null,
14
12
  "note": null,
15
- "referring_site": null,
16
- "shipping_lines": [
13
+ "shipping_line": [
17
14
  {
18
15
  "title": "Free Shipping",
19
16
  "price": "0.00",
@@ -21,18 +18,28 @@
21
18
  "source": "shopify"
22
19
  }
23
20
  ],
24
- "source": null,
21
+ "shipping_rates": [
22
+ {
23
+ "id": "canada_post-INT.TP.BOGUS-4.00",
24
+ "price": "4.00",
25
+ "title": "Small Packet International Air Bogus"
26
+ },
27
+ {
28
+ "id": "canada_post-INT.TP.BOGUS-8.00",
29
+ "price": "8.00",
30
+ "title": "Medium Packet International Air Bogus"
31
+ }
32
+ ],
25
33
  "source_identifier": null,
26
34
  "source_name": "web",
27
35
  "source_url": null,
28
36
  "subtotal_price": "398.00",
37
+ "shipping_policy_url": null,
29
38
  "taxes_included": false,
30
39
  "token": "2a1ace52255252df566af0faaedfbfa7",
31
- "total_discounts": "0.00",
32
40
  "total_line_items_price": "398.00",
33
41
  "total_price": "409.94",
34
42
  "total_tax": "11.94",
35
- "total_weight": 400,
36
43
  "updated_at": "2012-10-12T07:05:27-04:00",
37
44
  "line_items": [
38
45
  {
@@ -97,13 +104,12 @@
97
104
  "value": "green"
98
105
  }
99
106
  ],
100
- "discount_codes": [
107
+ "discount_code": [
101
108
  {
102
109
  "code": "TENOFF",
103
110
  "amount": "10.00"
104
111
  }
105
112
  ],
106
- "abandoned_checkout_url": "https://checkout.local/orders/690933842/2a1ace52255252df566af0faaedfbfa7?recovered=1",
107
113
  "tax_lines": [
108
114
  {
109
115
  "price": "11.94",
@@ -145,42 +151,12 @@
145
151
  "country_code": "US",
146
152
  "province_code": "KY"
147
153
  },
148
- "customer": {
149
- "accepts_marketing": false,
150
- "created_at": "2014-03-07T16:12:37-05:00",
151
- "email": "bob.norman@hostmail.com",
152
- "first_name": "Bob",
153
- "id": 207119551,
154
- "last_name": "Norman",
155
- "last_order_id": null,
156
- "multipass_identifier": null,
157
- "note": null,
158
- "orders_count": 0,
159
- "state": "disabled",
160
- "total_spent": "0.00",
161
- "updated_at": "2014-03-07T16:12:37-05:00",
162
- "verified_email": true,
163
- "tags": "",
164
- "last_order_name": null,
165
- "default_address": {
166
- "address1": "Chestnut Street 92",
167
- "address2": "",
168
- "city": "Louisville",
169
- "company": null,
170
- "country": "United States",
171
- "first_name": null,
172
- "id": 207119551,
173
- "last_name": null,
174
- "phone": "555-625-1199",
175
- "province": "Kentucky",
176
- "zip": "40202",
177
- "name": null,
178
- "province_code": "KY",
179
- "country_code": "US",
180
- "country_name": "United States",
181
- "default": true
182
- }
183
- }
154
+ "customer_id": null,
155
+ "customer_locale": "en-CA",
156
+ "device_id": "12",
157
+ "order": null,
158
+ "order_id": null,
159
+ "order_status_url": ""
184
160
  }
185
161
  ]
186
162
  }