spree_skroutz 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8399789b8170126986e56193fca96b76eb74ac84fa6f933613dc9eee312256f8
4
- data.tar.gz: f7913d009f8cb44b9fea3196a8e75dd1d3a9e8b57723597ee125d8b2cc80edf1
3
+ metadata.gz: 5394f1db7c5d89f7ec1dd5607d30e0248c0df759f2445a773e37904568e6ac36
4
+ data.tar.gz: 4d4abdf6d863abae7ad7a7d0136b6d0ed3e2746d31074ccafe7f0d2cf9e7b354
5
5
  SHA512:
6
- metadata.gz: 2a4a67024fc640b44afa7a003d16b531b06d7010c9311dd9c7fa9db51b3aa37c2452e8fe22c3e3f0cedf9e8550bb34ee7be23a6254644fa99b2a5b87f0f3dfac
7
- data.tar.gz: fc2e3cae6270e353901903848e6387c5a1902eb711560e396fcf3080b0a8fb1eae09cce8baa229ae69ce254917db6b0bed6d6d713e162d762e03983048304ccb
6
+ metadata.gz: fdda074e62c392f2c7825404d1da9a5bfa350069083bbf78d99cad7e9682fa157b90c8ac5521ec9fea01202b100fcb52b331a64e571a94ab339a99951351c727
7
+ data.tar.gz: e5fbaa92f72de6b865e7bc3dcd08af094c3664cb474739f62065898afb7cb2a327992515d6b6856f5b44eda92cfb90e2e08d351b4e4e613f6343c5cf262ad5f8
data/LICENSE.md CHANGED
@@ -1,21 +1,15 @@
1
- # MIT License
1
+ # LICENSE
2
2
 
3
- Copyright (c) 2025 OlympusOne
3
+ Copyright (c) 2025 OlympusOne. All rights reserved.
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
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
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
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
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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,6 +1,6 @@
1
- # SpreeSkroutz
1
+ # Spree Skroutz
2
2
 
