spree_skroutz 1.0.0 → 1.1.0
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/LICENSE.md +11 -17
- data/README.md +25 -49
- data/app/assets/config/spree_skroutz_manifest.js +2 -0
- data/app/assets/images/integration_icons/skroutz-logo.webp +0 -0
- data/app/controllers/spree/skroutz_controller.rb +14 -2
- data/app/models/spree/integrations/skroutz.rb +13 -0
- data/app/views/spree/admin/integrations/forms/_skroutz.html.erb +9 -0
- data/app/views/{spree/skroutz → spree_skroutz}/products.xml.builder +22 -13
- data/config/initializers/spree.rb +3 -0
- data/config/locales/el.yml +8 -0
- data/config/locales/en.yml +8 -0
- data/lib/spree_skroutz/engine.rb +8 -0
- data/lib/spree_skroutz/factories.rb +4 -4
- data/lib/spree_skroutz/version.rb +1 -1
- metadata +19 -14
- data/lib/generators/spree_skroutz/install/install_generator.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d5e2d656f9e150399440ecd6f8b4e16fd17243567496fbf34d9b9fa2b10cd57
|
|
4
|
+
data.tar.gz: ed0e2e6f0bac43ce156342a4ed8f411575963f3f241e474f151fef1349c6802f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98ab27ccc682d9c6004501e51adf0b10746346503412a4e6c62cba1ac8fbb5764814123710db37214c73467e67ff1bd859bcdef0716405b8e03a676058ba9525
|
|
7
|
+
data.tar.gz: 50a8e3a8289a0e7218d55b93591406028ccc3f5155143397b3f2aa02fa5805782e295fb2f18272ed0e2d72b88cd273889979873f5ba217100f8a2454825bd9a6
|
data/LICENSE.md
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LICENSE
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 OlympusOne
|
|
3
|
+
Copyright (c) 2025 OlympusOne. All rights reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the
|
|
6
|
+
GNU Affero General Public License as published by the Free Software Foundation, either
|
|
7
|
+
version 3 of the License, or any later version.
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
|
data/README.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
# SpreeSkroutz
|
|
2
2
|
|
|
3
|
-
This is a Skroutz extension for [Spree Commerce](https://spreecommerce.org), an open
|
|
3
|
+
This is a Skroutz extension for [Spree Commerce](https://spreecommerce.org), an open‑source e-commerce platform built with Ruby on Rails. It adds the ability to provide products listings to Skroutz Martketplace.
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/rb/spree_skroutz)
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
1. Add this extension to your Gemfile
|
|
9
|
+
1. Add this extension to your Gemfile:
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```bash
|
|
12
12
|
bundle add spree_skroutz
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
2.
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
bundle exec rake railties:install:migrations FROM=spree_skroutz
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
3. Run the migrations:
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
bundle exec rails db:migrate
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
4. Restart your server
|
|
28
|
-
|
|
29
|
-
If your server was running, restart it so that it can find the assets properly.
|
|
15
|
+
2. Restart your server.
|
|
30
16
|
|
|
31
17
|
## Developing
|
|
32
18
|
|
|
33
|
-
1. Create a dummy app
|
|
19
|
+
1. Create a dummy app:
|
|
34
20
|
|
|
35
21
|
```bash
|
|
36
22
|
bundle update
|
|
37
23
|
bundle exec rake test_app
|
|
38
24
|
```
|
|
39
25
|
|
|
40
|
-
2. Add
|
|
41
|
-
|
|
26
|
+
2. Add code.
|
|
27
|
+
|
|
28
|
+
3. Run tests:
|
|
42
29
|
|
|
43
30
|
```bash
|
|
44
31
|
bundle exec rspec
|
|
45
32
|
```
|
|
46
33
|
|
|
47
|
-
When testing your
|
|
48
|
-
Simply add this require statement to your spec_helper:
|
|
34
|
+
When testing your application's integration you may use its factories:
|
|
49
35
|
|
|
50
36
|
```ruby
|
|
51
37
|
require 'spree_skroutz/factories'
|
|
52
38
|
```
|
|
53
39
|
|
|
40
|
+
## Testing
|
|
41
|
+
|
|
42
|
+
Generate the test app:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bundle exec rake test_app
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bundle exec rspec
|
|
52
|
+
```
|
|
53
|
+
|
|
54
54
|
## Releasing a new version
|
|
55
55
|
|
|
56
|
-
```
|
|
56
|
+
```bash
|
|
57
57
|
bundle exec gem bump -p -t
|
|
58
58
|
bundle exec gem release
|
|
59
59
|
```
|
|
@@ -66,28 +66,4 @@ If you'd like to contribute, please take a look at the
|
|
|
66
66
|
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
|
67
67
|
pull request.
|
|
68
68
|
|
|
69
|
-
Copyright (c) 2025 OlympusOne, released under the
|
|
70
|
-
|
|
71
|
-
## Skroutz Center Integration
|
|
72
|
-
|
|
73
|
-
To use your Skroutz endpoint as a data source in Skroutz Center:
|
|
74
|
-
|
|
75
|
-
1. **Deploy your endpoint**
|
|
76
|
-
Ensure your authentication and data endpoints are publicly accessible and return the required data format (e.g., XML, CSV, or JSON).
|
|
77
|
-
For this extension, your endpoint will typically be:
|
|
78
|
-
`https://yoursite.com/skroutz/products.xml`
|
|
79
|
-
|
|
80
|
-
2. **Copy your endpoint URL**
|
|
81
|
-
This is the URL that Skroutz Center will fetch data from.
|
|
82
|
-
|
|
83
|
-
3. **Add as a data feed in Skroutz Center**
|
|
84
|
-
- Go to [Skroutz Merchants](https://merchants.skroutz.gr/).
|
|
85
|
-
- In the header, click **Settings & tools**.
|
|
86
|
-
- Select **Data sources**.
|
|
87
|
-
- Click **Add product source**.
|
|
88
|
-
- Choose **Add products from a file**.
|
|
89
|
-
- Enter your endpoint URL (e.g., `https://yoursite.com/skroutz/products.xml`) as the feed source.
|
|
90
|
-
- Set fetch frequency and credentials if authentication is required.
|
|
91
|
-
|
|
92
|
-
4. **Test and verify**
|
|
93
|
-
After saving, Google will attempt to fetch your data. Check for errors and ensure your feed is processed correctly.
|
|
69
|
+
Copyright (c) 2025 OlympusOne, released under the AGPL-3.0 or later.
|
|
Binary file
|
|
@@ -3,14 +3,26 @@ module Spree
|
|
|
3
3
|
include BaseHelper
|
|
4
4
|
include StorefrontHelper
|
|
5
5
|
|
|
6
|
+
before_action :ensure_feed_enabled
|
|
7
|
+
|
|
6
8
|
def products
|
|
7
9
|
respond_to do |format|
|
|
8
|
-
format.xml
|
|
10
|
+
format.xml do
|
|
11
|
+
render template: 'spree_skroutz/products', formats: [:xml]
|
|
12
|
+
end
|
|
9
13
|
format.gzip do
|
|
10
|
-
gz_xml = ActiveSupport::Gzip.compress(render_to_string(template: '
|
|
14
|
+
gz_xml = ActiveSupport::Gzip.compress(render_to_string(template: 'spree_skroutz/products', formats: [:xml]))
|
|
11
15
|
send_data(gz_xml, filename: 'products.xml.gz', type: 'application/x-gzip', disposition: 'inline')
|
|
12
16
|
end
|
|
13
17
|
end
|
|
14
18
|
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def ensure_feed_enabled
|
|
23
|
+
unless store_integration('skroutz').present?
|
|
24
|
+
render plain: 'Skroutz extension is not enabled for this store.', status: :not_found
|
|
25
|
+
end
|
|
26
|
+
end
|
|
15
27
|
end
|
|
16
28
|
end
|
|
@@ -8,32 +8,33 @@ xml.mywebstore do
|
|
|
8
8
|
storefront_products_scope.find_each do |product|
|
|
9
9
|
xml.product do
|
|
10
10
|
xml.tag! "id", product.id
|
|
11
|
+
|
|
11
12
|
xml.tag! "name" do
|
|
12
13
|
xml.cdata! product.name
|
|
13
14
|
end
|
|
14
15
|
|
|
15
|
-
if product.storefront_description.present?
|
|
16
|
-
xml.tag! "description", product.storefront_description&.truncate(10000)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
16
|
xml.tag! "link" do
|
|
20
17
|
xml.cdata! spree_storefront_resource_url(product)
|
|
21
18
|
end
|
|
22
19
|
|
|
23
|
-
if product.
|
|
20
|
+
if product.featured_image.present?
|
|
24
21
|
xml.tag! "image" do
|
|
25
|
-
xml.cdata! spree_image_url(product.
|
|
22
|
+
xml.cdata! spree_image_url(product.featured_image, width: 500, height: 500)
|
|
26
23
|
end
|
|
27
24
|
end
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
product.master_images.each do |image|
|
|
27
|
+
next if product.featured_image == image
|
|
28
|
+
|
|
29
29
|
xml.tag! "additionalimage" do
|
|
30
|
-
xml.cdata! spree_image_url(
|
|
30
|
+
xml.cdata! spree_image_url(image, width: 500, height: 500)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
xml.tag! "category" do
|
|
35
35
|
xml.cdata! product_breadcrumb_taxons(product).map(&:name).join(' > ')
|
|
36
36
|
end
|
|
37
|
+
|
|
37
38
|
xml.tag! "price_with_vat", format('%.2f', product.display_amount.to_d)
|
|
38
39
|
|
|
39
40
|
if product.tax_category.present?
|
|
@@ -43,6 +44,8 @@ xml.mywebstore do
|
|
|
43
44
|
xml.tag! "vat", 0
|
|
44
45
|
end
|
|
45
46
|
|
|
47
|
+
xml.tag! "availability", product.in_stock? ? "In stock" : "Out of stock"
|
|
48
|
+
|
|
46
49
|
if product.brand.present?
|
|
47
50
|
xml.tag! "manufacturer" do
|
|
48
51
|
xml.cdata! product.brand.name
|
|
@@ -50,7 +53,12 @@ xml.mywebstore do
|
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
xml.tag! "ean", product.barcode if product.barcode.present?
|
|
53
|
-
|
|
56
|
+
|
|
57
|
+
size = product.option_values.select{|ov| ov.option_type.name.downcase == 'size' }
|
|
58
|
+
.map(&:presentation)
|
|
59
|
+
.uniq
|
|
60
|
+
xml.tag! "size", size.join(',') if size.any?
|
|
61
|
+
|
|
54
62
|
xml.tag! "weight", "#{product.weight} #{product.weight_unit}" if product.weight.present?
|
|
55
63
|
|
|
56
64
|
colors = product.option_values.select{|ov| ov.option_type.name.downcase == 'color' }
|
|
@@ -58,10 +66,11 @@ xml.mywebstore do
|
|
|
58
66
|
.uniq
|
|
59
67
|
xml.tag! "color", colors.join(',') if colors.any?
|
|
60
68
|
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
if product.storefront_description.present?
|
|
70
|
+
xml.tag! "description" do
|
|
71
|
+
xml.cdata! product.storefront_description&.truncate(10000)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
65
74
|
|
|
66
75
|
xml.tag! "quantity", product.total_on_hand
|
|
67
76
|
|
data/lib/spree_skroutz/engine.rb
CHANGED
|
@@ -13,6 +13,14 @@ module SpreeSkroutz
|
|
|
13
13
|
SpreeSkroutz::Config = SpreeSkroutz::Configuration.new
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
initializer 'spree_skroutz.assets' do |app|
|
|
17
|
+
app.config.assets.precompile += %w[spree_skroutz_manifest]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
initializer 'spree_skroutz.importmap', after: 'spree.admin.importmap' do |app|
|
|
21
|
+
app.config.spree_admin.importmap.draw(root.join('config/importmap.rb'))
|
|
22
|
+
end
|
|
23
|
+
|
|
16
24
|
def self.activate
|
|
17
25
|
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
18
26
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
FactoryBot.define do
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
factory :skroutz_integration, class: Spree::Integrations::Skroutz do
|
|
3
|
+
active { true }
|
|
4
|
+
store { Spree::Store.default }
|
|
5
|
+
end
|
|
6
6
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_skroutz
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OlympusOne
|
|
@@ -15,42 +15,42 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 5.
|
|
18
|
+
version: 5.1.8
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 5.
|
|
25
|
+
version: 5.1.8
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: spree_storefront
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 5.
|
|
32
|
+
version: 5.1.8
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 5.
|
|
39
|
+
version: 5.1.8
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: spree_admin
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 5.
|
|
46
|
+
version: 5.1.8
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 5.
|
|
53
|
+
version: 5.1.8
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: spree_extension
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -79,8 +79,7 @@ dependencies:
|
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
|
-
description: Adds the ability to provide products
|
|
83
|
-
Spree Commerce.
|
|
82
|
+
description: Adds the ability to provide products listings to Skroutz Marketplace.
|
|
84
83
|
email: info@olympusone.com
|
|
85
84
|
executables: []
|
|
86
85
|
extensions: []
|
|
@@ -89,10 +88,16 @@ files:
|
|
|
89
88
|
- LICENSE.md
|
|
90
89
|
- README.md
|
|
91
90
|
- Rakefile
|
|
91
|
+
- app/assets/config/spree_skroutz_manifest.js
|
|
92
|
+
- app/assets/images/integration_icons/skroutz-logo.webp
|
|
92
93
|
- app/controllers/spree/skroutz_controller.rb
|
|
93
|
-
- app/
|
|
94
|
+
- app/models/spree/integrations/skroutz.rb
|
|
95
|
+
- app/views/spree/admin/integrations/forms/_skroutz.html.erb
|
|
96
|
+
- app/views/spree_skroutz/products.xml.builder
|
|
97
|
+
- config/initializers/spree.rb
|
|
98
|
+
- config/locales/el.yml
|
|
99
|
+
- config/locales/en.yml
|
|
94
100
|
- config/routes.rb
|
|
95
|
-
- lib/generators/spree_skroutz/install/install_generator.rb
|
|
96
101
|
- lib/spree_skroutz.rb
|
|
97
102
|
- lib/spree_skroutz/configuration.rb
|
|
98
103
|
- lib/spree_skroutz/engine.rb
|
|
@@ -100,13 +105,13 @@ files:
|
|
|
100
105
|
- lib/spree_skroutz/version.rb
|
|
101
106
|
homepage: https://github.com/olympusone/spree_skroutz
|
|
102
107
|
licenses:
|
|
103
|
-
-
|
|
108
|
+
- AGPL-3.0-or-later
|
|
104
109
|
metadata:
|
|
105
110
|
bug_tracker_uri: https://github.com/olympusone/spree_skroutz/issues
|
|
106
|
-
changelog_uri: https://github.com/olympusone/spree_skroutz/releases/tag/v1.
|
|
111
|
+
changelog_uri: https://github.com/olympusone/spree_skroutz/releases/tag/v1.1.0
|
|
107
112
|
documentation_uri: https://github.com/olympusone/spree_skroutz
|
|
108
113
|
homepage_uri: https://github.com/olympusone/spree_skroutz
|
|
109
|
-
source_code_uri: https://github.com/olympusone/spree_skroutz/tree/v1.
|
|
114
|
+
source_code_uri: https://github.com/olympusone/spree_skroutz/tree/v1.1.0
|
|
110
115
|
rdoc_options: []
|
|
111
116
|
require_paths:
|
|
112
117
|
- lib
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module SpreeSkroutz
|
|
2
|
-
module Generators
|
|
3
|
-
class InstallGenerator < Rails::Generators::Base
|
|
4
|
-
class_option :migrate, type: :boolean, default: true
|
|
5
|
-
|
|
6
|
-
def add_migrations
|
|
7
|
-
run 'bundle exec rake railties:install:migrations FROM=spree_skroutz'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def run_migrations
|
|
11
|
-
run_migrations = options[:migrate] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
|
|
12
|
-
if run_migrations
|
|
13
|
-
run 'bin/rails db:migrate'
|
|
14
|
-
else
|
|
15
|
-
puts 'Skipping rails db:migrate, don\'t forget to run it!'
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|