spree_api 4.3.0.rc3 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +3 -1
- data/app/controllers/spree/api/v2/storefront/cart_controller.rb +39 -1
- data/app/controllers/spree/api/v2/storefront/products_controller.rb +8 -0
- data/app/models/spree/api_dependencies.rb +5 -2
- data/app/presenters/spree/api/products/filters_presenter.rb +39 -0
- data/config/routes.rb +2 -0
- data/docs/v2/platform/index.yaml +264 -162
- data/docs/v2/storefront/index.yaml +71 -9
- data/lib/spree/api/testing_support/v2/platform_contexts.rb +13 -3
- metadata +10 -9
@@ -161,11 +161,11 @@ paths:
|
|
161
161
|
type: string
|
162
162
|
example: john@snow.org
|
163
163
|
bill_address_id:
|
164
|
-
type:
|
165
|
-
example: 1
|
164
|
+
type: string
|
165
|
+
example: '1'
|
166
166
|
ship_address_id:
|
167
|
-
type:
|
168
|
-
example: 1
|
167
|
+
type: string
|
168
|
+
example: '1'
|
169
169
|
password:
|
170
170
|
type: string
|
171
171
|
example: spree123
|
@@ -550,7 +550,6 @@ paths:
|
|
550
550
|
application/vnd.api+json:
|
551
551
|
schema:
|
552
552
|
$ref: '#/components/schemas/Cart'
|
553
|
-
examples: {}
|
554
553
|
'404':
|
555
554
|
$ref: '#/components/responses/404NotFound'
|
556
555
|
security:
|
@@ -791,6 +790,70 @@ paths:
|
|
791
790
|
- orderToken: []
|
792
791
|
- bearerAuth: []
|
793
792
|
summary: Get estimated Shipping Rates
|
793
|
+
/api/v2/storefront/cart/associate:
|
794
|
+
patch:
|
795
|
+
description: Associates a guest cart with the currently signed in user.
|
796
|
+
tags:
|
797
|
+
- Cart
|
798
|
+
operationId: Associate
|
799
|
+
parameters:
|
800
|
+
- name: guest_order_token
|
801
|
+
in: query
|
802
|
+
description: Token of the guest cart to be associated with user
|
803
|
+
schema:
|
804
|
+
type: string
|
805
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
806
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
807
|
+
responses:
|
808
|
+
'200':
|
809
|
+
description: Cart has been successfully associated
|
810
|
+
content:
|
811
|
+
application/vnd.api+json:
|
812
|
+
schema:
|
813
|
+
$ref: '#/components/schemas/Cart'
|
814
|
+
'403':
|
815
|
+
$ref: '#/components/responses/403Forbidden'
|
816
|
+
'422':
|
817
|
+
description: Returned for already assigned cart
|
818
|
+
content:
|
819
|
+
application/vnd.api+json:
|
820
|
+
schema:
|
821
|
+
$ref: '#/components/schemas/Error'
|
822
|
+
security:
|
823
|
+
- bearerAuth: []
|
824
|
+
summary: Associate a guest cart to a user
|
825
|
+
/api/v2/storefront/cart/change_currency:
|
826
|
+
patch:
|
827
|
+
description: Changes cart currency and recalculates its value.
|
828
|
+
tags:
|
829
|
+
- Cart
|
830
|
+
operationId: change-currency
|
831
|
+
parameters:
|
832
|
+
- name: new_currency
|
833
|
+
in: query
|
834
|
+
description: Currency to change the cart to
|
835
|
+
schema:
|
836
|
+
type: string
|
837
|
+
- $ref: '#/components/parameters/CartIncludeParam'
|
838
|
+
- $ref: '#/components/parameters/SparseFieldsParam'
|
839
|
+
responses:
|
840
|
+
'200':
|
841
|
+
description: Currency has been successfully changed
|
842
|
+
content:
|
843
|
+
application/vnd.api+json:
|
844
|
+
schema:
|
845
|
+
$ref: '#/components/schemas/Cart'
|
846
|
+
'403':
|
847
|
+
$ref: '#/components/responses/403Forbidden'
|
848
|
+
'422':
|
849
|
+
description: Returned when currency is not supported or cart cannot be updated
|
850
|
+
content:
|
851
|
+
application/vnd.api+json:
|
852
|
+
schema:
|
853
|
+
$ref: '#/components/schemas/Error'
|
854
|
+
security:
|
855
|
+
- bearerAuth: []
|
856
|
+
summary: Change cart currency
|
794
857
|
/api/v2/storefront/checkout:
|
795
858
|
patch:
|
796
859
|
description: |-
|
@@ -13494,7 +13557,6 @@ components:
|
|
13494
13557
|
- $ref: '#/components/schemas/User'
|
13495
13558
|
- $ref: '#/components/schemas/Address'
|
13496
13559
|
- $ref: '#/components/schemas/ShipmentAttributesWithoutRelationsips'
|
13497
|
-
type: object
|
13498
13560
|
required:
|
13499
13561
|
- data
|
13500
13562
|
- included
|
@@ -15812,14 +15874,14 @@ components:
|
|
15812
15874
|
schema:
|
15813
15875
|
type: string
|
15814
15876
|
example: 100x50
|
15815
|
-
description:
|
15877
|
+
description: Specifies dimensions for included images at transformed_url attribute.
|
15816
15878
|
ProductImageTransformationQualityParam:
|
15817
15879
|
in: query
|
15818
15880
|
name: 'image_transformation[quality]'
|
15819
15881
|
schema:
|
15820
15882
|
type: string
|
15821
|
-
example: 70
|
15822
|
-
description:
|
15883
|
+
example: '70'
|
15884
|
+
description: Specifies quality for included images at transformed_url attribute
|
15823
15885
|
TaxonIncludeParam:
|
15824
15886
|
name: include
|
15825
15887
|
in: query
|
@@ -121,6 +121,8 @@ shared_examples 'GET records list' do |resource_name, include_example, filter_ex
|
|
121
121
|
get "Returns a list of #{resource_name.pluralize}" do
|
122
122
|
tags resource_name.pluralize
|
123
123
|
security [ bearer_auth: [] ]
|
124
|
+
description "Returns a list of #{resource_name.pluralize}"
|
125
|
+
operationId "#{resource_name.parameterize.pluralize.to_sym}-list"
|
124
126
|
include_context 'jsonapi pagination'
|
125
127
|
json_api_include_parameter(include_example)
|
126
128
|
json_api_filter_parameter(filter_example)
|
@@ -137,6 +139,8 @@ shared_examples 'GET record' do |resource_name, include_example|
|
|
137
139
|
get "Returns #{resource_name.articleize}" do
|
138
140
|
tags resource_name.pluralize
|
139
141
|
security [ bearer_auth: [] ]
|
142
|
+
description "Returns #{resource_name.articleize}"
|
143
|
+
operationId "show-#{resource_name.parameterize.to_sym}"
|
140
144
|
parameter name: :id, in: :path, type: :string
|
141
145
|
json_api_include_parameter(include_example)
|
142
146
|
|
@@ -148,12 +152,14 @@ end
|
|
148
152
|
|
149
153
|
# create
|
150
154
|
shared_examples 'POST create record' do |resource_name, include_example|
|
151
|
-
param_name = resource_name.
|
155
|
+
param_name = resource_name.parameterize(separator: '_').to_sym
|
152
156
|
|
153
157
|
post "Creates #{resource_name.articleize}" do
|
154
158
|
tags resource_name.pluralize
|
155
159
|
consumes 'application/json'
|
156
160
|
security [ bearer_auth: [] ]
|
161
|
+
description "Creates #{resource_name.articleize}"
|
162
|
+
operationId "create-#{resource_name.parameterize.to_sym}"
|
157
163
|
parameter name: param_name, in: :body, schema: { '$ref' => "#/components/schemas/#{param_name}_params" }
|
158
164
|
json_api_include_parameter(include_example)
|
159
165
|
|
@@ -166,11 +172,13 @@ end
|
|
166
172
|
|
167
173
|
# update
|
168
174
|
shared_examples 'PUT update record' do |resource_name, include_example|
|
169
|
-
param_name = resource_name.
|
175
|
+
param_name = resource_name.parameterize(separator: '_').to_sym
|
170
176
|
|
171
177
|
put "Updates #{resource_name.articleize}" do
|
172
178
|
tags resource_name.pluralize
|
173
179
|
security [ bearer_auth: [] ]
|
180
|
+
description "Updates #{resource_name.articleize}"
|
181
|
+
operationId "update-#{resource_name.parameterize.to_sym}"
|
174
182
|
consumes 'application/json'
|
175
183
|
parameter name: :id, in: :path, type: :string
|
176
184
|
parameter name: param_name, in: :body, schema: { '$ref' => "#/components/schemas/#{param_name}_params" }
|
@@ -190,6 +198,8 @@ shared_examples 'DELETE record' do |resource_name|
|
|
190
198
|
delete "Deletes #{resource_name.articleize}" do
|
191
199
|
tags resource_name.pluralize
|
192
200
|
security [ bearer_auth: [] ]
|
201
|
+
description "Deletes #{resource_name.articleize}"
|
202
|
+
operationId "delete-#{resource_name.parameterize.to_sym}"
|
193
203
|
parameter name: :id, in: :path, type: :string
|
194
204
|
|
195
205
|
it_behaves_like 'record deleted'
|
@@ -199,7 +209,7 @@ shared_examples 'DELETE record' do |resource_name|
|
|
199
209
|
end
|
200
210
|
|
201
211
|
shared_examples 'CRUD examples' do |resource_name, include_example, filter_example|
|
202
|
-
resource_path = resource_name.
|
212
|
+
resource_path = resource_name.parameterize(separator: '_').pluralize
|
203
213
|
|
204
214
|
path "/api/v2/platform/#{resource_path}" do
|
205
215
|
include_examples 'GET records list', resource_name, include_example, filter_example
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.0
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-rspec
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.3.0
|
61
|
+
version: 4.3.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.3.0
|
68
|
+
version: 4.3.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rabl
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,6 +215,7 @@ files:
|
|
215
215
|
- app/models/concerns/spree/user_api_methods.rb
|
216
216
|
- app/models/spree/api_configuration.rb
|
217
217
|
- app/models/spree/api_dependencies.rb
|
218
|
+
- app/presenters/spree/api/products/filters_presenter.rb
|
218
219
|
- app/serializers/concerns/spree/api/v2/image_transformation_concern.rb
|
219
220
|
- app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb
|
220
221
|
- app/serializers/concerns/spree/api/v2/taxon_image_transformation_concern.rb
|
@@ -411,9 +412,9 @@ licenses:
|
|
411
412
|
- BSD-3-Clause
|
412
413
|
metadata:
|
413
414
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
414
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.3.0
|
415
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.3.0
|
415
416
|
documentation_uri: https://dev-docs.spreecommerce.org/
|
416
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.3.0
|
417
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.3.0
|
417
418
|
post_install_message:
|
418
419
|
rdoc_options: []
|
419
420
|
require_paths:
|
@@ -425,11 +426,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
425
426
|
version: '2.5'
|
426
427
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
427
428
|
requirements:
|
428
|
-
- - "
|
429
|
+
- - ">="
|
429
430
|
- !ruby/object:Gem::Version
|
430
|
-
version:
|
431
|
+
version: '0'
|
431
432
|
requirements: []
|
432
|
-
rubygems_version: 3.
|
433
|
+
rubygems_version: 3.1.4
|
433
434
|
signing_key:
|
434
435
|
specification_version: 4
|
435
436
|
summary: Spree's API
|