solidus_json_api 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +224 -0
- data/Gemfile +6 -0
- data/LICENSE +26 -0
- data/README.md +94 -0
- data/Rakefile +38 -0
- data/app/controllers/concerns/spree/api/v2/renderable.rb +63 -0
- data/app/controllers/spree/api/v2/base_controller.rb +9 -0
- data/app/controllers/spree/api/v2/children_controller.rb +29 -0
- data/app/controllers/spree/api/v2/countries_controller.rb +21 -0
- data/app/controllers/spree/api/v2/images_controller.rb +29 -0
- data/app/controllers/spree/api/v2/line_items_controller.rb +36 -0
- data/app/controllers/spree/api/v2/option_types_controller.rb +31 -0
- data/app/controllers/spree/api/v2/option_values_controller.rb +29 -0
- data/app/controllers/spree/api/v2/orders_controller.rb +21 -0
- data/app/controllers/spree/api/v2/prices_controller.rb +27 -0
- data/app/controllers/spree/api/v2/products_controller.rb +37 -0
- data/app/controllers/spree/api/v2/states_controller.rb +29 -0
- data/app/controllers/spree/api/v2/taxonomies_controller.rb +21 -0
- data/app/controllers/spree/api/v2/taxons_controller.rb +40 -0
- data/app/controllers/spree/api/v2/variants_controller.rb +35 -0
- data/app/models/spree/base_decorator.rb +5 -0
- data/app/models/spree/image_decorator.rb +3 -0
- data/app/models/spree/line_item_decorator.rb +3 -0
- data/app/models/spree/order_decorator.rb +3 -0
- data/app/models/spree/price_decorator.rb +3 -0
- data/app/models/spree/state_decorator.rb +3 -0
- data/app/serializers/spree/address_serializer.rb +9 -0
- data/app/serializers/spree/base_serializer.rb +13 -0
- data/app/serializers/spree/country_serializer.rb +7 -0
- data/app/serializers/spree/error_serializer.rb +55 -0
- data/app/serializers/spree/image_serializer.rb +13 -0
- data/app/serializers/spree/line_item_serializer.rb +13 -0
- data/app/serializers/spree/option_type_serializer.rb +8 -0
- data/app/serializers/spree/option_value_serializer.rb +8 -0
- data/app/serializers/spree/order_serializer.rb +20 -0
- data/app/serializers/spree/price_serializer.rb +7 -0
- data/app/serializers/spree/product_serializer.rb +12 -0
- data/app/serializers/spree/role_serializer.rb +5 -0
- data/app/serializers/spree/state_serializer.rb +7 -0
- data/app/serializers/spree/store_serializer.rb +6 -0
- data/app/serializers/spree/taxon_serializer.rb +16 -0
- data/app/serializers/spree/taxonomy_serializer.rb +7 -0
- data/app/serializers/spree/user_serializer.rb +5 -0
- data/app/serializers/spree/variant_serializer.rb +12 -0
- data/circle.yml +12 -0
- data/config/locales/en.yml +25 -0
- data/config/routes.rb +53 -0
- data/docs/.nojekyll +0 -0
- data/docs/Dockerfile +12 -0
- data/docs/Gemfile +14 -0
- data/docs/README.md +12 -0
- data/docs/Rakefile +9 -0
- data/docs/config.rb +39 -0
- data/docs/font-selection.json +148 -0
- data/docs/source/CNAME +1 -0
- data/docs/source/fonts/slate.eot +0 -0
- data/docs/source/fonts/slate.svg +14 -0
- data/docs/source/fonts/slate.ttf +0 -0
- data/docs/source/fonts/slate.woff +0 -0
- data/docs/source/fonts/slate.woff2 +0 -0
- data/docs/source/images/favicon.ico +0 -0
- data/docs/source/images/navbar.png +0 -0
- data/docs/source/includes/_countries.md +133 -0
- data/docs/source/includes/_errors.md +17 -0
- data/docs/source/includes/_filtering.md +11 -0
- data/docs/source/includes/_images.md +201 -0
- data/docs/source/includes/_line_items.md +143 -0
- data/docs/source/includes/_option_types.md +267 -0
- data/docs/source/includes/_option_values.md +227 -0
- data/docs/source/includes/_orders.md +150 -0
- data/docs/source/includes/_pagination.md +10 -0
- data/docs/source/includes/_prices.md +188 -0
- data/docs/source/includes/_products.md +407 -0
- data/docs/source/includes/_states.md +96 -0
- data/docs/source/includes/_taxonomies.md +325 -0
- data/docs/source/includes/_taxons.md +414 -0
- data/docs/source/includes/_variants.md +430 -0
- data/docs/source/index.md +51 -0
- data/docs/source/javascripts/all.js +4 -0
- data/docs/source/javascripts/all_nosearch.js +3 -0
- data/docs/source/javascripts/app/_lang.js +162 -0
- data/docs/source/javascripts/app/_search.js +74 -0
- data/docs/source/javascripts/app/_toc.js +55 -0
- data/docs/source/javascripts/lib/_energize.js +169 -0
- data/docs/source/javascripts/lib/_imagesloaded.min.js +7 -0
- data/docs/source/javascripts/lib/_jquery.highlight.js +108 -0
- data/docs/source/javascripts/lib/_jquery.tocify.js +1042 -0
- data/docs/source/javascripts/lib/_jquery_ui.js +566 -0
- data/docs/source/javascripts/lib/_lunr.js +1910 -0
- data/docs/source/layouts/layout.erb +110 -0
- data/docs/source/stylesheets/_icon-font.scss +38 -0
- data/docs/source/stylesheets/_normalize.css +427 -0
- data/docs/source/stylesheets/_syntax.scss.erb +27 -0
- data/docs/source/stylesheets/_variables.scss +109 -0
- data/docs/source/stylesheets/print.css.scss +142 -0
- data/docs/source/stylesheets/screen.css.scss +622 -0
- data/lib/solidus_json_api/config.rb +8 -0
- data/lib/solidus_json_api/engine.rb +21 -0
- data/lib/solidus_json_api.rb +5 -0
- data/solidus_json_api.gemspec +36 -0
- data/spec/controllers/spree/api/v2/base_controller_spec.rb +46 -0
- data/spec/controllers/spree/api/v2/children_controller_spec.rb +28 -0
- data/spec/controllers/spree/api/v2/countries_controller_spec.rb +25 -0
- data/spec/controllers/spree/api/v2/images_controller_spec.rb +91 -0
- data/spec/controllers/spree/api/v2/line_items_controller_spec.rb +101 -0
- data/spec/controllers/spree/api/v2/option_types_controller_spec.rb +71 -0
- data/spec/controllers/spree/api/v2/option_values_controller_spec.rb +88 -0
- data/spec/controllers/spree/api/v2/orders_controller_spec.rb +61 -0
- data/spec/controllers/spree/api/v2/prices_controller_spec.rb +55 -0
- data/spec/controllers/spree/api/v2/products_controller_spec.rb +99 -0
- data/spec/controllers/spree/api/v2/states_controller_spec.rb +42 -0
- data/spec/controllers/spree/api/v2/taxonomies_controller_spec.rb +31 -0
- data/spec/controllers/spree/api/v2/taxons_controller_spec.rb +54 -0
- data/spec/controllers/spree/api/v2/variants_controller_spec.rb +106 -0
- data/spec/lib/solidus_json_api/config_spec.rb +10 -0
- data/spec/models/spree/base_decorator_spec.rb +9 -0
- data/spec/models/spree/price_decorator_spec.rb +3 -0
- data/spec/serializers/spree/address_serializer_spec.rb +35 -0
- data/spec/serializers/spree/country_serializer_spec.rb +27 -0
- data/spec/serializers/spree/error_serializer_spec.rb +141 -0
- data/spec/serializers/spree/image_serializer_spec.rb +30 -0
- data/spec/serializers/spree/line_item_serializer_spec.rb +40 -0
- data/spec/serializers/spree/option_type_serializer_spec.rb +27 -0
- data/spec/serializers/spree/option_value_serializer_spec.rb +29 -0
- data/spec/serializers/spree/order_serializer_spec.rb +68 -0
- data/spec/serializers/spree/price_serializer_spec.rb +28 -0
- data/spec/serializers/spree/product_serializer_spec.rb +47 -0
- data/spec/serializers/spree/role_serializer_spec.rb +17 -0
- data/spec/serializers/spree/state_serializer_spec.rb +25 -0
- data/spec/serializers/spree/store_serializer_spec.rb +25 -0
- data/spec/serializers/spree/taxon_serializer_spec.rb +44 -0
- data/spec/serializers/spree/taxonomy_serializer_spec.rb +27 -0
- data/spec/serializers/spree/user_serializer_spec.rb +17 -0
- data/spec/serializers/spree/variant_serializer_spec.rb +55 -0
- data/spec/spec_helper.rb +57 -0
- data/spec/support/shoulda_matchers.rb +6 -0
- metadata +442 -0
@@ -0,0 +1,407 @@
|
|
1
|
+
# Products
|
2
|
+
|
3
|
+
## List Products
|
4
|
+
|
5
|
+
```shell
|
6
|
+
curl "https://example.com/api/v2/products"
|
7
|
+
```
|
8
|
+
|
9
|
+
```json
|
10
|
+
{
|
11
|
+
"data": [
|
12
|
+
{
|
13
|
+
"id": "1",
|
14
|
+
"type": "spree_products",
|
15
|
+
"attributes": {
|
16
|
+
"name": "Ruby on Rails Tote",
|
17
|
+
"description": "Velit nemo odio ducimus nobis non doloremque beatae sunt. Totam quia voluptatum perferendis tempore sed voluptate consequuntur. Sit id corporis autem veritatis reprehenderit.",
|
18
|
+
"slug": "ruby-on-rails-tote",
|
19
|
+
"meta_description": null,
|
20
|
+
"meta_keywords": null,
|
21
|
+
"store_name": "Whole New Home"
|
22
|
+
},
|
23
|
+
"relationships": {
|
24
|
+
"master": {
|
25
|
+
"data": {
|
26
|
+
"type": "spree_variants",
|
27
|
+
"id": "1"
|
28
|
+
}
|
29
|
+
},
|
30
|
+
"variants": {
|
31
|
+
"data": []
|
32
|
+
},
|
33
|
+
"option_types": {
|
34
|
+
"data": [
|
35
|
+
{
|
36
|
+
"type": "spree_option_types",
|
37
|
+
"id": "1"
|
38
|
+
}
|
39
|
+
]
|
40
|
+
},
|
41
|
+
"taxons": {
|
42
|
+
"data": [
|
43
|
+
{
|
44
|
+
"type": "spree_taxons",
|
45
|
+
"id": "1"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"images": {
|
51
|
+
"data": [
|
52
|
+
{
|
53
|
+
"type": "spree_images",
|
54
|
+
"id": "1"
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}
|
58
|
+
}
|
59
|
+
]
|
60
|
+
}
|
61
|
+
```
|
62
|
+
|
63
|
+
List all of the products in the database.
|
64
|
+
|
65
|
+
## Show Product
|
66
|
+
|
67
|
+
```shell
|
68
|
+
curl "https://example.com/api/v2/products/1"
|
69
|
+
|
70
|
+
# or by slug
|
71
|
+
|
72
|
+
curl "https://example.com/api/v2/products/ruby-on-rails-tote"
|
73
|
+
```
|
74
|
+
|
75
|
+
```json
|
76
|
+
{
|
77
|
+
"data": {
|
78
|
+
"id": "1",
|
79
|
+
"type": "spree_products",
|
80
|
+
"attributes": {
|
81
|
+
"name": "Ruby on Rails Tote",
|
82
|
+
"description": "Velit nemo odio ducimus nobis non doloremque beatae sunt. Totam quia voluptatum perferendis tempore sed voluptate consequuntur. Sit id corporis autem veritatis reprehenderit.",
|
83
|
+
"slug": "ruby-on-rails-tote",
|
84
|
+
"meta_description": null,
|
85
|
+
"meta_keywords": null,
|
86
|
+
"store_name": "Whole New Home"
|
87
|
+
},
|
88
|
+
"relationships": {
|
89
|
+
"master": {
|
90
|
+
"data": {
|
91
|
+
"type": "spree_variants",
|
92
|
+
"id": "1"
|
93
|
+
}
|
94
|
+
},
|
95
|
+
"variants": {
|
96
|
+
"data": []
|
97
|
+
},
|
98
|
+
"taxons": {
|
99
|
+
"data": [
|
100
|
+
{
|
101
|
+
"type": "spree_taxons",
|
102
|
+
"id": "1"
|
103
|
+
}
|
104
|
+
]
|
105
|
+
},
|
106
|
+
"option_types": {
|
107
|
+
"data": [
|
108
|
+
{
|
109
|
+
"type": "spree_option_types",
|
110
|
+
"id": "1"
|
111
|
+
}
|
112
|
+
]
|
113
|
+
},
|
114
|
+
"images": {
|
115
|
+
"data": [
|
116
|
+
{
|
117
|
+
"type": "spree_images",
|
118
|
+
"id": "1"
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
```
|
126
|
+
|
127
|
+
Select a product via it's `id`.
|
128
|
+
|
129
|
+
## List Option Types of a Product
|
130
|
+
|
131
|
+
```shell
|
132
|
+
curl "https://example.com/api/v2/products/1/option_types"
|
133
|
+
```
|
134
|
+
|
135
|
+
```json
|
136
|
+
{
|
137
|
+
"data": [
|
138
|
+
{
|
139
|
+
"id": "1",
|
140
|
+
"type": "spree_option_types",
|
141
|
+
"attributes": {
|
142
|
+
"name": "tshirt-size",
|
143
|
+
"presentation": "Size",
|
144
|
+
"position": 1
|
145
|
+
},
|
146
|
+
"relationships": {
|
147
|
+
"option_values": {
|
148
|
+
"data": [
|
149
|
+
{
|
150
|
+
"type": "spree_option_values",
|
151
|
+
"id": "1"
|
152
|
+
}
|
153
|
+
]
|
154
|
+
},
|
155
|
+
"products": {
|
156
|
+
"data": [
|
157
|
+
{
|
158
|
+
"type": "spree_products",
|
159
|
+
"id": "1"
|
160
|
+
}
|
161
|
+
]
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
]
|
166
|
+
}
|
167
|
+
```
|
168
|
+
|
169
|
+
List all of the option types that a product owns via the product's `id`.
|
170
|
+
|
171
|
+
## Show Option Type of a Product
|
172
|
+
|
173
|
+
```shell
|
174
|
+
curl "https://example.com/api/v2/products/1/option_types/1"
|
175
|
+
```
|
176
|
+
|
177
|
+
```json
|
178
|
+
{
|
179
|
+
"data": {
|
180
|
+
"id": "1",
|
181
|
+
"type": "spree_option_types",
|
182
|
+
"attributes": {
|
183
|
+
"name": "tshirt-size",
|
184
|
+
"presentation": "Size",
|
185
|
+
"position": 1
|
186
|
+
},
|
187
|
+
"relationships": {
|
188
|
+
"option_values": {
|
189
|
+
"data": [
|
190
|
+
{
|
191
|
+
"type": "spree_option_values",
|
192
|
+
"id": "1"
|
193
|
+
}
|
194
|
+
]
|
195
|
+
},
|
196
|
+
"products": {
|
197
|
+
"data": [
|
198
|
+
{
|
199
|
+
"type": "spree_products",
|
200
|
+
"id": "1"
|
201
|
+
}
|
202
|
+
]
|
203
|
+
}
|
204
|
+
}
|
205
|
+
}
|
206
|
+
}
|
207
|
+
```
|
208
|
+
|
209
|
+
Fetch an option type of a product by both of their `id`s.
|
210
|
+
|
211
|
+
## List Variants of a Product
|
212
|
+
|
213
|
+
```shell
|
214
|
+
curl "https://example.com/api/v2/products/1/variants"
|
215
|
+
```
|
216
|
+
|
217
|
+
```json
|
218
|
+
{
|
219
|
+
"data": [
|
220
|
+
{
|
221
|
+
"id": "1",
|
222
|
+
"type": "spree_variants",
|
223
|
+
"attributes": {
|
224
|
+
"sku": "ROR-00011",
|
225
|
+
"weight": "0.0",
|
226
|
+
"height": "1.0",
|
227
|
+
"width": "3.0",
|
228
|
+
"depth": "2.0",
|
229
|
+
"is_master": true,
|
230
|
+
"position": 1,
|
231
|
+
"name": "Ruby on Rails Tote",
|
232
|
+
"price": "15.99",
|
233
|
+
"display_price" : "$15.99 CAD"
|
234
|
+
},
|
235
|
+
"relationships": {
|
236
|
+
"prices": {
|
237
|
+
"data": [
|
238
|
+
{
|
239
|
+
"type": "spree_prices",
|
240
|
+
"id": "1"
|
241
|
+
}
|
242
|
+
]
|
243
|
+
},
|
244
|
+
"option_values": {
|
245
|
+
"data": [
|
246
|
+
{
|
247
|
+
"type": "spree_option_values",
|
248
|
+
"id": "1"
|
249
|
+
}
|
250
|
+
]
|
251
|
+
},
|
252
|
+
"images": {
|
253
|
+
"data": [
|
254
|
+
{
|
255
|
+
"type": "spree_images",
|
256
|
+
"id": "1"
|
257
|
+
}
|
258
|
+
]
|
259
|
+
},
|
260
|
+
"product": {
|
261
|
+
"data": {
|
262
|
+
"type": "spree_products",
|
263
|
+
"id": "1"
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
]
|
269
|
+
}
|
270
|
+
```
|
271
|
+
|
272
|
+
List all variants including the master of a product by the products `id`.
|
273
|
+
|
274
|
+
## Show Variant of a Product
|
275
|
+
|
276
|
+
```shell
|
277
|
+
curl "https://example.com/api/v2/products/1/variants/1"
|
278
|
+
```
|
279
|
+
|
280
|
+
```json
|
281
|
+
{
|
282
|
+
"data": {
|
283
|
+
"id": "1",
|
284
|
+
"type": "spree_variants",
|
285
|
+
"attributes": {
|
286
|
+
"sku": "ROR-00011",
|
287
|
+
"weight": "0.0",
|
288
|
+
"height": "1.0",
|
289
|
+
"width": "3.0",
|
290
|
+
"depth": "2.0",
|
291
|
+
"is_master": true,
|
292
|
+
"position": 1,
|
293
|
+
"name": "Ruby on Rails Tote",
|
294
|
+
"price": "15.99",
|
295
|
+
"display_price" : "$15.99 CAD"
|
296
|
+
},
|
297
|
+
"relationships": {
|
298
|
+
"prices": {
|
299
|
+
"data": [
|
300
|
+
{
|
301
|
+
"type": "spree_prices",
|
302
|
+
"id": "1"
|
303
|
+
}
|
304
|
+
]
|
305
|
+
},
|
306
|
+
"option_values": {
|
307
|
+
"data": [
|
308
|
+
{
|
309
|
+
"type": "spree_option_values",
|
310
|
+
"id": "1"
|
311
|
+
}
|
312
|
+
]
|
313
|
+
},
|
314
|
+
"images": {
|
315
|
+
"data": [
|
316
|
+
{
|
317
|
+
"type": "spree_images",
|
318
|
+
"id": "1"
|
319
|
+
}
|
320
|
+
]
|
321
|
+
},
|
322
|
+
"product": {
|
323
|
+
"data": {
|
324
|
+
"type": "spree_products",
|
325
|
+
"id": "1"
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
```
|
332
|
+
|
333
|
+
Fetch a variant or a product's master variant that a product owns by the products `id`.
|
334
|
+
|
335
|
+
## List Images of a Product
|
336
|
+
|
337
|
+
```shell
|
338
|
+
curl "https://example.com/api/v2/products/1/images"
|
339
|
+
```
|
340
|
+
|
341
|
+
```json
|
342
|
+
{
|
343
|
+
"data": [
|
344
|
+
{
|
345
|
+
"id": "21",
|
346
|
+
"type": "spree_images",
|
347
|
+
"attributes": {
|
348
|
+
"position": 1,
|
349
|
+
"alt": null,
|
350
|
+
"links": {
|
351
|
+
"original": "/spree/products/21/original/ror_tote.jpeg?1442035828",
|
352
|
+
"mini": "/spree/products/21/mini/ror_tote.jpeg?1442035828",
|
353
|
+
"small": "/spree/products/21/small/ror_tote.jpeg?1442035828",
|
354
|
+
"product": "/spree/products/21/product/ror_tote.jpeg?1442035828",
|
355
|
+
"large": "/spree/products/21/large/ror_tote.jpeg?1442035828"
|
356
|
+
}
|
357
|
+
},
|
358
|
+
"relationships": {
|
359
|
+
"viewable": {
|
360
|
+
"data": {
|
361
|
+
"type": "spree_variants",
|
362
|
+
"id": "1"
|
363
|
+
}
|
364
|
+
}
|
365
|
+
}
|
366
|
+
}
|
367
|
+
]
|
368
|
+
}
|
369
|
+
```
|
370
|
+
|
371
|
+
List all of the images that belong to a product via the product's `id`.
|
372
|
+
|
373
|
+
## Show Image of a Product
|
374
|
+
|
375
|
+
```shell
|
376
|
+
curl "https://example.com/api/v2/products/1/images/21"
|
377
|
+
```
|
378
|
+
|
379
|
+
```json
|
380
|
+
{
|
381
|
+
"data": {
|
382
|
+
"id": "21",
|
383
|
+
"type": "spree_images",
|
384
|
+
"attributes": {
|
385
|
+
"position": 1,
|
386
|
+
"alt": null,
|
387
|
+
"links": {
|
388
|
+
"original": "/spree/products/21/original/ror_tote.jpeg?1442035828",
|
389
|
+
"mini": "/spree/products/21/mini/ror_tote.jpeg?1442035828",
|
390
|
+
"small": "/spree/products/21/small/ror_tote.jpeg?1442035828",
|
391
|
+
"product": "/spree/products/21/product/ror_tote.jpeg?1442035828",
|
392
|
+
"large": "/spree/products/21/large/ror_tote.jpeg?1442035828"
|
393
|
+
}
|
394
|
+
},
|
395
|
+
"relationships": {
|
396
|
+
"viewable": {
|
397
|
+
"data": {
|
398
|
+
"type": "spree_variants",
|
399
|
+
"id": "1"
|
400
|
+
}
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
```
|
406
|
+
|
407
|
+
Fetch an image of a product via the product and the images' `id`.
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# States
|
2
|
+
|
3
|
+
## List States
|
4
|
+
|
5
|
+
```shell
|
6
|
+
curl "https://example.com/api/v2/states"
|
7
|
+
```
|
8
|
+
|
9
|
+
```json
|
10
|
+
{
|
11
|
+
"data": [
|
12
|
+
{
|
13
|
+
"id": "1",
|
14
|
+
"type": "spree_states",
|
15
|
+
"attributes": {
|
16
|
+
"name": "Canillo",
|
17
|
+
"abbr": "02"
|
18
|
+
},
|
19
|
+
"relationships": {
|
20
|
+
"country": {
|
21
|
+
"data": {
|
22
|
+
"type": "spree_countries",
|
23
|
+
"id": "1"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
This will list all of the states.
|
33
|
+
|
34
|
+
## Show State
|
35
|
+
|
36
|
+
```shell
|
37
|
+
curl "https://example.com/api/v2/states/1"
|
38
|
+
```
|
39
|
+
|
40
|
+
```json
|
41
|
+
{
|
42
|
+
"data": {
|
43
|
+
"id": "1",
|
44
|
+
"type": "spree_states",
|
45
|
+
"attributes": {
|
46
|
+
"name": "Canillo",
|
47
|
+
"abbr": "02"
|
48
|
+
},
|
49
|
+
"relationships": {
|
50
|
+
"country": {
|
51
|
+
"data": {
|
52
|
+
"type": "spree_countries",
|
53
|
+
"id": "1"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
```
|
60
|
+
|
61
|
+
Select a state via its `id`.
|
62
|
+
|
63
|
+
## Show Country of a States
|
64
|
+
|
65
|
+
```shell
|
66
|
+
curl "https://example.com/api/v2/states/1/countries"
|
67
|
+
```
|
68
|
+
|
69
|
+
```json
|
70
|
+
{
|
71
|
+
"data": {
|
72
|
+
"id": "1",
|
73
|
+
"type": "spree_countries",
|
74
|
+
"attributes": {
|
75
|
+
"iso_name": "ANDORRA",
|
76
|
+
"iso": "AD",
|
77
|
+
"iso3": "AND",
|
78
|
+
"name": "Andorra",
|
79
|
+
"numcode": 20,
|
80
|
+
"states_required": true
|
81
|
+
},
|
82
|
+
"relationships": {
|
83
|
+
"states": {
|
84
|
+
"data": [
|
85
|
+
{
|
86
|
+
"type": "spree_states",
|
87
|
+
"id": "1"
|
88
|
+
}
|
89
|
+
]
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
View the country that a state belongs to via the state's `id`.
|