spree_google_merchant_feed 1.0.3 → 1.1.2
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 +44 -44
- data/app/assets/config/spree_google_merchant_feed_manifest.js +2 -0
- data/app/assets/images/integration_icons/google-merchant-center-logo.png +0 -0
- data/app/controllers/spree/google_merchant_feed_controller.rb +28 -0
- data/app/models/spree/integrations/google_merchant_feed.rb +13 -0
- data/app/views/spree/admin/integrations/forms/_google_merchant_feed.html.erb +9 -0
- data/app/views/{spree/google_merchant → spree_google_merchant_feed}/products.xml.builder +1 -1
- data/config/initializers/spree.rb +3 -0
- data/config/locales/el.yml +8 -0
- data/config/locales/en.yml +8 -0
- data/config/routes.rb +2 -2
- data/lib/spree_google_merchant_feed/engine.rb +8 -0
- data/lib/spree_google_merchant_feed/factories.rb +4 -4
- data/lib/spree_google_merchant_feed/version.rb +1 -1
- metadata +20 -15
- data/app/controllers/spree/google_merchant_controller.rb +0 -16
- data/lib/generators/spree_google_merchant/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: 73bd1e391cd46c9881a481dec0598576a49ffe623ff6ad827b5286d1d0408b1b
|
|
4
|
+
data.tar.gz: 41e80986993067fa780d64529935f3ec18ad82042a436aa68eabcf2c91d2aa8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c27f241cd94a99b23cf84f003ebb2a62953d8a283a6996d6688bf2f90725b9dcea0d6c5dd64f9b4a92c20cdddbd9f4c3b5165b53656b1209904a48c16e9b6c1
|
|
7
|
+
data.tar.gz: 90be81863d28167c8ff7ac7fd07cbe01c963d39f34359abf82f87fdf14ac21e433d02d96834ee5c691f7c1ee22ec947efc5007256e64d811354d458feabf0326
|
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,83 @@
|
|
|
1
1
|
# SpreeGoogleMerchantFeed
|
|
2
2
|
|
|
3
|
-
This is a Google Merchant extension for [Spree Commerce](https://spreecommerce.org), an open
|
|
3
|
+
This is a Google Merchant 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 Google Merchant Center.
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/rb/spree_google_merchant_feed)
|
|
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_google_merchant_feed
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
2.
|
|
15
|
+
2. Restart your server.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
bundle exec rake railties:install:migrations FROM=spree_google_merchant_feed
|
|
19
|
-
```
|
|
17
|
+
## Usage
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
To use your Google Merchant endpoint as a data source in Google Merchant Center:
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
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/google_merchant/products.xml`
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
2. **Copy your endpoint URL**
|
|
27
|
+
This is the URL that Google Merchant Center will fetch data from.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
3. **Add as a data feed in Google Merchant Center**
|
|
30
|
+
- Go to [Google Merchant Center](https://merchants.google.com/).
|
|
31
|
+
- In the header, click **Settings & tools**.
|
|
32
|
+
- Select **Data sources**.
|
|
33
|
+
- Click **Add product source**.
|
|
34
|
+
- Choose **Add products from a file**.
|
|
35
|
+
- Enter your endpoint URL (e.g., `https://yoursite.com/google_merchant/products.xml`) as the feed source.
|
|
36
|
+
- Set fetch frequency and credentials if authentication is required.
|
|
37
|
+
|
|
38
|
+
4. **Test and verify**
|
|
39
|
+
After saving, Google will attempt to fetch your data. Check for errors and ensure your feed is processed correctly.
|
|
30
40
|
|
|
31
41
|
## Developing
|
|
32
42
|
|
|
33
|
-
1. Create a dummy app
|
|
43
|
+
1. Create a dummy app:
|
|
34
44
|
|
|
35
45
|
```bash
|
|
36
46
|
bundle update
|
|
37
47
|
bundle exec rake test_app
|
|
38
48
|
```
|
|
39
49
|
|
|
40
|
-
2. Add
|
|
41
|
-
|
|
50
|
+
2. Add code.
|
|
51
|
+
|
|
52
|
+
3. Run tests:
|
|
42
53
|
|
|
43
54
|
```bash
|
|
44
55
|
bundle exec rspec
|
|
45
56
|
```
|
|
46
57
|
|
|
47
|
-
When testing your
|
|
48
|
-
Simply add this require statement to your spec_helper:
|
|
58
|
+
When testing your application's integration you may use its factories:
|
|
49
59
|
|
|
50
60
|
```ruby
|
|
51
61
|
require 'spree_google_merchant_feed/factories'
|
|
52
62
|
```
|
|
53
63
|
|
|
64
|
+
## Testing
|
|
65
|
+
|
|
66
|
+
Generate the test app:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bundle exec rake test_app
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Then run:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bundle exec rspec
|
|
76
|
+
```
|
|
77
|
+
|
|
54
78
|
## Releasing a new version
|
|
55
79
|
|
|
56
|
-
```
|
|
80
|
+
```bash
|
|
57
81
|
bundle exec gem bump -p -t
|
|
58
82
|
bundle exec gem release
|
|
59
83
|
```
|
|
@@ -66,28 +90,4 @@ If you'd like to contribute, please take a look at the
|
|
|
66
90
|
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
|
67
91
|
pull request.
|
|
68
92
|
|
|
69
|
-
Copyright (c) 2025 OlympusOne, released under the
|
|
70
|
-
|
|
71
|
-
## Google Merchant Center Integration
|
|
72
|
-
|
|
73
|
-
To use your Google Merchant endpoint as a data source in Google Merchant 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/google_merchant/products.xml`
|
|
79
|
-
|
|
80
|
-
2. **Copy your endpoint URL**
|
|
81
|
-
This is the URL that Google Merchant Center will fetch data from.
|
|
82
|
-
|
|
83
|
-
3. **Add as a data feed in Google Merchant Center**
|
|
84
|
-
- Go to [Google Merchant Center](https://merchants.google.com/).
|
|
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/google_merchant/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.
|
|
93
|
+
Copyright (c) 2025 OlympusOne, released under the AGPL-3.0 or later.
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class GoogleMerchantFeedController < StoreController
|
|
3
|
+
include BaseHelper
|
|
4
|
+
include StorefrontHelper
|
|
5
|
+
|
|
6
|
+
before_action :ensure_feed_enabled
|
|
7
|
+
|
|
8
|
+
def products
|
|
9
|
+
respond_to do |format|
|
|
10
|
+
format.xml do
|
|
11
|
+
render template: 'spree_google_merchant_feed/products', formats: [:xml]
|
|
12
|
+
end
|
|
13
|
+
format.gzip do
|
|
14
|
+
gz_xml = ActiveSupport::Gzip.compress(render_to_string(template: 'spree_google_merchant_feed/products', formats: [:xml]))
|
|
15
|
+
send_data(gz_xml, filename: 'products.xml.gz', type: 'application/x-gzip', disposition: 'inline')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def ensure_feed_enabled
|
|
23
|
+
unless store_integration('google_merchant_feed').present?
|
|
24
|
+
render plain: 'Google Merchant Feed is not enabled for this store.', status: :not_found
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -16,7 +16,7 @@ xml.rss version: "2.0", "xmlns:g" => "http://base.google.com/ns/1.0" do
|
|
|
16
16
|
xml.tag! "g:description", product.storefront_description&.truncate(5000)
|
|
17
17
|
xml.tag! "g:link", spree_storefront_resource_url(product)
|
|
18
18
|
if product.default_image.present?
|
|
19
|
-
xml.tag! "g:image_link", spree_image_url(product.
|
|
19
|
+
xml.tag! "g:image_link", spree_image_url(product.default_image, width: 500, height: 500)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# Price and availability
|
data/config/routes.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Spree::Core::Engine.add_routes do
|
|
2
|
-
get '/google_merchant/products', to: '
|
|
3
|
-
get '/google_merchant/products.xml.gz', to: '
|
|
2
|
+
get '/google_merchant/products', to: 'google_merchant_feed#products', defaults: { format: :xml }
|
|
3
|
+
get '/google_merchant/products.xml.gz', to: 'google_merchant_feed#products'
|
|
4
4
|
end
|
|
@@ -13,6 +13,14 @@ module SpreeGoogleMerchantFeed
|
|
|
13
13
|
SpreeGoogleMerchantFeed::Config = SpreeGoogleMerchantFeed::Configuration.new
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
initializer 'spree_google_merchant_feed.assets' do |app|
|
|
17
|
+
app.config.assets.precompile += %w[spree_google_merchant_feed_manifest]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
initializer 'spree_google_merchant_feed.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 :google_merchant_feed_integration, class: Spree::Integrations::GoogleMerchantFeed 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_google_merchant_feed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.2
|
|
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 listings to Google Merchant Center
|
|
83
|
-
for Spree Commerce.
|
|
82
|
+
description: Adds the ability to provide products listings to Google Merchant Center.
|
|
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
|
|
92
|
-
- app/
|
|
93
|
-
- app/
|
|
91
|
+
- app/assets/config/spree_google_merchant_feed_manifest.js
|
|
92
|
+
- app/assets/images/integration_icons/google-merchant-center-logo.png
|
|
93
|
+
- app/controllers/spree/google_merchant_feed_controller.rb
|
|
94
|
+
- app/models/spree/integrations/google_merchant_feed.rb
|
|
95
|
+
- app/views/spree/admin/integrations/forms/_google_merchant_feed.html.erb
|
|
96
|
+
- app/views/spree_google_merchant_feed/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_google_merchant/install/install_generator.rb
|
|
96
101
|
- lib/spree_google_merchant_feed.rb
|
|
97
102
|
- lib/spree_google_merchant_feed/configuration.rb
|
|
98
103
|
- lib/spree_google_merchant_feed/engine.rb
|
|
@@ -100,13 +105,13 @@ files:
|
|
|
100
105
|
- lib/spree_google_merchant_feed/version.rb
|
|
101
106
|
homepage: https://github.com/olympusone/spree_google_merchant_feed
|
|
102
107
|
licenses:
|
|
103
|
-
-
|
|
108
|
+
- AGPL-3.0-or-later
|
|
104
109
|
metadata:
|
|
105
110
|
bug_tracker_uri: https://github.com/olympusone/spree_google_merchant_feed/issues
|
|
106
|
-
changelog_uri: https://github.com/olympusone/spree_google_merchant_feed/releases/tag/v1.
|
|
111
|
+
changelog_uri: https://github.com/olympusone/spree_google_merchant_feed/releases/tag/v1.1.2
|
|
107
112
|
documentation_uri: https://github.com/olympusone/spree_google_merchant_feed
|
|
108
113
|
homepage_uri: https://github.com/olympusone/spree_google_merchant_feed
|
|
109
|
-
source_code_uri: https://github.com/olympusone/spree_google_merchant_feed/tree/v1.
|
|
114
|
+
source_code_uri: https://github.com/olympusone/spree_google_merchant_feed/tree/v1.1.2
|
|
110
115
|
rdoc_options: []
|
|
111
116
|
require_paths:
|
|
112
117
|
- lib
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
class GoogleMerchantController < StoreController
|
|
3
|
-
include BaseHelper
|
|
4
|
-
include StorefrontHelper
|
|
5
|
-
|
|
6
|
-
def products
|
|
7
|
-
respond_to do |format|
|
|
8
|
-
format.xml
|
|
9
|
-
format.gzip do
|
|
10
|
-
gz_xml = ActiveSupport::Gzip.compress(render_to_string(template: 'spree/google_merchant/products', formats: [:xml]))
|
|
11
|
-
send_data(gz_xml, filename: 'sitemap.xml.gz', type: 'application/x-gzip', disposition: 'inline')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module SpreeGoogleMerchantFeed
|
|
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_google_merchant_feed'
|
|
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
|