spree_fosdick_integration 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +15 -0
- data/Gemfile +4 -6
- data/README.md +5 -0
- data/app/models/spree/shipment_decorator.rb +6 -1
- data/app/overrides/add_fosdick_panel.rb +8 -5
- data/app/serializers/shipment_serializer.rb +2 -2
- data/db/migrate/20151013153126_create_spree_fosdick_shipment.rb +1 -3
- data/db/migrate/20151015122038_create_fosdick_exceptions.rb +1 -3
- data/db/migrate/20151028105216_add_fosdick_atempt_and_state_spree_shipments.rb +1 -1
- data/lib/fosdick/processor.rb +1 -1
- data/lib/spree_fosdick_integration/factories.rb +1 -1
- data/lib/spree_fosdick_integration/version.rb +1 -1
- data/spec/controllers/admin/fosdick_shipments_controller_spec.rb +4 -2
- data/spec/models/spree/shipment_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -1
- data/spree_fosdick_integration.gemspec +3 -2
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7b5a27b8023463cb8ec11d776c7de7ddfc8b154
|
4
|
+
data.tar.gz: 66eb460f62c2b697690e944573d3d3b50fdd1df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7ec466d7ef9d6d2521a1723c3e552328196efd2e54742115a116f0281ab91cfa2bc4a7fd3345b43f97a495f7764047a4f1f1cb8519d32f2457ca627ede71acb
|
7
|
+
data.tar.gz: b30401daedc7971b1db1dcfd49a48e29dc4a011f56678dcb1ac01c38e8ecaab5a93d194d238b11664877a51e362cb4673480083265ae652c3e9db4febc4a40d0
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
image: ruby:2.4.2
|
2
|
+
|
3
|
+
cache:
|
4
|
+
paths:
|
5
|
+
- cache
|
6
|
+
|
7
|
+
before_script:
|
8
|
+
- apt-get update -q && apt-get install nodejs -yqq
|
9
|
+
- gem install bundler -v 1.15.4 --no-ri --no-rdoc
|
10
|
+
- bundle install -j $(nproc) --path cache
|
11
|
+
|
12
|
+
test:
|
13
|
+
script:
|
14
|
+
- bundle exec rake test_app
|
15
|
+
- rspec spec
|
data/Gemfile
CHANGED
@@ -5,17 +5,15 @@ gem 'httparty'
|
|
5
5
|
gem 'nokogiri'
|
6
6
|
gem 'model_un'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
gem 'spree', github: 'spree/spree', branch: spree_version
|
11
|
-
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: spree_version
|
8
|
+
gem 'spree', '~> 3.6'
|
9
|
+
gem 'spree_auth_devise', '~> 3.3'
|
12
10
|
|
13
11
|
gem 'haml'
|
14
12
|
gem 'haml-rails'
|
15
|
-
gem 'active_model_serializers', '~> 0.
|
13
|
+
gem 'active_model_serializers', '~> 0.10.7'
|
16
14
|
|
17
15
|
group :test do
|
18
|
-
gem 'shoulda-matchers', require: false
|
16
|
+
gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers', require: false
|
19
17
|
gem 'webmock'
|
20
18
|
end
|
21
19
|
gemspec
|
data/README.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
Current gem provides easy integration for you Spree Commerce based apps with full service fulfillment services of Fosdick Fulfillment.
|
4
4
|
|
5
|
+
Spree Commerce versions:
|
6
|
+
- Spree Core - 3.6
|
7
|
+
- Spree Auth Devise - 3.3
|
8
|
+
|
9
|
+
|
5
10
|
## Installation
|
6
11
|
|
7
12
|
Add this line to your application's Gemfile:
|
@@ -4,7 +4,12 @@ Spree::Shipment.class_eval do
|
|
4
4
|
def self.perform_fosdick_shipments
|
5
5
|
shipments = where(shipped_at: nil, state: 'ready', send_atempt: 0..2).where.not(fosdick_state: ['duplicate', 'success'])
|
6
6
|
|
7
|
-
JSON.parse(
|
7
|
+
JSON.parse(
|
8
|
+
ActiveModel::Serializer::CollectionSerializer.new(
|
9
|
+
shipments,
|
10
|
+
each_serializer: ShipmentSerializer,
|
11
|
+
root: false).to_json
|
12
|
+
) if shipments.present?
|
8
13
|
end
|
9
14
|
|
10
15
|
def bill_to
|
@@ -1,8 +1,11 @@
|
|
1
1
|
Deface::Override.new(
|
2
2
|
virtual_path: 'spree/admin/orders/index',
|
3
3
|
name: 'admin_fosdick_index_button',
|
4
|
-
insert_before: "erb[
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
insert_before: "erb[loud]:contains('Spree.t(:new_order)')",
|
5
|
+
) do
|
6
|
+
<<-CODE.chomp
|
7
|
+
<%= button_link_to 'Fosdick panel',
|
8
|
+
admin_fosdick_shipments_path, { style: 'margin-right:5px;',
|
9
|
+
class: 'btn-primary', icon: 'ok', id: 'admin_fosdick_index' }%>
|
10
|
+
CODE
|
11
|
+
end
|
@@ -5,8 +5,8 @@ class ShipmentSerializer < ActiveModel::Serializer
|
|
5
5
|
:shipping_method, :tracking, :placed_on, :shipped_at, :totals,
|
6
6
|
:updated_at, :channel, :items, :shipping_method_code
|
7
7
|
|
8
|
-
has_one :bill_to, serializer: AddressSerializer,
|
9
|
-
has_one :ship_to, serializer: AddressSerializer,
|
8
|
+
has_one :bill_to, serializer: AddressSerializer, key: 'billing_address'
|
9
|
+
has_one :ship_to, serializer: AddressSerializer, key: 'shipping_address'
|
10
10
|
|
11
11
|
def id
|
12
12
|
object.number
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateSpreeFosdickShipment < ActiveRecord::Migration
|
1
|
+
class CreateSpreeFosdickShipment < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
create_table :spree_fosdick_shipments do |t|
|
4
4
|
t.belongs_to :spree_shipment
|
@@ -11,7 +11,5 @@ class CreateSpreeFosdickShipment < ActiveRecord::Migration
|
|
11
11
|
t.datetime :ship_date
|
12
12
|
t.timestamps
|
13
13
|
end
|
14
|
-
|
15
|
-
add_index :spree_fosdick_shipments, :spree_shipment_id
|
16
14
|
end
|
17
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateFosdickExceptions < ActiveRecord::Migration
|
1
|
+
class CreateFosdickExceptions < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
create_table :spree_fosdick_exceptions do |t|
|
4
4
|
t.belongs_to :spree_fosdick_shipment
|
@@ -9,7 +9,5 @@ class CreateFosdickExceptions < ActiveRecord::Migration
|
|
9
9
|
t.datetime :happened_at
|
10
10
|
t.timestamps
|
11
11
|
end
|
12
|
-
|
13
|
-
add_index :spree_fosdick_exceptions, :spree_fosdick_shipment_id
|
14
12
|
end
|
15
13
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddFosdickAtemptAndStateSpreeShipments < ActiveRecord::Migration
|
1
|
+
class AddFosdickAtemptAndStateSpreeShipments < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
add_column :spree_shipments, :send_atempt, :integer, default: 0, null: false
|
4
4
|
add_column :spree_shipments, :fosdick_state, :string, default: 'ready', null: false
|
data/lib/fosdick/processor.rb
CHANGED
@@ -52,7 +52,7 @@ module Fosdick
|
|
52
52
|
shipment.order.update(shipment_state: 'shipped') if ship_date.present?
|
53
53
|
|
54
54
|
if fosdick_shipment.confirmation_sent == false && trackings.present?
|
55
|
-
Spree::FosdickShipmentMailer.order_shipped(shipment).
|
55
|
+
Spree::FosdickShipmentMailer.order_shipped(shipment).deliver_now
|
56
56
|
fosdick_shipment.update(confirmation_sent: true)
|
57
57
|
end
|
58
58
|
end
|
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Spree::Admin::FosdickShipmentsController, type: :controller do
|
4
|
+
routes { Spree::Core::Engine.routes }
|
5
|
+
|
4
6
|
describe '#index' do
|
5
7
|
let!(:fosdick_shipment) { create :fosdick_shipment }
|
6
8
|
let!(:admin) { create :admin_user }
|
7
9
|
before { sign_in(admin) }
|
8
10
|
|
9
11
|
it 'should have 200 response' do
|
10
|
-
get :index
|
12
|
+
get :index
|
11
13
|
|
12
14
|
expect(response.status).to eq(200)
|
13
15
|
expect(assigns[:fosdick_shipments]).to eq [fosdick_shipment]
|
14
16
|
end
|
15
17
|
end
|
16
|
-
end
|
18
|
+
end
|
@@ -41,7 +41,7 @@ RSpec.describe Spree::Shipment, type: :model do
|
|
41
41
|
'phone'=>'555-555-0199'},
|
42
42
|
'shipping_address'=>nil}.to_json) }
|
43
43
|
|
44
|
-
before { allow(ActiveModel::
|
44
|
+
before { allow(ActiveModel::Serializer::CollectionSerializer).to receive(:new).and_return([result]) }
|
45
45
|
|
46
46
|
it 'should perform shipments to fosdick' do
|
47
47
|
expect(Spree::Shipment.perform_fosdick_shipments).to eq [result]
|
data/spec/spec_helper.rb
CHANGED
@@ -18,6 +18,7 @@ require 'rspec/rails'
|
|
18
18
|
require 'database_cleaner'
|
19
19
|
require 'ffaker'
|
20
20
|
require 'shoulda/matchers'
|
21
|
+
require 'rails-controller-testing'
|
21
22
|
|
22
23
|
Shoulda::Matchers.configure do |config|
|
23
24
|
config.integrate do |with|
|
@@ -47,7 +48,7 @@ require 'spree_fosdick_integration/factories'
|
|
47
48
|
require 'webmock/rspec'
|
48
49
|
|
49
50
|
RSpec.configure do |config|
|
50
|
-
config.include
|
51
|
+
config.include FactoryBot::Syntax::Methods
|
51
52
|
|
52
53
|
config.include Devise::TestHelpers, type: :controller
|
53
54
|
# == URL Helpers
|
@@ -96,4 +97,6 @@ RSpec.configure do |config|
|
|
96
97
|
end
|
97
98
|
|
98
99
|
config.fail_fast = ENV['FAIL_FAST'] || false
|
100
|
+
|
101
|
+
Rails::Controller::Testing.install
|
99
102
|
end
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'spree_core', '~> 3.
|
23
|
+
spec.add_dependency 'spree_core', '~> 3.6.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -28,7 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'capybara', '~> 2.4'
|
29
29
|
spec.add_development_dependency 'coffee-rails'
|
30
30
|
spec.add_development_dependency 'database_cleaner'
|
31
|
-
spec.add_development_dependency '
|
31
|
+
spec.add_development_dependency 'factory_bot_rails', '~> 4.10.0'
|
32
|
+
spec.add_development_dependency 'rails-controller-testing'
|
32
33
|
spec.add_development_dependency 'ffaker', '~> 2.2.0'
|
33
34
|
spec.add_development_dependency 'sass-rails'
|
34
35
|
spec.add_development_dependency 'selenium-webdriver'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_fosdick_integration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anatolii-volodko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,19 +109,33 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: factory_bot_rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 4.10.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 4.10.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rails-controller-testing
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: ffaker
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,6 +214,7 @@ extensions: []
|
|
200
214
|
extra_rdoc_files: []
|
201
215
|
files:
|
202
216
|
- ".gitignore"
|
217
|
+
- ".gitlab-ci.yml"
|
203
218
|
- Gemfile
|
204
219
|
- LICENSE.txt
|
205
220
|
- README.md
|
@@ -269,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
284
|
version: '0'
|
270
285
|
requirements: []
|
271
286
|
rubyforge_project:
|
272
|
-
rubygems_version: 2.
|
287
|
+
rubygems_version: 2.6.13
|
273
288
|
signing_key:
|
274
289
|
specification_version: 4
|
275
290
|
summary: Integration Spree Commerce with Fosdick API
|
@@ -283,4 +298,3 @@ test_files:
|
|
283
298
|
- spec/services/fosdick/receiver_spec.rb
|
284
299
|
- spec/services/fosdick/sender_spec.rb
|
285
300
|
- spec/spec_helper.rb
|
286
|
-
has_rdoc:
|