Sha256: c432a248cf274d8009f795faac4e52560fcc521d27376e8e7bebc70d5d10a7cc

Contents?: true

Size: 1.58 KB

Versions: 62

Compression:

Stored size: 1.58 KB

Contents

module ActiveShipping
  module Carriers
    extend self

    attr_reader :registered
    @registered = []

    def register(class_name, autoload_require)
      ActiveShipping.autoload(class_name, autoload_require)
      self.registered << class_name
    end

    def all
      ActiveShipping::Carriers.registered.map { |name| ActiveShipping.const_get(name) }
    end

    def find(name)
      all.find { |c| c.name.downcase == name.to_s.downcase } || raise(NameError, "unknown carrier #{name}")
    end
  end
end

ActiveShipping::Carriers.register :BenchmarkCarrier, 'active_shipping/carriers/benchmark_carrier'
ActiveShipping::Carriers.register :BogusCarrier,     'active_shipping/carriers/bogus_carrier'
ActiveShipping::Carriers.register :USPS,             'active_shipping/carriers/usps'
ActiveShipping::Carriers.register :USPSReturns,      'active_shipping/carriers/usps_returns'
ActiveShipping::Carriers.register :FedEx,            'active_shipping/carriers/fedex'
ActiveShipping::Carriers.register :Shipwire,         'active_shipping/carriers/shipwire'
ActiveShipping::Carriers.register :Kunaki,           'active_shipping/carriers/kunaki'
ActiveShipping::Carriers.register :CanadaPost,       'active_shipping/carriers/canada_post'
ActiveShipping::Carriers.register :NewZealandPost,   'active_shipping/carriers/new_zealand_post'
ActiveShipping::Carriers.register :CanadaPostPWS,    'active_shipping/carriers/canada_post_pws'
ActiveShipping::Carriers.register :Stamps,           'active_shipping/carriers/stamps'
ActiveShipping::Carriers.register :AustraliaPost,    'active_shipping/carriers/australia_post'

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.26 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.45 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.25 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.23 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.44 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.22 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.43 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.21 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.42 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.20 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.41 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.19 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.40 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.18 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.39 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.17 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.38 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.5.16 vendor/active_shipping/lib/active_shipping/carriers.rb
workarea-core-3.4.37 vendor/active_shipping/lib/active_shipping/carriers.rb