spree_api 5.5.2 → 5.5.3
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/v3/store/products/filters_controller.rb +7 -6
- data/app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb +11 -0
- data/app/serializers/spree/api/v3/product_filter_availability_serializer.rb +15 -0
- data/app/serializers/spree/api/v3/product_filter_category_option_serializer.rb +14 -0
- data/app/serializers/spree/api/v3/product_filter_category_serializer.rb +15 -0
- data/app/serializers/spree/api/v3/product_filter_option_serializer.rb +18 -0
- data/app/serializers/spree/api/v3/product_filter_option_value_serializer.rb +17 -0
- data/app/serializers/spree/api/v3/product_filter_price_range_serializer.rb +15 -0
- data/app/serializers/spree/api/v3/product_filter_sort_option_serializer.rb +11 -0
- data/app/serializers/spree/api/v3/product_filters_serializer.rb +36 -0
- data/lib/spree/api/dependencies.rb +9 -0
- metadata +15 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6fe1449422b9662417af9cc9e31ea0b9dc08624e7ad70b0a0e1570cf0f98698
|
|
4
|
+
data.tar.gz: b859292883306b7128b3057e2df54a298469ea94cb246bb064e58b16e21d9f3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4b81e56588d8ea4afa9756d6d3d128ff11222fd3fe34acf52ffc1715e83a87e58b4749f8b0dcfc7254fedad589133c15b5c828ae1e501b4f94df0bdc753afd3
|
|
7
|
+
data.tar.gz: 4b28146ceb74aa7114c2ffea51f1fa4b107f5a65c48ed331c59354da6bd5bf99ed38242a298643832622a14e69958c8b4038af72c338430dc5c6ff72acc5b810
|
|
@@ -14,17 +14,18 @@ module Spree
|
|
|
14
14
|
filters: (search_filters || {}).merge('_category' => category)
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
filters: result.filters,
|
|
19
|
-
sort_options: result.sort_options,
|
|
20
|
-
default_sort: result.default_sort,
|
|
21
|
-
total_count: result.total_count
|
|
22
|
-
}
|
|
17
|
+
serialize_resource(result)
|
|
23
18
|
end
|
|
24
19
|
|
|
25
20
|
render json: json
|
|
26
21
|
end
|
|
27
22
|
|
|
23
|
+
protected
|
|
24
|
+
|
|
25
|
+
def serializer_class
|
|
26
|
+
Spree.api.product_filters_serializer
|
|
27
|
+
end
|
|
28
|
+
|
|
28
29
|
private
|
|
29
30
|
|
|
30
31
|
def filters_cache_key
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFilterAvailabilitySerializer < BaseSerializer
|
|
5
|
+
typelize id: :string,
|
|
6
|
+
type: "'availability'",
|
|
7
|
+
options: [:ProductFilterAvailabilityOption, multi: true]
|
|
8
|
+
|
|
9
|
+
attributes :id, :type
|
|
10
|
+
|
|
11
|
+
many :options, resource: proc { Spree.api.product_filter_availability_option_serializer }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFilterCategoryOptionSerializer < BaseSerializer
|
|
5
|
+
typelize id: :string,
|
|
6
|
+
name: :string,
|
|
7
|
+
permalink: :string,
|
|
8
|
+
count: :number
|
|
9
|
+
|
|
10
|
+
attributes :id, :name, :permalink, :count
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFilterCategorySerializer < BaseSerializer
|
|
5
|
+
typelize id: :string,
|
|
6
|
+
type: "'category'",
|
|
7
|
+
options: [:ProductFilterCategoryOption, multi: true]
|
|
8
|
+
|
|
9
|
+
attributes :id, :type
|
|
10
|
+
|
|
11
|
+
many :options, resource: proc { Spree.api.product_filter_category_option_serializer }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFilterOptionSerializer < BaseSerializer
|
|
5
|
+
typelize id: :string,
|
|
6
|
+
type: "'option'",
|
|
7
|
+
name: :string,
|
|
8
|
+
label: :string,
|
|
9
|
+
kind: :string,
|
|
10
|
+
options: [:ProductFilterOptionValue, multi: true]
|
|
11
|
+
|
|
12
|
+
attributes :id, :type, :name, :label, :kind
|
|
13
|
+
|
|
14
|
+
many :options, resource: proc { Spree.api.product_filter_option_value_serializer }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFilterOptionValueSerializer < BaseSerializer
|
|
5
|
+
typelize id: :string,
|
|
6
|
+
name: :string,
|
|
7
|
+
label: :string,
|
|
8
|
+
position: :number,
|
|
9
|
+
color_code: [:string, nullable: true],
|
|
10
|
+
image_url: [:string, nullable: true],
|
|
11
|
+
count: :number
|
|
12
|
+
|
|
13
|
+
attributes :id, :name, :label, :position, :color_code, :image_url, :count
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFilterPriceRangeSerializer < BaseSerializer
|
|
5
|
+
typelize id: :string,
|
|
6
|
+
type: "'price_range'",
|
|
7
|
+
min: :number,
|
|
8
|
+
max: :number,
|
|
9
|
+
currency: :string
|
|
10
|
+
|
|
11
|
+
attributes :id, :type, :min, :max, :currency
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
class ProductFiltersSerializer < BaseSerializer
|
|
5
|
+
typelize default_sort: :string,
|
|
6
|
+
total_count: :number,
|
|
7
|
+
filters: 'Array<ProductFilterPriceRange | ProductFilterAvailability | ProductFilterOption | ProductFilterCategory>',
|
|
8
|
+
sort_options: [:ProductFilterSortOption, { multi: true }]
|
|
9
|
+
|
|
10
|
+
attributes :default_sort, :total_count
|
|
11
|
+
|
|
12
|
+
attribute :filters do |result|
|
|
13
|
+
result.filters.filter_map do |filter|
|
|
14
|
+
filter_type = filter[:type]
|
|
15
|
+
serializer_class = case filter_type
|
|
16
|
+
when 'price_range'
|
|
17
|
+
Spree.api.product_filter_price_range_serializer
|
|
18
|
+
when 'availability'
|
|
19
|
+
Spree.api.product_filter_availability_serializer
|
|
20
|
+
when 'option'
|
|
21
|
+
Spree.api.product_filter_option_serializer
|
|
22
|
+
when 'category'
|
|
23
|
+
Spree.api.product_filter_category_serializer
|
|
24
|
+
else
|
|
25
|
+
raise ArgumentError, "Unknown filter type: #{filter_type.inspect}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
serializer_class.new(filter, params: params).serializable_hash
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
many :sort_options, resource: proc { Spree.api.product_filter_sort_option_serializer }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -136,6 +136,15 @@ module Spree
|
|
|
136
136
|
custom_field_serializer: 'Spree::Api::V3::CustomFieldSerializer',
|
|
137
137
|
shipping_category_serializer: 'Spree::Api::V3::ShippingCategorySerializer',
|
|
138
138
|
tax_category_serializer: 'Spree::Api::V3::TaxCategorySerializer',
|
|
139
|
+
product_filters_serializer: 'Spree::Api::V3::ProductFiltersSerializer',
|
|
140
|
+
product_filter_price_range_serializer: 'Spree::Api::V3::ProductFilterPriceRangeSerializer',
|
|
141
|
+
product_filter_availability_serializer: 'Spree::Api::V3::ProductFilterAvailabilitySerializer',
|
|
142
|
+
product_filter_availability_option_serializer: 'Spree::Api::V3::ProductFilterAvailabilityOptionSerializer',
|
|
143
|
+
product_filter_option_serializer: 'Spree::Api::V3::ProductFilterOptionSerializer',
|
|
144
|
+
product_filter_option_value_serializer: 'Spree::Api::V3::ProductFilterOptionValueSerializer',
|
|
145
|
+
product_filter_category_serializer: 'Spree::Api::V3::ProductFilterCategorySerializer',
|
|
146
|
+
product_filter_category_option_serializer: 'Spree::Api::V3::ProductFilterCategoryOptionSerializer',
|
|
147
|
+
product_filter_sort_option_serializer: 'Spree::Api::V3::ProductFilterSortOptionSerializer',
|
|
139
148
|
|
|
140
149
|
# v3 event serializers (for models without Store API endpoints yet)
|
|
141
150
|
asset_serializer: 'Spree::Api::V3::AssetSerializer',
|
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: 5.5.
|
|
4
|
+
version: 5.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vendo Connect Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rswag-specs
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - '='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 5.5.
|
|
75
|
+
version: 5.5.3
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - '='
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 5.5.
|
|
82
|
+
version: 5.5.3
|
|
83
83
|
description: Spree's API
|
|
84
84
|
email:
|
|
85
85
|
- hello@spreecommerce.org
|
|
@@ -305,6 +305,15 @@ files:
|
|
|
305
305
|
- app/serializers/spree/api/v3/policy_serializer.rb
|
|
306
306
|
- app/serializers/spree/api/v3/price_history_serializer.rb
|
|
307
307
|
- app/serializers/spree/api/v3/price_serializer.rb
|
|
308
|
+
- app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb
|
|
309
|
+
- app/serializers/spree/api/v3/product_filter_availability_serializer.rb
|
|
310
|
+
- app/serializers/spree/api/v3/product_filter_category_option_serializer.rb
|
|
311
|
+
- app/serializers/spree/api/v3/product_filter_category_serializer.rb
|
|
312
|
+
- app/serializers/spree/api/v3/product_filter_option_serializer.rb
|
|
313
|
+
- app/serializers/spree/api/v3/product_filter_option_value_serializer.rb
|
|
314
|
+
- app/serializers/spree/api/v3/product_filter_price_range_serializer.rb
|
|
315
|
+
- app/serializers/spree/api/v3/product_filter_sort_option_serializer.rb
|
|
316
|
+
- app/serializers/spree/api/v3/product_filters_serializer.rb
|
|
308
317
|
- app/serializers/spree/api/v3/product_publication_serializer.rb
|
|
309
318
|
- app/serializers/spree/api/v3/product_serializer.rb
|
|
310
319
|
- app/serializers/spree/api/v3/promotion_serializer.rb
|
|
@@ -355,9 +364,9 @@ licenses:
|
|
|
355
364
|
- BSD-3-Clause
|
|
356
365
|
metadata:
|
|
357
366
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
358
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v5.5.
|
|
367
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.5.3
|
|
359
368
|
documentation_uri: https://docs.spreecommerce.org/
|
|
360
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.5.
|
|
369
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.5.3
|
|
361
370
|
post_install_message:
|
|
362
371
|
rdoc_options: []
|
|
363
372
|
require_paths:
|