spree_api 3.7.9 → 3.7.14
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/app/controllers/spree/api/v2/base_controller.rb +25 -1
- data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +0 -8
- data/app/controllers/spree/api/v2/storefront/account/orders_controller.rb +0 -28
- data/app/controllers/spree/api/v2/storefront/account_controller.rb +0 -8
- data/app/controllers/spree/api/v2/storefront/order_status_controller.rb +6 -8
- data/app/controllers/spree/api/v2/storefront/products_controller.rb +0 -28
- data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +0 -24
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +9 -0
- data/docs/v2/storefront/index.yaml +2 -0
- data/lib/spree/api/testing_support/v2/base.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6031bec6c997b390ca7096fb411a07198011536677687a7c5b61b60fe5538d19
|
4
|
+
data.tar.gz: c37818ea854581de7302f65192cfac609a8ff0ddbb019c663502cf40a1366e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b78338d29d9f2632491b0a06d8ea1d11c5a42b23faa256ec84c4f13634bb2190ef6eb6757ce706055a8071893c2002710b87a9a17ec6829a7700cd908660286
|
7
|
+
data.tar.gz: dad3b9c8d033a1c42b57b01e84f7c91ff196be47aff4aa50608c7d0ad1fa5c0a5854bc8ef55803dc367bb0ec9e861a57f9e84bb9fc91b76b6536daaa2634032f
|
@@ -13,6 +13,25 @@ module Spree
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
+
def serialize_collection(collection)
|
17
|
+
collection_serializer.new(
|
18
|
+
collection,
|
19
|
+
collection_options(collection)
|
20
|
+
).serializable_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def serialize_resource(resource)
|
24
|
+
resource_serializer.new(
|
25
|
+
resource,
|
26
|
+
include: resource_includes,
|
27
|
+
fields: sparse_fields
|
28
|
+
).serializable_hash
|
29
|
+
end
|
30
|
+
|
31
|
+
def paginated_collection
|
32
|
+
collection_paginator.new(sorted_collection, params).call
|
33
|
+
end
|
34
|
+
|
16
35
|
def collection_paginator
|
17
36
|
Spree::Api::Dependencies.storefront_collection_paginator.constantize
|
18
37
|
end
|
@@ -36,7 +55,12 @@ module Spree
|
|
36
55
|
end
|
37
56
|
|
38
57
|
def spree_current_user
|
39
|
-
|
58
|
+
return nil unless doorkeeper_token
|
59
|
+
return @spree_current_user if @spree_current_user
|
60
|
+
|
61
|
+
doorkeeper_authorize!
|
62
|
+
|
63
|
+
@spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id)
|
40
64
|
end
|
41
65
|
|
42
66
|
def spree_authorize!(action, subject, *args)
|
@@ -40,14 +40,6 @@ module Spree
|
|
40
40
|
).serializable_hash
|
41
41
|
end
|
42
42
|
|
43
|
-
def serialize_resource(resource)
|
44
|
-
resource_serializer.new(
|
45
|
-
resource,
|
46
|
-
include: resource_includes,
|
47
|
-
fields: sparse_fields
|
48
|
-
).serializable_hash
|
49
|
-
end
|
50
|
-
|
51
43
|
def scope
|
52
44
|
spree_current_user.credit_cards.accessible_by(current_ability, :read)
|
53
45
|
end
|
@@ -19,10 +19,6 @@ module Spree
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def paginated_collection
|
23
|
-
collection_paginator.new(sorted_collection, params).call
|
24
|
-
end
|
25
|
-
|
26
22
|
def sorted_collection
|
27
23
|
collection_sorter.new(collection, params).call
|
28
24
|
end
|
@@ -38,21 +34,6 @@ module Spree
|
|
38
34
|
resource
|
39
35
|
end
|
40
36
|
|
41
|
-
def serialize_collection(collection)
|
42
|
-
collection_serializer.new(
|
43
|
-
collection,
|
44
|
-
collection_options(collection)
|
45
|
-
).serializable_hash
|
46
|
-
end
|
47
|
-
|
48
|
-
def serialize_resource(resource)
|
49
|
-
resource_serializer.new(
|
50
|
-
resource,
|
51
|
-
include: resource_includes,
|
52
|
-
sparse_fields: sparse_fields
|
53
|
-
).serializable_hash
|
54
|
-
end
|
55
|
-
|
56
37
|
def collection_serializer
|
57
38
|
Spree::Api::Dependencies.storefront_cart_serializer.constantize
|
58
39
|
end
|
@@ -76,15 +57,6 @@ module Spree
|
|
76
57
|
def collection_paginator
|
77
58
|
Spree::Api::Dependencies.storefront_collection_paginator.constantize
|
78
59
|
end
|
79
|
-
|
80
|
-
def collection_options(collection)
|
81
|
-
{
|
82
|
-
links: collection_links(collection),
|
83
|
-
meta: collection_meta(collection),
|
84
|
-
include: resource_includes,
|
85
|
-
sparse_fields: sparse_fields
|
86
|
-
}
|
87
|
-
end
|
88
60
|
end
|
89
61
|
end
|
90
62
|
end
|
@@ -15,14 +15,6 @@ module Spree
|
|
15
15
|
spree_current_user
|
16
16
|
end
|
17
17
|
|
18
|
-
def serialize_resource(resource)
|
19
|
-
resource_serializer.new(
|
20
|
-
resource,
|
21
|
-
include: resource_includes,
|
22
|
-
fields: sparse_fields
|
23
|
-
).serializable_hash
|
24
|
-
end
|
25
|
-
|
26
18
|
def resource_serializer
|
27
19
|
Spree::Api::Dependencies.storefront_user_serializer.constantize
|
28
20
|
end
|
@@ -5,6 +5,8 @@ module Spree
|
|
5
5
|
class OrderStatusController < ::Spree::Api::V2::BaseController
|
6
6
|
include Spree::Api::V2::Storefront::OrderConcern
|
7
7
|
|
8
|
+
before_action :ensure_order_token
|
9
|
+
|
8
10
|
def show
|
9
11
|
render_serialized_payload { serialize_resource(resource) }
|
10
12
|
end
|
@@ -18,14 +20,6 @@ module Spree
|
|
18
20
|
resource
|
19
21
|
end
|
20
22
|
|
21
|
-
def serialize_resource(resource)
|
22
|
-
resource_serializer.new(
|
23
|
-
resource,
|
24
|
-
include: resource_includes,
|
25
|
-
sparse_fields: sparse_fields
|
26
|
-
).serializable_hash
|
27
|
-
end
|
28
|
-
|
29
23
|
def resource_finder
|
30
24
|
Spree::Api::Dependencies.storefront_completed_order_finder.constantize
|
31
25
|
end
|
@@ -33,6 +27,10 @@ module Spree
|
|
33
27
|
def resource_serializer
|
34
28
|
Spree::Api::Dependencies.storefront_cart_serializer.constantize
|
35
29
|
end
|
30
|
+
|
31
|
+
def ensure_order_token
|
32
|
+
raise ActiveRecord::RecordNotFound unless order_token.present?
|
33
|
+
end
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -15,25 +15,6 @@ module Spree
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
def serialize_collection(collection)
|
19
|
-
collection_serializer.new(
|
20
|
-
collection,
|
21
|
-
collection_options(collection)
|
22
|
-
).serializable_hash
|
23
|
-
end
|
24
|
-
|
25
|
-
def serialize_resource(resource)
|
26
|
-
resource_serializer.new(
|
27
|
-
resource,
|
28
|
-
include: resource_includes,
|
29
|
-
fields: sparse_fields
|
30
|
-
).serializable_hash
|
31
|
-
end
|
32
|
-
|
33
|
-
def paginated_collection
|
34
|
-
collection_paginator.new(sorted_collection, params).call
|
35
|
-
end
|
36
|
-
|
37
18
|
def sorted_collection
|
38
19
|
collection_sorter.new(collection, params, current_currency).call
|
39
20
|
end
|
@@ -62,15 +43,6 @@ module Spree
|
|
62
43
|
Spree::Api::Dependencies.storefront_product_serializer.constantize
|
63
44
|
end
|
64
45
|
|
65
|
-
def collection_options(collection)
|
66
|
-
{
|
67
|
-
links: collection_links(collection),
|
68
|
-
meta: collection_meta(collection),
|
69
|
-
include: resource_includes,
|
70
|
-
fields: sparse_fields
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
46
|
def scope
|
75
47
|
Spree::Product.accessible_by(current_ability, :read).includes(scope_includes)
|
76
48
|
end
|
@@ -15,21 +15,6 @@ module Spree
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
def serialize_collection(collection)
|
19
|
-
collection_serializer.new(
|
20
|
-
collection,
|
21
|
-
collection_options(collection)
|
22
|
-
).serializable_hash
|
23
|
-
end
|
24
|
-
|
25
|
-
def serialize_resource(resource)
|
26
|
-
resource_serializer.new(
|
27
|
-
resource,
|
28
|
-
include: resource_includes,
|
29
|
-
fields: sparse_fields
|
30
|
-
).serializable_hash
|
31
|
-
end
|
32
|
-
|
33
18
|
def collection_serializer
|
34
19
|
Spree::Api::Dependencies.storefront_taxon_serializer.constantize
|
35
20
|
end
|
@@ -42,15 +27,6 @@ module Spree
|
|
42
27
|
Spree::Api::Dependencies.storefront_taxon_finder.constantize
|
43
28
|
end
|
44
29
|
|
45
|
-
def collection_options(collection)
|
46
|
-
{
|
47
|
-
links: collection_links(collection),
|
48
|
-
meta: collection_meta(collection),
|
49
|
-
include: resource_includes,
|
50
|
-
fields: sparse_fields
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
30
|
def paginated_collection
|
55
31
|
collection_paginator.new(collection, params).call
|
56
32
|
end
|
@@ -31,6 +31,15 @@ module Spree
|
|
31
31
|
def pagination_url(page)
|
32
32
|
url_for(collection_permitted_params.merge(page: page))
|
33
33
|
end
|
34
|
+
|
35
|
+
def collection_options(collection)
|
36
|
+
{
|
37
|
+
links: collection_links(collection),
|
38
|
+
meta: collection_meta(collection),
|
39
|
+
include: resource_includes,
|
40
|
+
fields: sparse_fields
|
41
|
+
}
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
36
45
|
end
|
@@ -4,7 +4,7 @@ shared_context 'API v2 tokens' do
|
|
4
4
|
let(:headers_order_token) { { 'X-Spree-Order-Token' => order.token } }
|
5
5
|
end
|
6
6
|
|
7
|
-
[200, 201, 400, 404, 403, 422].each do |status_code|
|
7
|
+
[200, 201, 400, 401, 404, 403, 422].each do |status_code|
|
8
8
|
shared_examples "returns #{status_code} HTTP status" do
|
9
9
|
it "returns #{status_code}" do
|
10
10
|
expect(response.status).to eq(status_code)
|
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: 3.7.
|
4
|
+
version: 3.7.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-rspec
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.7.
|
33
|
+
version: 3.7.14
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.7.
|
40
|
+
version: 3.7.14
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rabl
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -314,7 +314,7 @@ homepage: http://spreecommerce.org
|
|
314
314
|
licenses:
|
315
315
|
- BSD-3-Clause
|
316
316
|
metadata: {}
|
317
|
-
post_install_message:
|
317
|
+
post_install_message:
|
318
318
|
rdoc_options: []
|
319
319
|
require_paths:
|
320
320
|
- lib
|
@@ -329,8 +329,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
329
|
- !ruby/object:Gem::Version
|
330
330
|
version: '0'
|
331
331
|
requirements: []
|
332
|
-
rubygems_version: 3.
|
333
|
-
signing_key:
|
332
|
+
rubygems_version: 3.1.4
|
333
|
+
signing_key:
|
334
334
|
specification_version: 4
|
335
335
|
summary: Spree's API
|
336
336
|
test_files: []
|