spree_google_merchant_feed 1.1.2 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73bd1e391cd46c9881a481dec0598576a49ffe623ff6ad827b5286d1d0408b1b
4
- data.tar.gz: 41e80986993067fa780d64529935f3ec18ad82042a436aa68eabcf2c91d2aa8f
3
+ metadata.gz: 5efb0498b40ed2ac2d6dd0de0b4a1a39cec1c87f19b20f86135c271a9ac880ee
4
+ data.tar.gz: a5d8a1d76d0278aff9e3c33657fba0ab7e0b8ca3e1d5de7c36b9743dc0ba4090
5
5
  SHA512:
6
- metadata.gz: 1c27f241cd94a99b23cf84f003ebb2a62953d8a283a6996d6688bf2f90725b9dcea0d6c5dd64f9b4a92c20cdddbd9f4c3b5165b53656b1209904a48c16e9b6c1
7
- data.tar.gz: 90be81863d28167c8ff7ac7fd07cbe01c963d39f34359abf82f87fdf14ac21e433d02d96834ee5c691f7c1ee22ec947efc5007256e64d811354d458feabf0326
6
+ metadata.gz: b2a55cfbbb48f038d50960b7a9968820c02b0641fbfdd69ef3f0bc4b28865e27fdab15dbca6be91114d0030cbdbcd8bb0d6c11bbe6496d52a3dc4de50bfdb130
7
+ data.tar.gz: 15b4c0046671c511205b980581569f4028e35a44f6c29c4b5a0716959994d9474539275001d3c007dcd1ac1ff9eabe68c663b3a079f00b6a06f932ca1377f74e
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SpreeGoogleMerchantFeed
1
+ # Spree Google Merchant Feed
2
2
 
3
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
 
