Class: ActiveShippingExtension::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/spree_active_shipping.rb

Class Method Summary collapse

Class Method Details

.activateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/spree_active_shipping.rb', line 7

def self.activate
  Dir.glob(File.join(File.dirname(__FILE__), "../app/models/calculator/**/*.rb")) do |c|
    Rails.env.production? ? require(c) : load(c)
  end
  
  Dir.glob(File.join(File.dirname(__FILE__), "spree/**/*.rb")) do |c|
    Rails.env.production? ? require(c) : load(c)
  end
  
  [
    Calculator::Ups::Ground,
    Calculator::Ups::NextDayAir,
    Calculator::Ups::NextDayAirEarlyAm,
    Calculator::Ups::NextDayAirSaver,
    Calculator::Ups::Saver,
    Calculator::Ups::SecondDayAir,
    Calculator::Ups::ThreeDaySelect,
    Calculator::Ups::WorldwideExpedited,
    Calculator::Fedex::ExpressSaver,
    Calculator::Fedex::FirstOvernight,
    Calculator::Fedex::Ground,
    Calculator::Fedex::GroundHomeDelivery,
    Calculator::Fedex::InternationalEconomy,
    Calculator::Fedex::InternationalEconomyFreight,
    Calculator::Fedex::InternationalFirst,
    Calculator::Fedex::InternationalGround,
    Calculator::Fedex::InternationalPriority,
    Calculator::Fedex::InternationalPriorityFreight,
    Calculator::Fedex::InternationalPrioritySaturdayDelivery,
    Calculator::Fedex::OneDayFreight,
    Calculator::Fedex::OneDayFreightSaturdayDelivery,
    Calculator::Fedex::PriorityOvernight,
    Calculator::Fedex::PriorityOvernightSaturdayDelivery,
    Calculator::Fedex::StandardOvernight,
    Calculator::Fedex::ThreeDayFreight,
    Calculator::Fedex::ThreeDayFreightSaturdayDelivery,
    Calculator::Fedex::StandardOvernight,
    Calculator::Fedex::ThreeDayFreight,
    Calculator::Fedex::ThreeDayFreightSaturdayDelivery,
    Calculator::Fedex::TwoDay,
    Calculator::Fedex::TwoDayFreight,
    Calculator::Fedex::TwoDayFreightSaturdayDelivery,
    Calculator::Fedex::TwoDaySaturdayDelivery,
    Calculator::Usps::MediaMail,
    Calculator::Usps::ExpressMail,
    Calculator::Usps::ExpressMailInternational,
    Calculator::Usps::PriorityMail,
    Calculator::Usps::PriorityMailInternational,
    Calculator::Usps::PriorityMailSmallFlatRateBox,
    Calculator::Usps::PriorityMailRegularMediumFlatRateBoxes,
    Calculator::Usps::PriorityMailLargeFlatRateBox
  ].each(&:register)
  
  Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
    Rails.env.production? ? require(c) : load(c)
  end
  
  #Only required until following active_shipping commit is merged (add negotiated rates).
  #http://github.com/BDQ/active_shipping/commit/2f2560d53aa7264383e5a35deb7264db60eb405a
  ActiveMerchant::Shipping::UPS.send(:include, Spree::ActiveShipping::UpsOverride)
  
end