Sha256: 382db91b28b2c90b58c3fedce94e47d75e0e426a3fa97bb147bcce339afea1d6

Contents?: true

Size: 427 Bytes

Versions: 6

Compression:

Stored size: 427 Bytes

Contents

module ActiveMerchant
  module Shipping
    module Base
      mattr_accessor :mode
      self.mode = :production
      
      ALLCAPS_NAMES = ['ups','usps','dhl'] # is the class name allcaps like USPS or camelcase like FedEx?
      
      def self.carrier(name)
        name = name.to_s.downcase
        ActiveMerchant::Shipping.const_get(ALLCAPS_NAMES.include?(name) ? name.upcase : name.camelize)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
bcarpenter-active_shipping-0.0.2 lib/active_shipping/shipping/base.rb
bcarpenter-active_shipping-0.0.5 lib/active_shipping/shipping/base.rb
bcarpenter-active_shipping-0.0.6 lib/active_shipping/shipping/base.rb
bcarpenter-active_shipping-0.0.7 lib/active_shipping/shipping/base.rb
active_shipping-0.0.2 lib/active_shipping/shipping/base.rb
active_shipping-0.0.1 lib/active_shipping/shipping/base.rb