Sha256: 6e04e16ae3960f44c1bdf9eeca72d994455a00ce1d7ab2224a8eccae8c8480a6

Contents?: true

Size: 1.3 KB

Versions: 22

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module FriendlyShipping
  class ShippingMethod
    attr_reader :name, :service_code, :carrier, :origin_countries

    # @param [String] name The shipping method's name
    # @param [String] service_code The shipping method's service code
    # @param [Boolean] domestic Whether this is a domestic shipping method
    # @param [Boolean] international Whether this is an international shipping method
    # @param [Boolean] multi_package Whether this is a multi-package shipping method
    # @param [FriendlyShipping::Carrier] carrier This shipping method's carrier
    # @param [Array] origin_countries Countries this shipping method ships from
    def initialize(
      name: nil,
      service_code: nil,
      domestic: nil,
      international: nil,
      multi_package: nil,
      carrier: nil,
      origin_countries: []
    )
      @name = name
      @service_code = service_code
      @domestic = domestic
      @international = international
      @multi_package = multi_package
      @carrier = carrier
      @origin_countries = origin_countries
    end

    def domestic?
      !!domestic
    end

    def international?
      !!international
    end

    def multi_package?
      !!multi_package
    end

    private

    attr_reader :domestic, :international, :multi_package
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
friendly_shipping-0.6.2 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.6.1 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.6.0 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.5.3 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.5.2 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.5.1 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.5 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.14 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.13 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.12 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.11 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.10 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.9 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.8 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.7 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.6 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.5 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.4 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.3 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.4.2 lib/friendly_shipping/shipping_method.rb