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,143 @@
|
|
1
|
+
# Line Items
|
2
|
+
|
3
|
+
## Create Line Item
|
4
|
+
|
5
|
+
```shell
|
6
|
+
curl "https://example.com/api/v2/line_items"
|
7
|
+
-X POST
|
8
|
+
-d token=abc123
|
9
|
+
-d data[attributes][order_id]=1
|
10
|
+
-d data[attributes][variant_id]=1
|
11
|
+
-d data[attributes][quantity]=1
|
12
|
+
```
|
13
|
+
|
14
|
+
```json
|
15
|
+
{
|
16
|
+
"data": {
|
17
|
+
"attributes": {
|
18
|
+
"additional_tax_total": "0",
|
19
|
+
"adjustment_total": "0.0",
|
20
|
+
"amount": "10.0",
|
21
|
+
"cost_price": "17.0",
|
22
|
+
"currency": "CAD",
|
23
|
+
"display_amount": "$10.00 CAD",
|
24
|
+
"display_price": "$10.00 CAD",
|
25
|
+
"display_total": "$10.00 CAD",
|
26
|
+
"order_id": 1,
|
27
|
+
"price": "10.0",
|
28
|
+
"quantity": 1,
|
29
|
+
"total": "10.0",
|
30
|
+
"variant_id": 1
|
31
|
+
},
|
32
|
+
"relationships": {
|
33
|
+
"order": {
|
34
|
+
"data": {
|
35
|
+
"type": "spree_orders"
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"variant": {
|
39
|
+
"data": {
|
40
|
+
"type": "spree_variants"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"type": "spree_line_items"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
This endpoint allows you add a variant to a users order by creating a line item.
|
50
|
+
|
51
|
+
### When Out of Range
|
52
|
+
|
53
|
+
> Quantity is out of range.
|
54
|
+
|
55
|
+
```shell
|
56
|
+
curl "https://example.com/api/v2/line_items"
|
57
|
+
-X POST
|
58
|
+
-d token=abc123
|
59
|
+
-d data[attributes][order_id]=1
|
60
|
+
-d data[attributes][variant_id]=1
|
61
|
+
-d data[attributes][quantity]=100000000000
|
62
|
+
```
|
63
|
+
|
64
|
+
```json
|
65
|
+
{
|
66
|
+
"errors": [
|
67
|
+
{
|
68
|
+
"code": "400",
|
69
|
+
"detail": "Quantity is too High",
|
70
|
+
"meta": {},
|
71
|
+
"status": "Bad Request",
|
72
|
+
"title": "The quantity that you have submitted is astronomically high, please tone it down a bit."
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
```
|
77
|
+
|
78
|
+
When requesting an insanely large amount of variants to be added to your order, this will result in an error.
|
79
|
+
|
80
|
+
### When a Variant or an Order Could Not be Found
|
81
|
+
|
82
|
+
> Order could not be found.
|
83
|
+
|
84
|
+
```shell
|
85
|
+
curl "https://example.com/api/v2/line_items"
|
86
|
+
-X POST
|
87
|
+
-d token=abc123
|
88
|
+
-d data[attributes][order_id]=0
|
89
|
+
-d data[attributes][variant_id]=1
|
90
|
+
-d data[attributes][quantity]=1
|
91
|
+
```
|
92
|
+
|
93
|
+
```json
|
94
|
+
{
|
95
|
+
"errors": [
|
96
|
+
{
|
97
|
+
"code": "400",
|
98
|
+
"detail": "Record Not Found",
|
99
|
+
"meta": {},
|
100
|
+
"status": "Bad Request",
|
101
|
+
"title": "One of the records that you were looking for could not be found. Please check to see if the record exists or if you're permitted to read it"
|
102
|
+
}
|
103
|
+
]
|
104
|
+
}
|
105
|
+
```
|
106
|
+
|
107
|
+
Sometimes, you'll submit a bad variant id or order id.
|
108
|
+
When this happens, you'll receive an error because of it.
|
109
|
+
|
110
|
+
### When the Product is Out of Stock
|
111
|
+
|
112
|
+
> Product is out of stock.
|
113
|
+
|
114
|
+
```shell
|
115
|
+
curl "https://example.com/api/v2/line_items"
|
116
|
+
-X POST
|
117
|
+
-d token=abc123
|
118
|
+
-d data[attributes][order_id]=1
|
119
|
+
-d data[attributes][variant_id]=1
|
120
|
+
-d data[attributes][quantity]=1
|
121
|
+
```
|
122
|
+
|
123
|
+
```json
|
124
|
+
{
|
125
|
+
"errors": [
|
126
|
+
{
|
127
|
+
"code": "400",
|
128
|
+
"detail": "Product is out of Stock",
|
129
|
+
"meta": {},
|
130
|
+
"status": "Bad Request",
|
131
|
+
"title": "This product is out of stock for the selected quantity."
|
132
|
+
}
|
133
|
+
]
|
134
|
+
}
|
135
|
+
```
|
136
|
+
|
137
|
+
Sometimes, there's just not going to be any left in stock.
|
138
|
+
This can happen for both two reasons:
|
139
|
+
|
140
|
+
1. The variant is tracking inventory and its stock items `count_on_hand`s have all reached 0.
|
141
|
+
2. The variant is not backorderable.
|
142
|
+
|
143
|
+
If both of these conditions are met, then you will reveice an out of stock error.
|
@@ -0,0 +1,267 @@
|
|
1
|
+
# Option Types
|
2
|
+
|
3
|
+
## List Option Types
|
4
|
+
|
5
|
+
```shell
|
6
|
+
curl "https://example.com/api/v2/option_types"
|
7
|
+
```
|
8
|
+
|
9
|
+
```json
|
10
|
+
{
|
11
|
+
"data": [
|
12
|
+
{
|
13
|
+
"id": "1",
|
14
|
+
"type": "spree_option_types",
|
15
|
+
"attributes": {
|
16
|
+
"name": "tshirt-size",
|
17
|
+
"presentation": "Size",
|
18
|
+
"position": 1
|
19
|
+
},
|
20
|
+
"relationships": {
|
21
|
+
"option_values": {
|
22
|
+
"data": [
|
23
|
+
{
|
24
|
+
"type": "spree_option_values",
|
25
|
+
"id": "1"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
},
|
29
|
+
"products": {
|
30
|
+
"data": [
|
31
|
+
{
|
32
|
+
"type": "spree_products",
|
33
|
+
"id": "1"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
43
|
+
List all of the option types in the database.
|
44
|
+
|
45
|
+
## Show Option Type
|
46
|
+
|
47
|
+
```shell
|
48
|
+
curl "https://example.com/api/v2/option_types/1"
|
49
|
+
```
|
50
|
+
|
51
|
+
```json
|
52
|
+
{
|
53
|
+
"data": {
|
54
|
+
"id": "1",
|
55
|
+
"type": "spree_option_types",
|
56
|
+
"attributes": {
|
57
|
+
"name": "tshirt-size",
|
58
|
+
"presentation": "Size",
|
59
|
+
"position": 1
|
60
|
+
},
|
61
|
+
"relationships": {
|
62
|
+
"option_values": {
|
63
|
+
"data": [
|
64
|
+
{
|
65
|
+
"type": "spree_option_values",
|
66
|
+
"id": "1"
|
67
|
+
}
|
68
|
+
]
|
69
|
+
},
|
70
|
+
"products": {
|
71
|
+
"data": [
|
72
|
+
{
|
73
|
+
"type": "spree_products",
|
74
|
+
"id": "1"
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
```
|
82
|
+
|
83
|
+
Fetch an option type in the database.
|
84
|
+
|
85
|
+
## List Option Values of a Option Type
|
86
|
+
|
87
|
+
```shell
|
88
|
+
curl "https://example.com/api/v2/option_types/1/option_values"
|
89
|
+
```
|
90
|
+
|
91
|
+
```json
|
92
|
+
{
|
93
|
+
"data": [
|
94
|
+
{
|
95
|
+
"id": "1",
|
96
|
+
"type": "spree_option_values",
|
97
|
+
"attributes": {
|
98
|
+
"name": "Small",
|
99
|
+
"presentation": "S",
|
100
|
+
"position": 1
|
101
|
+
},
|
102
|
+
"relationships": {
|
103
|
+
"option_type": {
|
104
|
+
"data": {
|
105
|
+
"type": "spree_option_types",
|
106
|
+
"id": "1"
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
]
|
112
|
+
}
|
113
|
+
```
|
114
|
+
|
115
|
+
See all of the option values that an option type owns.
|
116
|
+
|
117
|
+
## Show Option Values of a Option Type
|
118
|
+
|
119
|
+
```shell
|
120
|
+
curl "https://example.com/api/v2/option_types/1/option_values/1"
|
121
|
+
```
|
122
|
+
|
123
|
+
```json
|
124
|
+
{
|
125
|
+
"data": {
|
126
|
+
"id": "1",
|
127
|
+
"type": "spree_option_values",
|
128
|
+
"attributes": {
|
129
|
+
"name": "Small",
|
130
|
+
"presentation": "S",
|
131
|
+
"position": 1
|
132
|
+
},
|
133
|
+
"relationships": {
|
134
|
+
"option_type": {
|
135
|
+
"data": {
|
136
|
+
"type": "spree_option_types",
|
137
|
+
"id": "1"
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
```
|
144
|
+
|
145
|
+
Fetch an option value that an option type owns.
|
146
|
+
|
147
|
+
## List Products of a Option Type
|
148
|
+
|
149
|
+
```shell
|
150
|
+
curl "https://example.com/api/v2/option_types/1/products"
|
151
|
+
```
|
152
|
+
|
153
|
+
```json
|
154
|
+
{
|
155
|
+
"data": [
|
156
|
+
{
|
157
|
+
"id": "1",
|
158
|
+
"type": "spree_products",
|
159
|
+
"attributes": {
|
160
|
+
"name": "Ruby on Rails Tote",
|
161
|
+
"description": "Velit nemo odio ducimus nobis non doloremque beatae sunt. Totam quia voluptatum perferendis tempore sed voluptate consequuntur. Sit id corporis autem veritatis reprehenderit.",
|
162
|
+
"slug": "ruby-on-rails-tote",
|
163
|
+
"meta_description": null,
|
164
|
+
"meta_keywords": null,
|
165
|
+
"store_name": "Whole New Home"
|
166
|
+
},
|
167
|
+
"relationships": {
|
168
|
+
"master": {
|
169
|
+
"data": {
|
170
|
+
"type": "spree_variants",
|
171
|
+
"id": "1"
|
172
|
+
}
|
173
|
+
},
|
174
|
+
"variants": {
|
175
|
+
"data": []
|
176
|
+
},
|
177
|
+
"taxons": {
|
178
|
+
"data": [
|
179
|
+
{
|
180
|
+
"type": "spree_taxons",
|
181
|
+
"id": "1"
|
182
|
+
}
|
183
|
+
]
|
184
|
+
},
|
185
|
+
"option_types": {
|
186
|
+
"data": [
|
187
|
+
{
|
188
|
+
"type": "spree_option_types",
|
189
|
+
"id": "1"
|
190
|
+
}
|
191
|
+
]
|
192
|
+
},
|
193
|
+
"images": {
|
194
|
+
"data": [
|
195
|
+
{
|
196
|
+
"type": "spree_images",
|
197
|
+
"id": "1"
|
198
|
+
}
|
199
|
+
]
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
]
|
204
|
+
}
|
205
|
+
```
|
206
|
+
|
207
|
+
See all of the products that an option type owns.
|
208
|
+
|
209
|
+
## Show Product of a Option Type
|
210
|
+
|
211
|
+
```shell
|
212
|
+
curl "https://example.com/api/v2/option_types/1/products/1"
|
213
|
+
```
|
214
|
+
|
215
|
+
```json
|
216
|
+
{
|
217
|
+
"data": {
|
218
|
+
"id": "1",
|
219
|
+
"type": "spree_products",
|
220
|
+
"attributes": {
|
221
|
+
"name": "Ruby on Rails Tote",
|
222
|
+
"description": "Velit nemo odio ducimus nobis non doloremque beatae sunt. Totam quia voluptatum perferendis tempore sed voluptate consequuntur. Sit id corporis autem veritatis reprehenderit.",
|
223
|
+
"slug": "ruby-on-rails-tote",
|
224
|
+
"meta_description": null,
|
225
|
+
"meta_keywords": null,
|
226
|
+
"store_name": "Whole New Home"
|
227
|
+
},
|
228
|
+
"relationships": {
|
229
|
+
"master": {
|
230
|
+
"data": {
|
231
|
+
"type": "spree_variants",
|
232
|
+
"id": "1"
|
233
|
+
}
|
234
|
+
},
|
235
|
+
"variants": {
|
236
|
+
"data": []
|
237
|
+
},
|
238
|
+
"taxons": {
|
239
|
+
"data": [
|
240
|
+
{
|
241
|
+
"type": "spree_taxons",
|
242
|
+
"id": "1"
|
243
|
+
}
|
244
|
+
]
|
245
|
+
},
|
246
|
+
"option_types": {
|
247
|
+
"data": [
|
248
|
+
{
|
249
|
+
"type": "spree_option_types",
|
250
|
+
"id": "1"
|
251
|
+
}
|
252
|
+
]
|
253
|
+
},
|
254
|
+
"images": {
|
255
|
+
"data": [
|
256
|
+
{
|
257
|
+
"type": "spree_images",
|
258
|
+
"id": "1"
|
259
|
+
}
|
260
|
+
]
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
}
|
265
|
+
```
|
266
|
+
|
267
|
+
Find a product that an option type owns.
|
@@ -0,0 +1,227 @@
|
|
1
|
+
# Option Values
|
2
|
+
|
3
|
+
## List Option Values
|
4
|
+
|
5
|
+
```shell
|
6
|
+
curl "https://example.com/api/v2/option_values"
|
7
|
+
```
|
8
|
+
|
9
|
+
```json
|
10
|
+
{
|
11
|
+
"data": [
|
12
|
+
{
|
13
|
+
"id": "1",
|
14
|
+
"type": "spree_option_values",
|
15
|
+
"attributes": {
|
16
|
+
"name": "Small",
|
17
|
+
"presentation": "S",
|
18
|
+
"position": 1
|
19
|
+
},
|
20
|
+
"relationships": {
|
21
|
+
"option_type": {
|
22
|
+
"data": {
|
23
|
+
"type": "spree_option_types",
|
24
|
+
"id": "1"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
]
|
30
|
+
}
|
31
|
+
```
|
32
|
+
|
33
|
+
List all of the option values.
|
34
|
+
|
35
|
+
## Show Option Value
|
36
|
+
|
37
|
+
```shell
|
38
|
+
curl "https://example.com/api/v2/option_values/1"
|
39
|
+
```
|
40
|
+
|
41
|
+
```json
|
42
|
+
{
|
43
|
+
"data": {
|
44
|
+
"id": "1",
|
45
|
+
"type": "spree_option_values",
|
46
|
+
"attributes": {
|
47
|
+
"name": "Small",
|
48
|
+
"presentation": "S",
|
49
|
+
"position": 1
|
50
|
+
},
|
51
|
+
"relationships": {
|
52
|
+
"option_type": {
|
53
|
+
"data": {
|
54
|
+
"type": "spree_option_types",
|
55
|
+
"id": "1"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
```
|
62
|
+
|
63
|
+
Find an option value by its `id`.
|
64
|
+
|
65
|
+
## Show Option Type of an Option Value
|
66
|
+
|
67
|
+
```shell
|
68
|
+
curl "https://example.com/api/v2/option_values/1/option_type"
|
69
|
+
```
|
70
|
+
|
71
|
+
```json
|
72
|
+
{
|
73
|
+
"data": {
|
74
|
+
"id": "1",
|
75
|
+
"type": "spree_option_types",
|
76
|
+
"attributes": {
|
77
|
+
"name": "tshirt-size",
|
78
|
+
"presentation": "Size",
|
79
|
+
"position": 1
|
80
|
+
},
|
81
|
+
"relationships": {
|
82
|
+
"option_values": {
|
83
|
+
"data": [
|
84
|
+
{
|
85
|
+
"type": "spree_option_values",
|
86
|
+
"id": "1"
|
87
|
+
}
|
88
|
+
]
|
89
|
+
},
|
90
|
+
"products": {
|
91
|
+
"data": [
|
92
|
+
{
|
93
|
+
"type": "spree_products",
|
94
|
+
"id": "1"
|
95
|
+
}
|
96
|
+
]
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
```
|
102
|
+
|
103
|
+
Find the option type of an option value by the option value's `id`.
|
104
|
+
|
105
|
+
## List Variants of an Option Value
|
106
|
+
|
107
|
+
```shell
|
108
|
+
curl "https://example.com/api/v2/option_values/1/variants"
|
109
|
+
```
|
110
|
+
|
111
|
+
```json
|
112
|
+
{
|
113
|
+
"data": [
|
114
|
+
{
|
115
|
+
"id": "1",
|
116
|
+
"type": "spree_variants",
|
117
|
+
"attributes": {
|
118
|
+
"sku": "ROR-00001",
|
119
|
+
"weight": "0.0",
|
120
|
+
"height": null,
|
121
|
+
"width": null,
|
122
|
+
"depth": null,
|
123
|
+
"is_master": false,
|
124
|
+
"position": 2,
|
125
|
+
"name": "Ruby on Rails Baseball Jersey",
|
126
|
+
"price": "15.99",
|
127
|
+
"display_price": "$15.99 CAD"
|
128
|
+
},
|
129
|
+
"relationships": {
|
130
|
+
"prices": {
|
131
|
+
"data": [
|
132
|
+
{
|
133
|
+
"type": "spree_prices",
|
134
|
+
"id": "33"
|
135
|
+
}
|
136
|
+
]
|
137
|
+
},
|
138
|
+
"option_values": {
|
139
|
+
"data": [
|
140
|
+
{
|
141
|
+
"type": "spree_option_values",
|
142
|
+
"id": "1"
|
143
|
+
}
|
144
|
+
]
|
145
|
+
},
|
146
|
+
"images": {
|
147
|
+
"data": [
|
148
|
+
{
|
149
|
+
"type": "spree_images",
|
150
|
+
"id": "1"
|
151
|
+
}
|
152
|
+
]
|
153
|
+
},
|
154
|
+
"product": {
|
155
|
+
"data": {
|
156
|
+
"type": "spree_products",
|
157
|
+
"id": "3"
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
]
|
163
|
+
}
|
164
|
+
```
|
165
|
+
|
166
|
+
List all of the variants that belong to an option value via the option value's `id`.
|
167
|
+
|
168
|
+
## Show Variant of an Option Value
|
169
|
+
|
170
|
+
```shell
|
171
|
+
curl "https://example.com/api/v2/option_values/1/variants/1"
|
172
|
+
```
|
173
|
+
|
174
|
+
```json
|
175
|
+
{
|
176
|
+
"data": {
|
177
|
+
"id": "1",
|
178
|
+
"type": "spree_variants",
|
179
|
+
"attributes": {
|
180
|
+
"sku": "ROR-00001",
|
181
|
+
"weight": "0.0",
|
182
|
+
"height": null,
|
183
|
+
"width": null,
|
184
|
+
"depth": null,
|
185
|
+
"is_master": false,
|
186
|
+
"position": 2,
|
187
|
+
"name": "Ruby on Rails Baseball Jersey",
|
188
|
+
"price": "15.99",
|
189
|
+
"display_price": "$15.99 CAD"
|
190
|
+
},
|
191
|
+
"relationships": {
|
192
|
+
"prices": {
|
193
|
+
"data": [
|
194
|
+
{
|
195
|
+
"type": "spree_prices",
|
196
|
+
"id": "33"
|
197
|
+
}
|
198
|
+
]
|
199
|
+
},
|
200
|
+
"option_values": {
|
201
|
+
"data": [
|
202
|
+
{
|
203
|
+
"type": "spree_option_values",
|
204
|
+
"id": "1"
|
205
|
+
}
|
206
|
+
]
|
207
|
+
},
|
208
|
+
"images": {
|
209
|
+
"data": [
|
210
|
+
{
|
211
|
+
"type": "spree_images",
|
212
|
+
"id": "1"
|
213
|
+
}
|
214
|
+
]
|
215
|
+
},
|
216
|
+
"product": {
|
217
|
+
"data": {
|
218
|
+
"type": "spree_products",
|
219
|
+
"id": "3"
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
```
|
226
|
+
|
227
|
+
Show a variant that belongs to an option value via the option value's `id`.
|