kuehne-nagel-despatch-interface 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,57 @@
1
+ module KuehneNagelDespatchInterface
2
+
3
+ class Engine < Rails::Engine
4
+
5
+ config.autoload_paths += %W(#{config.root}/lib/kuehne-nagel-despatch-interface)
6
+
7
+ =begin
8
+ config.to_prepare do
9
+ # Load application's model / class decorators
10
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
11
+ Rails.configuration.cache_classes ? require(c) : load(c)
12
+ end
13
+
14
+ # Load application's view overrides
15
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
16
+ Rails.configuration.cache_classes ? require(c) : load(c)
17
+ end
18
+ end
19
+ =end
20
+
21
+ def self.activate
22
+
23
+ =begin
24
+ # Add helper to retrieve the users country
25
+ ApplicationHelper.send(:include, Spree::ZonePricing::GetCountry)
26
+ # Add helper to retrieve the users country, used by a number of controllers
27
+ Spree::BaseController.send(:include, Spree::ZonePricing::GetCountry)
28
+
29
+ # Add additional associations to allow m:m relationship
30
+ # between zones<->variants
31
+ Spree::Zone.send(:include, Spree::ZonePricing::Zone)
32
+ Spree::Variant.send(:include, Spree::ZonePricing::Variant)
33
+
34
+ # Override add_variant method so that we can use zone pricing
35
+ Spree::Order.send(:include, Spree::ZonePricing::Order)
36
+
37
+ # Override price
38
+ Spree::ProductsHelper.send(:include, Spree::ZonePricing::ProductsHelper)
39
+
40
+ # Add action to countries controller to handle country selection
41
+ CountriesController.send(:include, Spree::ZonePricing::CountriesController)
42
+ # Add code to set the currently country in the order
43
+ OrdersController.send(:include, Spree::ZonePricing::OrdersController)
44
+ # Add code to save zone prices
45
+ Admin::VariantsController.send(:include, Spree::ZonePricing::Admin::VariantsController)
46
+ # Add code to check zone prices after address is saved during checkout, if ship
47
+ # country not the same change prices in order
48
+ CheckoutsController.send(:include, Spree::ZonePricing::CheckoutsController)
49
+ =end
50
+
51
+ end
52
+
53
+ config.to_prepare &method(:activate).to_proc
54
+
55
+ end
56
+
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuehne-nagel-despatch-interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-01-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2165854820 !ruby/object:Gem::Requirement
16
+ requirement: &2160229540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,14 +21,14 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2165854820
24
+ version_requirements: *2160229540
25
25
  description: Library to integrate K+N logistic API to Ruby on Rails Applications.
26
26
  email: henrique@madebymade.co.uk
27
27
  executables: []
28
28
  extensions: []
29
29
  extra_rdoc_files: []
30
30
  files:
31
- - lib/kn_actions.rb
31
+ - lib/kuehne-nagel-despatch-interface.rb
32
32
  homepage: https://github.com/madebymade/kuehne-nagel-despatch-interface
33
33
  licenses: []
34
34
  post_install_message:
data/lib/kn_actions.rb DELETED
@@ -1,21 +0,0 @@
1
- class KnActions
2
-
3
- def initialize(order_id)
4
- Rails.logger.info "KnActions Started..."
5
- Rails.logger.info "KnActions order_id: " + order_id.inspect
6
- @order_id = order_id
7
- end
8
-
9
- def generate_xml
10
-
11
- end
12
-
13
- def download_pdf
14
-
15
- end
16
-
17
- def submit_to_kn
18
-
19
- end
20
-
21
- end