@@ -6,7 +6,7 @@ This is a Google Merchant extension for [Spree Commerce](https://spreecommerce.o
6
6
 
7
7
  ## Installation
8
8
 
9
- 1. Add this extension to your Gemfile:
9
+ 1. Add this extension to your Gemfile with this line:
10
10
 
11
11
  ```bash
12
12
  bundle add spree_google_merchant_feed
@@ -40,41 +40,28 @@ To use your Google Merchant endpoint as a data source in Google Merchant Center:
40
40
 
41
41
  ## Developing
42
42
 
43
- 1. Create a dummy app:
43
+ 1. Create a dummy app
44
44
 
45
45
  ```bash
46
46
  bundle update
47
47
  bundle exec rake test_app
48
48
  ```
49
49
 
50
- 2. Add code.
50
+ 2. Add your new code
51
51
 
52
- 3. Run tests:
52
+ 3. Run tests
53
53
 
54
54
  ```bash
55
55
  bundle exec rspec
56
56
  ```
57
57
 
58
- When testing your application's integration you may use its factories:
58
+ When testing your applications integration with this extension you may use it's factories.
59
+ Simply add this require statement to your spec_helper:
59
60
 
60
61
  ```ruby
61
62
  require 'spree_google_merchant_feed/factories'
62
63
  ```
63
64
 
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
-
78
65
  ## Releasing a new version
79
66
 
80
67
  ```bash
@@ -15,22 +15,42 @@ xml.rss version: "2.0", "xmlns:g" => "http://base.google.com/ns/1.0" do
15
15
  xml.tag! "g:title", product.name.truncate(150)
16
16
  xml.tag! "g:description", product.storefront_description&.truncate(5000)
17
17
  xml.tag! "g:link", spree_storefront_resource_url(product)
18
- if product.default_image.present?
19
- xml.tag! "g:image_link", spree_image_url(product.default_image, width: 500, height: 500)
18
+
19
+ if product.featured_image.present?
20
+ xml.tag! "g:image_link", spree_image_url(product.featured_image, width: 500, height: 500)
21
+ end
22
+ product.master_images.each do |image|
23
+ next if product.featured_image == image
24
+
25
+ xml.tag! "g:additional_image_link" do
26
+ xml.cdata! spree_image_url(image, width: 500, height: 500)
27
+ end
20
28
  end
21
29
 
22
30
  # Price and availability
23
- xml.tag! "g:availability", product.in_stock? ? "in_stock" : "out_of_stock"
31
+ if product.in_stock?
32
+ xml.tag! "g:availability", "in_stock"
33
+ elsif product.backorderable?
34
+ xml.tag! "g:availability", "backorder"
35
+ elsif !product.in_stock?
36
+ xml.tag! "g:availability", "out_of_stock"
37
+ end
38
+
24
39
  xml.tag! "g:availability_date", product.available_on.strftime("%Y-%m-%dT%H:%M%z") if product.available_on?
25
40
  xml.tag! "g:expiration_date", product.discontinue_on.strftime("%Y-%m-%dT%H:%M%z") if product.discontinue_on?
26
- xml.tag! "g:price", format('%.2f', product.display_amount.to_d) + " " + current_currency
27
- xml.tag! "g:unit_pricing_measure", "#{product.weight}#{product.weight_unit}" if product.weight.present?
41
+
42
+ if product.on_sale?(current_store.default_currency)
43
+ xml.tag! "g:price", format('%.2f', product.display_compare_at_price.to_d) + " " + current_currency
44
+ xml.tag! "g:sale_price", format('%.2f', product.display_price.to_d) + " " + current_currency
45
+ else
46
+ xml.tag! "g:price", format('%.2f', product.display_price.to_d) + " " + current_currency
47
+ end
28
48
 
29
49
  # Product category
30
50
  xml.tag! "g:product_type", product_breadcrumb_taxons(product).map(&:name).join(' > ')
31
51
 
32
52
  # Product identifiers
33
- xml.tag! "g:brand", product.brand.name if product.brand.present?
53
+ xml.tag! "g:brand", product.brand_taxon.name if product.brand_taxon.present?
34
54
 
35
55
  # Detailed product description
36
56
  xml.tag! "g:product_weight", "#{product.weight} #{product.weight_unit}" if product.weight.present?
@@ -1,3 +1,3 @@
1
1
  Rails.application.config.after_initialize do
2
- Rails.application.config.spree.integrations << Spree::Integrations::GoogleMerchantFeed
2
+ Spree.integrations << Spree::Integrations::GoogleMerchantFeed
3
3
  end
@@ -17,8 +17,8 @@ module SpreeGoogleMerchantFeed
17
17
  app.config.assets.precompile += %w[spree_google_merchant_feed_manifest]
18
18
  end
19
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'))
20
+ initializer 'spree_google_merchant_feed.importmap', before: 'importmap' do |app|
21
+ app.config.importmap.paths << root.join('config/importmap.rb')
22
22
  end
23
23
 
24
24
  def self.activate
@@ -1,5 +1,5 @@
1
1
  module SpreeGoogleMerchantFeed
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.1.3'.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_google_merchant_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
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.1.8
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.1.8
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.1.8
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.1.8
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.1.8
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.1.8
53
+ version: 5.2.0
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: spree_extension
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -108,10 +108,10 @@ licenses:
108
108
  - AGPL-3.0-or-later
109
109
  metadata:
110
110
  bug_tracker_uri: https://github.com/olympusone/spree_google_merchant_feed/issues
111
- changelog_uri: https://github.com/olympusone/spree_google_merchant_feed/releases/tag/v1.1.2
111
+ changelog_uri: https://github.com/olympusone/spree_google_merchant_feed/releases/tag/v1.1.3
112
112
  documentation_uri: https://github.com/olympusone/spree_google_merchant_feed
113
113
  homepage_uri: https://github.com/olympusone/spree_google_merchant_feed
114
- source_code_uri: https://github.com/olympusone/spree_google_merchant_feed/tree/v1.1.2
114
+ source_code_uri: https://github.com/olympusone/spree_google_merchant_feed/tree/v1.1.3
115
115
  rdoc_options: []
116
116
  require_paths:
117
117
  - lib