3
- This is a Skroutz extension for [Spree Commerce](https://spreecommerce.org), an open source e-commerce platform built with Ruby on Rails. Adds the ability to provide products listings to Skroutz Marketplace for Spree Commerce.
3
+ This is a Skroutz extension for [Spree Commerce](https://spreecommerce.org), an opensource e-commerce platform built with Ruby on Rails. It adds the ability to provide products listings to Skroutz Martketplace.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/spree_skroutz.svg)](https://badge.fury.io/rb/spree_skroutz)
6
6
 
@@ -8,25 +8,31 @@ This is a Skroutz extension for [Spree Commerce](https://spreecommerce.org), an
8
8
 
9
9
  1. Add this extension to your Gemfile with this line:
10
10
 
11
- ```ruby
11
+ ```bash
12
12
  bundle add spree_skroutz
13
13
  ```
14
14
 
15
- 2. Install the migrations:
15
+ 2. Restart your server
16
16
 
17
- ```sh
18
- bundle exec rake railties:install:migrations FROM=spree_skroutz
19
- ```
17
+ ## Usage
20
18
 
21
- 3. Run the migrations:
19
+ To use your Skroutz endpoint as a data source in Skroutz Merchants:
22
20
 
23
- ```sh
24
- bundle exec rails db:migrate
25
- ```
21
+ 1. **Deploy your endpoint**
22
+ Ensure your authentication and data endpoints are publicly accessible and return the required data format (e.g., XML, CSV, or JSON).
23
+ For this extension, your endpoint will typically be:
24
+ `https://yoursite.com/skroutz/products.xml`
26
25
 
27
- 4. Restart your server
26
+ 2. **Copy your endpoint URL**
27
+ This is the URL that Skroutz Merchants will fetch data from.
28
28
 
29
- If your server was running, restart it so that it can find the assets properly.
29
+ 3. **Add as a data feed in Skroutz Merchants**
30
+ - Go to [Skroutz Merchants](https://merchants.skroutz.gr/).
31
+ - In the header, click **Settings & tools**.
32
+ - Select **Data sources**.
33
+ - Click **Add product source**.
34
+ - Enter your endpoint URL (e.g., `https://yoursite.com/skroutz/products.xml`) as the feed source.
35
+ - Set fetch frequency and credentials if authentication is required.
30
36
 
31
37
  ## Developing
32
38
 
@@ -38,6 +44,7 @@ This is a Skroutz extension for [Spree Commerce](https://spreecommerce.org), an
38
44
  ```
39
45
 
40
46
  2. Add your new code
47
+
41
48
  3. Run tests
42
49
 
43
50
  ```bash
@@ -53,7 +60,7 @@ require 'spree_skroutz/factories'
53
60
 
54
61
  ## Releasing a new version
55
62
 
56
- ```shell
63
+ ```bash
57
64
  bundle exec gem bump -p -t
58
65
  bundle exec gem release
59
66
  ```
@@ -66,28 +73,4 @@ If you'd like to contribute, please take a look at the
66
73
  [instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
67
74
  pull request.
68
75
 
69
- Copyright (c) 2025 OlympusOne, released under the MIT
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.
76
+ Copyright (c) 2025 OlympusOne, released under the AGPL-3.0 or later.
@@ -0,0 +1 @@
1
+ //= link_tree ../images
@@ -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: 'spree/skroutz/products', formats: [:xml]))
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
@@ -0,0 +1,13 @@
1
+ module Spree
2
+ module Integrations
3
+ class Skroutz < Spree::Integration
4
+ def self.integration_group
5
+ 'marketing'
6
+ end
7
+
8
+ def self.icon_path
9
+ 'integration_icons/skroutz-logo.webp'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ <div class="col-12 col-md-6 p-0">
2
+ <div class="card mb-4">
3
+ <div class="card-body">
4
+ <p>
5
+ <%= Spree.t('admin.integrations.skroutz.description') %>
6
+ </p>
7
+ </div>
8
+ </div>
9
+ </div>
@@ -8,33 +8,34 @@ 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.default_image.present?
20
+ if product.featured_image.present?
24
21
  xml.tag! "image" do
25
- xml.cdata! spree_image_url(product.default_image, width: 500, height: 500)
22
+ xml.cdata! spree_image_url(product.featured_image, width: 500, height: 500)
26
23
  end
27
24
  end
28
- if product.secondary_image.present?
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(product.secondary_image, width: 500, height: 500)
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
- xml.tag! "price_with_vat", format('%.2f', product.display_amount.to_d)
37
+
38
+ xml.tag! "price_with_vat", format('%.2f', product.display_price.to_d)
38
39
 
39
40
  if product.tax_category.present?
40
41
  tax_rate = product.tax_category.tax_rates.first
@@ -43,14 +44,21 @@ xml.mywebstore do
43
44
  xml.tag! "vat", 0
44
45
  end
45
46
 
46
- if product.brand.present?
47
+ xml.tag! "availability", product.in_stock? ? "In stock" : "Out of stock"
48
+
49
+ if product.brand_taxon.present?
47
50
  xml.tag! "manufacturer" do
48
- xml.cdata! product.brand.name
51
+ xml.cdata! product.brand_taxon.name
49
52
  end
50
53
  end
51
54
 
52
55
  xml.tag! "ean", product.barcode if product.barcode.present?
53
- xml.tag! "availability", product.in_stock? ? "In stock" : "Out of stock"
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
- size = product.option_values.select{|ov| ov.option_type.name.downcase == 'size' }
62
- .map(&:presentation)
63
- .uniq
64
- xml.tag! "size", size.join(',') if size.any?
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
 
@@ -72,7 +81,7 @@ xml.mywebstore do
72
81
  xml.tag! "variationid", variant.id
73
82
  xml.tag! "availability", variant.in_stock? ? "In stock" : "Out of stock"
74
83
  xml.tag! "ean", variant.barcode if variant.barcode.present?
75
- xml.tag! "price_with_vat", format('%.2f', variant.display_amount.to_d)
84
+ xml.tag! "price_with_vat", format('%.2f', variant.display_price.to_d)
76
85
 
77
86
  size = variant.option_values.select{|ov| ov.option_type.name.downcase == 'size' }
78
87
  .map(&:presentation)
@@ -0,0 +1,3 @@
1
+ Rails.application.config.after_initialize do
2
+ Spree.integrations << Spree::Integrations::Skroutz
3
+ end
@@ -0,0 +1,8 @@
1
+ ---
2
+ el:
3
+ spree:
4
+ admin:
5
+ integrations:
6
+ skroutz:
7
+ title: Skroutz
8
+ description: Το Skroutz είναι εργαλείο για καταχωρίσεις προϊόντων στο Skroutz Merchants
@@ -0,0 +1,8 @@
1
+ ---
2
+ en:
3
+ spree:
4
+ admin:
5
+ integrations:
6
+ skroutz:
7
+ title: Skroutz
8
+ description: Skroutz is a channel integration for product listings on Skroutz Merchants
@@ -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', before: 'importmap' do |app|
21
+ app.config.importmap.paths << 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
- # Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
3
- #
4
- # Example adding this to your spec_helper will load these Factories for use:
5
- # require 'spree_skroutz/factories'
2
+ factory :skroutz_integration, class: Spree::Integrations::Skroutz do
3
+ active { true }
4
+ store { Spree::Store.default }
5
+ end
6
6
  end
@@ -1,5 +1,5 @@
1
1
  module SpreeSkroutz
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
 
4
4
  def gem_version
5
5
  Gem::Version.new(VERSION)
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.0.0
4
+ version: 1.1.1
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.0.4
18
+ version: 5.2.0
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.0.4
25
+ version: 5.2.0
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.0.4
32
+ version: 5.2.0
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.0.4
39
+ version: 5.2.0
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.0.4
46
+ version: 5.2.0
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.0.4
53
+ version: 5.2.0
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 feed to Skroutz Marketplace for
83
- Spree Commerce.
82
+ description: Adds the ability to provide products listings to Skroutz Merchants.
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/views/spree/skroutz/products.xml.builder
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
- - MIT
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.0.0
111
+ changelog_uri: https://github.com/olympusone/spree_skroutz/releases/tag/v1.1.1
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.0.0
114
+ source_code_uri: https://github.com/olympusone/spree_skroutz/tree/v1.1.1
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