spree_legacy_api_v2 1.0.0 → 1.0.1
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/Rakefile +3 -0
- data/app/controllers/spree/api/v2/data_feeds/google_controller.rb +2 -6
- data/app/controllers/spree/api/v2/platform/taxons_controller.rb +2 -2
- data/app/controllers/spree/api/v2/storefront/post_categories_controller.rb +4 -0
- data/app/controllers/spree/api/v2/storefront/posts_controller.rb +19 -11
- data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +2 -3
- data/app/helpers/spree/api/v2/store_media_serializer_images_concern.rb +0 -4
- data/app/serializers/spree/api/v2/platform/taxon_serializer.rb +0 -6
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +0 -6
- data/lib/spree_legacy_api_v2/version.rb +1 -1
- data/lib/spree_legacy_api_v2.rb +2 -0
- metadata +33 -8
- data/app/serializers/concerns/spree/api/v2/taxon_image_transformation_concern.rb +0 -15
- data/app/serializers/spree/api/v2/platform/taxon_image_serializer.rb +0 -15
- data/app/serializers/spree/v2/storefront/taxon_image_serializer.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee03551dbe1d59824af91549821dac589ed2a1fa10e29cdb1f794ecb4b45097b
|
|
4
|
+
data.tar.gz: 80b90a3eb262ad9b882bc308d99bf24bd045f6e3c287e08a2a9e8611369ab774
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30d286f75e5f8a18e8d1df6a40640cb2bc96cfb5c019d88a07ccba1e78151ccbbc798298bc1dcbe2ec386590e1db7df00eb56534ed0a08b9d3adc35e37b063a2
|
|
7
|
+
data.tar.gz: d3b36d049f776dee02da6bbf9a132f159653fc5bb2daf00064725cfe549c7a3367560d8b77f1f015e3fb17d36ffcd88f60ef9332751f3a59a51861145bd8190a
|
data/Rakefile
CHANGED
|
@@ -20,4 +20,7 @@ desc 'Generates a dummy app for testing'
|
|
|
20
20
|
task :test_app do
|
|
21
21
|
ENV['LIB_NAME'] = 'spree_legacy_api_v2'
|
|
22
22
|
Rake::Task['extension:test_app'].invoke
|
|
23
|
+
|
|
24
|
+
system({ 'BUNDLE_GEMFILE' => File.expand_path('Gemfile', __dir__) }, 'rails g spree_posts:install')
|
|
25
|
+
system({ 'BUNDLE_GEMFILE' => File.expand_path('Gemfile', __dir__) }, 'rails g spree_legacy_product_properties:install')
|
|
23
26
|
end
|
|
@@ -4,7 +4,8 @@ module Spree
|
|
|
4
4
|
module DataFeeds
|
|
5
5
|
class GoogleController < ::Spree::Api::V2::BaseController
|
|
6
6
|
def rss_feed
|
|
7
|
-
|
|
7
|
+
presenter = settings.class.presenter_class.new(settings)
|
|
8
|
+
send_data presenter.call, filename: 'products.rss', type: 'text/xml'
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
private
|
|
@@ -12,13 +13,8 @@ module Spree
|
|
|
12
13
|
def settings
|
|
13
14
|
@settings ||= Spree::DataFeed::Google.find_by!(store: current_store, slug: params[:slug], active: true)
|
|
14
15
|
end
|
|
15
|
-
|
|
16
|
-
def data_feeds_google_rss_service
|
|
17
|
-
Spree.data_feeds_google_rss_service.new.call(settings)
|
|
18
|
-
end
|
|
19
16
|
end
|
|
20
17
|
end
|
|
21
18
|
end
|
|
22
19
|
end
|
|
23
20
|
end
|
|
24
|
-
|
|
@@ -31,13 +31,13 @@ module Spree
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def scope_includes
|
|
34
|
-
node_includes = %i[
|
|
34
|
+
node_includes = %i[parent taxonomy]
|
|
35
35
|
|
|
36
36
|
{
|
|
37
37
|
parent: node_includes,
|
|
38
38
|
children: node_includes,
|
|
39
39
|
taxonomy: [root: node_includes],
|
|
40
|
-
|
|
40
|
+
image_attachment: :blob
|
|
41
41
|
}
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -6,25 +6,33 @@ module Spree
|
|
|
6
6
|
protected
|
|
7
7
|
|
|
8
8
|
def sorted_collection
|
|
9
|
-
|
|
9
|
+
sorter = Spree.api.storefront_posts_sorter
|
|
10
|
+
if sorter
|
|
11
|
+
sorter.new(collection, params, allowed_sort_attributes).call
|
|
12
|
+
else
|
|
13
|
+
super
|
|
14
|
+
end
|
|
10
15
|
end
|
|
11
16
|
|
|
12
17
|
def collection
|
|
13
|
-
@collection ||=
|
|
18
|
+
@collection ||= begin
|
|
19
|
+
finder = Spree.api.storefront_posts_finder
|
|
20
|
+
if finder
|
|
21
|
+
finder.new(scope: scope, params: finder_params).execute
|
|
22
|
+
else
|
|
23
|
+
result = scope
|
|
24
|
+
result = result.search_by_title(params[:q]) if params[:q].present?
|
|
25
|
+
result = result.where(post_category_id: params.dig(:filter, :category_ids).split(',')) if params.dig(:filter, :category_ids).present?
|
|
26
|
+
result = result.tagged_with(params.dig(:filter, :tags).split(','), any: true) if params.dig(:filter, :tags).present?
|
|
27
|
+
result
|
|
28
|
+
end
|
|
29
|
+
end
|
|
14
30
|
end
|
|
15
31
|
|
|
16
32
|
def resource
|
|
17
33
|
@resource ||= find_with_fallback_default_locale { scope.friendly.find(params[:id]) } || scope.friendly.find(params[:id])
|
|
18
34
|
end
|
|
19
35
|
|
|
20
|
-
def collection_finder
|
|
21
|
-
Spree.api.storefront_posts_finder
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def collection_sorter
|
|
25
|
-
Spree.api.storefront_posts_sorter
|
|
26
|
-
end
|
|
27
|
-
|
|
28
36
|
def collection_serializer
|
|
29
37
|
Spree::V2::Storefront::PostSerializer
|
|
30
38
|
end
|
|
@@ -38,7 +46,7 @@ module Spree
|
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
def scope
|
|
41
|
-
|
|
49
|
+
model_class.for_store(current_store).published.includes(:post_category, image_attachment: :blob)
|
|
42
50
|
end
|
|
43
51
|
|
|
44
52
|
def allowed_sort_attributes
|
|
@@ -30,14 +30,13 @@ module Spree
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def scope_includes
|
|
33
|
-
node_includes = %i[
|
|
33
|
+
node_includes = %i[parent taxonomy]
|
|
34
34
|
|
|
35
35
|
{
|
|
36
36
|
parent: node_includes,
|
|
37
37
|
children: node_includes,
|
|
38
38
|
taxonomy: [root: node_includes],
|
|
39
|
-
|
|
40
|
-
translations: []
|
|
39
|
+
image_attachment: :blob
|
|
41
40
|
}
|
|
42
41
|
end
|
|
43
42
|
|
|
@@ -34,12 +34,6 @@ module Spree
|
|
|
34
34
|
has_many :products, record_type: :product,
|
|
35
35
|
serializer: Spree.api.platform_product_serializer,
|
|
36
36
|
if: proc { |_taxon, params| params && params[:include_products] == true }
|
|
37
|
-
|
|
38
|
-
has_one :image,
|
|
39
|
-
object_method_name: :icon,
|
|
40
|
-
id_method_name: :icon_id,
|
|
41
|
-
record_type: :taxon_image,
|
|
42
|
-
serializer: Spree.api.platform_taxon_image_serializer
|
|
43
37
|
end
|
|
44
38
|
end
|
|
45
39
|
end
|
|
@@ -43,12 +43,6 @@ module Spree
|
|
|
43
43
|
has_many :children, record_type: :taxon, serializer: Spree.api.storefront_taxon_serializer
|
|
44
44
|
has_many :products, record_type: :product, serializer: Spree.api.storefront_product_serializer,
|
|
45
45
|
if: proc { |_taxon, params| params && params[:include_products] == true }
|
|
46
|
-
|
|
47
|
-
has_one :image,
|
|
48
|
-
object_method_name: :icon,
|
|
49
|
-
id_method_name: :icon_id,
|
|
50
|
-
record_type: :taxon_image,
|
|
51
|
-
serializer: Spree.api.storefront_taxon_image_serializer
|
|
52
46
|
end
|
|
53
47
|
end
|
|
54
48
|
end
|
data/lib/spree_legacy_api_v2.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_legacy_api_v2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Bigg
|
|
@@ -87,14 +87,42 @@ dependencies:
|
|
|
87
87
|
requirements:
|
|
88
88
|
- - ">="
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 5.4.0.
|
|
90
|
+
version: 5.4.0.beta8
|
|
91
91
|
type: :runtime
|
|
92
92
|
prerelease: false
|
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
|
95
95
|
- - ">="
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 5.4.0.
|
|
97
|
+
version: 5.4.0.beta8
|
|
98
|
+
- !ruby/object:Gem::Dependency
|
|
99
|
+
name: spree_posts
|
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
type: :runtime
|
|
106
|
+
prerelease: false
|
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
- !ruby/object:Gem::Dependency
|
|
113
|
+
name: spree_legacy_product_properties
|
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: '0'
|
|
119
|
+
type: :runtime
|
|
120
|
+
prerelease: false
|
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: '0'
|
|
98
126
|
description: Legacy API v2 endpoints for Spree Commerce.
|
|
99
127
|
email:
|
|
100
128
|
- hello@spreecommerce.org
|
|
@@ -186,7 +214,6 @@ files:
|
|
|
186
214
|
- app/serializers/concerns/spree/api/v2/image_transformation_concern.rb
|
|
187
215
|
- app/serializers/concerns/spree/api/v2/public_metafields_concern.rb
|
|
188
216
|
- app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb
|
|
189
|
-
- app/serializers/concerns/spree/api/v2/taxon_image_transformation_concern.rb
|
|
190
217
|
- app/serializers/spree/api/v2/base_serializer.rb
|
|
191
218
|
- app/serializers/spree/api/v2/platform/address_serializer.rb
|
|
192
219
|
- app/serializers/spree/api/v2/platform/adjustment_serializer.rb
|
|
@@ -251,7 +278,6 @@ files:
|
|
|
251
278
|
- app/serializers/spree/api/v2/platform/store_serializer.rb
|
|
252
279
|
- app/serializers/spree/api/v2/platform/tax_category_serializer.rb
|
|
253
280
|
- app/serializers/spree/api/v2/platform/tax_rate_serializer.rb
|
|
254
|
-
- app/serializers/spree/api/v2/platform/taxon_image_serializer.rb
|
|
255
281
|
- app/serializers/spree/api/v2/platform/taxon_serializer.rb
|
|
256
282
|
- app/serializers/spree/api/v2/platform/taxonomy_serializer.rb
|
|
257
283
|
- app/serializers/spree/api/v2/platform/user_serializer.rb
|
|
@@ -294,7 +320,6 @@ files:
|
|
|
294
320
|
- app/serializers/spree/v2/storefront/store_credit_serializer.rb
|
|
295
321
|
- app/serializers/spree/v2/storefront/store_credit_type_serializer.rb
|
|
296
322
|
- app/serializers/spree/v2/storefront/store_serializer.rb
|
|
297
|
-
- app/serializers/spree/v2/storefront/taxon_image_serializer.rb
|
|
298
323
|
- app/serializers/spree/v2/storefront/taxon_serializer.rb
|
|
299
324
|
- app/serializers/spree/v2/storefront/taxonomy_serializer.rb
|
|
300
325
|
- app/serializers/spree/v2/storefront/user_serializer.rb
|
|
@@ -336,9 +361,9 @@ licenses:
|
|
|
336
361
|
- BSD-3-Clause
|
|
337
362
|
metadata:
|
|
338
363
|
bug_tracker_uri: https://github.com/spree/spree_legacy_api_v2/issues
|
|
339
|
-
changelog_uri: https://github.com/spree/spree_legacy_api_v2/releases/tag/v1.0.
|
|
364
|
+
changelog_uri: https://github.com/spree/spree_legacy_api_v2/releases/tag/v1.0.1
|
|
340
365
|
documentation_uri: https://docs.spreecommerce.org/
|
|
341
|
-
source_code_uri: https://github.com/spree/spree_legacy_api_v2/tree/v1.0.
|
|
366
|
+
source_code_uri: https://github.com/spree/spree_legacy_api_v2/tree/v1.0.1
|
|
342
367
|
rdoc_options: []
|
|
343
368
|
require_paths:
|
|
344
369
|
- lib
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Api
|
|
3
|
-
module V2
|
|
4
|
-
module TaxonImageTransformationConcern
|
|
5
|
-
extend ActiveSupport::Concern
|
|
6
|
-
|
|
7
|
-
def self.included(base)
|
|
8
|
-
base.attribute :transformed_url do |image, params|
|
|
9
|
-
image.generate_url(size: params.dig(:taxon_image_transformation, :size))
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Api
|
|
3
|
-
module V2
|
|
4
|
-
module Platform
|
|
5
|
-
class TaxonImageSerializer < BaseSerializer
|
|
6
|
-
include ::Spree::Api::V2::TaxonImageTransformationConcern
|
|
7
|
-
|
|
8
|
-
set_type :taxon_image
|
|
9
|
-
|
|
10
|
-
attributes :alt, :created_at, :updated_at, :original_url
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|