spree_channable 0.0.18.alpha → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc45055d9e1bef626d21f196471a45402d5c220cc05d0db9f7488630addc54a6
4
- data.tar.gz: 0ef0d52b27cce58f5fe3edbc8fac265163b517ae4354c671513689d0dbe8ee3b
3
+ metadata.gz: dc9c2656e64669ba4dc682e4795b6f1995ae856ef6bee7f5ca13dc2c19a392e4
4
+ data.tar.gz: e4742daa04b7a220cecc3d4b117477b3ecc4705936cc95e111055afb7eef3b4c
5
5
  SHA512:
6
- metadata.gz: c83193ff3364edc06054c6ecea2fe661c6d30de3af8f01aa4f95998b72d99dbcab4a633bce31c6736104519992a8443bd67696f7f38fce81f3e044b7913f717f
7
- data.tar.gz: 43dac314d47fb2fdd16374b6a6ace86df645655accb6e63d9e20c1241b36b9fca52fac39fda740276a7ad3abd81d3437ed69ecd6b77f040e70069d8ebc09c2a6
6
+ metadata.gz: 8e32189df7664ff793ecf80ef23c809d7b3e2b5d71c173dc80a771be5dcad2ca9370a756341f78cf13101bb064c18d9e035931f71fd8ad381fd212c9810c29da
7
+ data.tar.gz: 97dbd912ba55f4d97e4a0bf6f3bd0f854c10dd023098eb97438b221dba2c24c516d32029adc0af67f95db278a94a406b3ce42ad9b02ed214ecdcfb9b9051fe08
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ public/spree
21
21
  .ruby-gemset
22
22
  gemfiles/*.gemfile.lock
23
23
  *.gem
24
+ .byebug_history
@@ -1,35 +1,38 @@
1
1
  sudo: required
2
2
  dist: trusty
3
-
4
3
  language: ruby
5
-
6
4
  env:
7
- - DB=postgres
8
- - DB=mysql
9
-
5
+ - DB=mysql
6
+ - DB=postgres
10
7
  gemfile:
11
- - gemfiles/spree_3_2.gemfile
12
- - gemfiles/spree_3_5.gemfile
13
- - gemfiles/spree_3_7.gemfile
14
- - gemfiles/spree_master.gemfile
15
-
8
+ - gemfiles/spree_3_2.gemfile
9
+ - gemfiles/spree_3_5.gemfile
10
+ - gemfiles/spree_3_7.gemfile
11
+ - gemfiles/spree_master.gemfile
16
12
  script:
17
- - bundle exec rake test_app
18
- - bundle exec rake spec
19
-
13
+ - bundle exec rake test_app
14
+ - bundle exec rake spec
20
15
  rvm:
21
- - 2.5.1
22
- - 2.4.2
23
-
16
+ - 2.5.1
17
+ - 2.4.2
24
18
  matrix:
25
19
  allow_failures:
26
- - gemfile: gemfiles/spree_master.gemfile
27
-
20
+ - gemfile: gemfiles/spree_master.gemfile
28
21
  before_install:
29
- - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
30
- - wget -N https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip -P ~/
31
- - unzip ~/chromedriver_linux64.zip -d ~/
32
- - rm ~/chromedriver_linux64.zip
33
- - sudo mv -f ~/chromedriver /usr/local/share/
34
- - sudo chmod +x /usr/local/share/chromedriver
35
- - sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
22
+ - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
23
+ - wget -N https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
24
+ -P ~/
25
+ - unzip ~/chromedriver_linux64.zip -d ~/
26
+ - rm ~/chromedriver_linux64.zip
27
+ - sudo mv -f ~/chromedriver /usr/local/share/
28
+ - sudo chmod +x /usr/local/share/chromedriver
29
+ - sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
30
+ deploy:
31
+ provider: rubygems
32
+ api_key:
33
+ secure: NDL3Ooku/+wredPph2/vHA48LLW9njpB7JDT/kRmpE6fyFvbLNg512YehCah6lhJQNp5zN85c3Wmtc3CgA2lnLmig3wdm9KvGEg6k9vYvzZowriN7M2l7mPlNIRoRB2KpBPHpuSD70+SehNZJ94F34UAIZ0gM3KDmYMJnoHqFpbsQjxo2I4BfCuOW55KqgENhlZ/aI+PzYN8uNMdK0xVkJITqEDbwk63qtywuYqVJFGfpIlMIFvXMd7oWXnanOvSUIU3AoY2VzJIKAFgSxByyc+TAlHl7tyNLa2P5Unmik2alC/fNkm8U+pynZ9/Ue4TEA+1/NSCXnG2XXCBjRqVJqztyu5ocxrm7eXBhFLOU+tTWLLgv0VCrVpLtHk8Ngs0Xx48JrOHu4ABe2RcdTowOolUad4riVDaP3QqZBJUT+F6eF0e3QoFkDsStYhFsGDUhRorSSgnoAlGndXnrvVWvlxx4t1PUUpQIgnLv4Osyuh1LKG+Y7Ctk0awv6IJuXy3sx+j/CQywTJc7R00rFjSKVMphNhQ2Sb4cyDA606ntJyEI6hZvC9KPWuJsuVAnIyRuedL+7A1IMn8ghsHmdgc1olflPWr1ZTU6PUtNdqObYXJYquKPaTVW92OMYKCplEXzzAFZSMnjtVz1lDXvp0wj4qDheHIJzdd2Z5s+ADRrvk=
34
+ gem: spree_channable
35
+ on:
36
+ branch: master
37
+ tags: true
38
+ repo: Oldharlem/spree_channable
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
- # SpreeChannable
1
+ <h1 align="center">Channable integration for Spree Commerce</h1>
2
+
3
+ [![Build Status](https://travis-ci.com/Oldharlem/spree_channable.svg?branch=master)](https://travis-ci.com/Oldharlem/spree_channable)
4
+ [![Gem Version](https://badge.fury.io/rb/spree_channable.svg)](https://badge.fury.io/rb/spree_channable)
2
5
 
3
6
  Channable offers many ways to transform a product feed to many marketplace formats. On top channable offers an order connection to accept incoming orders from connected marketplaces. This gem connects your spree store to the channable platform. The feeds are configurable and can be directly loaded into channable.
4
7
  The order connection can be enabled by channable on request and can be easily configured through the spree admin panel.
@@ -7,7 +10,7 @@ The order connection can be enabled by channable on request and can be easily co
7
10
 
8
11
  1. Add this extension to your Gemfile with this line:
9
12
  ```ruby
10
- gem 'spree_channable', github: 'Oldharlem/spree_channable'
13
+ gem 'spree_channable'
11
14
  ```
12
15
 
13
16
  2. Install the gem using Bundler:
@@ -13,12 +13,15 @@ module Spree
13
13
  xml.link(rel: 'self', href: ::SpreeChannable.configuration.host)
14
14
  xml.updated DateTime.now.strftime('%Y-%m-%dT%H:%M:%S%z')
15
15
 
16
- Parallel.map(products) {|product| product.to_channable_variant_xml}.each do |products_xml|
17
- products_xml.each do |variant_xml|
18
- xml.parent << Nokogiri::XML(variant_xml).at('product')
16
+ xml.variants do
17
+ products.map {|product| product.to_channable_variant_xml}.each do |variants_xml|
18
+ variants_xml.each do |variant_xml|
19
+ xml.parent << Nokogiri::XML(variant_xml).at('variant')
20
+ end
19
21
  end
20
22
  end
21
23
 
24
+
22
25
  end
23
26
  end
24
27
 
@@ -33,14 +36,13 @@ module Spree
33
36
  xml.updated DateTime.now.strftime('%Y-%m-%dT%H:%M:%S%z')
34
37
 
35
38
  xml.products do
36
- Parallel.map(products) {|product| product.to_channable_product_xml}.each do |product_xml|
39
+ products.map {|product| product.to_channable_product_xml}.each do |product_xml|
37
40
  xml.parent << Nokogiri::XML(product_xml).at('product')
38
41
  end
39
42
  end
40
43
 
41
44
  end
42
45
  end
43
-
44
46
  builder.to_xml
45
47
  end
46
48
  end
@@ -48,7 +50,7 @@ module Spree
48
50
 
49
51
 
50
52
  def to_channable_variant_xml
51
- variants.active.map do |variant|
53
+ (variants.any? ? variants : variants_including_master).active.uniq.map do |variant|
52
54
  variant.to_channable_feed_entry
53
55
  end
54
56
  end
@@ -59,10 +61,16 @@ module Spree
59
61
  xml.id id
60
62
  xml.title "#{name}"
61
63
  xml.description ActionController::Base.helpers.strip_tags(normalized_description)
62
- xml.link URI.join(::SpreeChannable.configuration.host, "/#{::SpreeChannable.configuration.url_prefix}/" + slug).to_s
64
+ xml.link URI.join(::SpreeChannable.configuration.host, "/#{::SpreeChannable.configuration.url_prefix}/" + "#{slug}").to_s
63
65
  (xml.image_link URI.join(::SpreeChannable.configuration.image_host, images.first.attachment.url(:large)).to_s) if images.any?
64
66
  xml.condition property('product_condition') || ::SpreeChannable.configuration.product_condition
65
67
 
68
+ xml.images do
69
+ images.each do |image|
70
+ xml.image URI.join(::SpreeChannable.configuration.image_host, image.attachment.url(:large)).to_s
71
+ end
72
+ end
73
+
66
74
  xml.price price
67
75
 
68
76
  xml.brand property('brand') || ::SpreeChannable.configuration.brand
@@ -83,12 +91,17 @@ module Spree
83
91
  xml.material property('material') || 'Not set'
84
92
 
85
93
  xml.variants do
86
- variants.each do |variant|
94
+ (variants.any? ? variants : variants_including_master).each do |variant|
87
95
  xml.variant do
88
96
  xml.id variant.id
89
97
  xml.product_id id
90
98
  xml.options_text variant.options_text
91
99
  (xml.image_link URI.join(::SpreeChannable.configuration.image_host, variant.get_images.first.attachment.url(:large)).to_s) unless variant.get_images.empty?
100
+ xml.images do
101
+ variant.get_images.each do |image|
102
+ xml.image URI.join(::SpreeChannable.configuration.image_host, image.attachment.url(:large)).to_s
103
+ end
104
+ end
92
105
 
93
106
  xml.availability variant.can_supply?
94
107
  xml.stock variant.total_on_hand
@@ -111,8 +124,16 @@ module Spree
111
124
  end.to_xml
112
125
  end
113
126
 
127
+ def normalized_description
128
+ if description.blank? || description.length < 3
129
+ name
130
+ else
131
+ description
132
+ end
133
+ end
134
+
114
135
  end
115
136
  end
116
137
  end
117
138
 
118
- Spree::Product.prepend(Spree::SpreeChannable::ProductDecorator)
139
+ Spree::Product.prepend(Spree::SpreeChannable::ProductDecorator)
@@ -10,7 +10,7 @@ module Spree
10
10
  return nil if price.blank?
11
11
 
12
12
  Nokogiri::XML::Builder.new do |xml|
13
- xml.product {
13
+ xml.variant {
14
14
  xml.id id
15
15
  xml.product_id product.id
16
16
  xml.title "#{product.name}"
@@ -19,6 +19,12 @@ module Spree
19
19
  (xml.image_link URI.join(::SpreeChannable.configuration.image_host, get_images.first.attachment.url(:large)).to_s) unless get_images.empty?
20
20
  xml.condition product.property('product_condition') || ::SpreeChannable.configuration.product_condition
21
21
 
22
+ xml.images do
23
+ get_images.each do |image|
24
+ xml.image URI.join(::SpreeChannable.configuration.image_host, image.attachment.url(:large)).to_s
25
+ end
26
+ end
27
+
22
28
  xml.availability can_supply?
23
29
  xml.stock total_on_hand
24
30
  xml.price price
@@ -10,9 +10,8 @@ module SpreeChannable
10
10
  module VERSION
11
11
  MAJOR = 0
12
12
  MINOR = 0
13
- TINY = 18
14
- PRE = 'alpha'.freeze
13
+ TINY = 24
15
14
 
16
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
15
+ STRING = [MAJOR, MINOR, TINY].compact.join('.')
17
16
  end
18
17
  end
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_dependency 'httparty'
31
31
  s.add_dependency 'whenever'
32
32
 
33
+
33
34
  s.add_development_dependency 'appraisal'
34
35
  s.add_development_dependency 'awesome_print'
35
36
  s.add_development_dependency 'capybara'
@@ -47,4 +48,5 @@ Gem::Specification.new do |s|
47
48
  s.add_development_dependency 'simplecov'
48
49
  s.add_development_dependency 'sqlite3', '~> 1.3.6'
49
50
  s.add_development_dependency 'webdrivers', '~> 3.8.0'
51
+ s.add_development_dependency 'byebug'
50
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_channable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18.alpha
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabian Oudhaarlem
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -358,6 +358,20 @@ dependencies:
358
358
  - - "~>"
359
359
  - !ruby/object:Gem::Version
360
360
  version: 3.8.0
361
+ - !ruby/object:Gem::Dependency
362
+ name: byebug
363
+ requirement: !ruby/object:Gem::Requirement
364
+ requirements:
365
+ - - ">="
366
+ - !ruby/object:Gem::Version
367
+ version: '0'
368
+ type: :development
369
+ prerelease: false
370
+ version_requirements: !ruby/object:Gem::Requirement
371
+ requirements:
372
+ - - ">="
373
+ - !ruby/object:Gem::Version
374
+ version: '0'
361
375
  description: Connect your spree store to channable. Receive orders, generate product
362
376
  feeds and send shipment updates.
363
377
  email: fabian@oldharlem.nl
@@ -439,12 +453,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
439
453
  version: 2.2.7
440
454
  required_rubygems_version: !ruby/object:Gem::Requirement
441
455
  requirements:
442
- - - ">"
456
+ - - ">="
443
457
  - !ruby/object:Gem::Version
444
- version: 1.3.1
458
+ version: '0'
445
459
  requirements:
446
460
  - none
447
- rubygems_version: 3.0.2
461
+ rubygems_version: 3.0.8
448
462
  signing_key:
449
463
  specification_version: 4
450
464
  summary: Spree Channable