Sha256: ea7882a02e53801665b7e32dc64ed6c5c4ba92da6c2696345004e56a1c6d9013

Contents?: true

Size: 1.42 KB

Versions: 9

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

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

    # @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
    # @param [Hash] data Additional carrier-specific data for this shipping method
    def initialize(
      name: nil,
      service_code: nil,
      domestic: nil,
      international: nil,
      multi_package: nil,
      carrier: nil,
      origin_countries: [],
      data: {}
    )
      @name = name
      @service_code = service_code
      @domestic = domestic
      @international = international
      @multi_package = multi_package
      @carrier = carrier
      @origin_countries = origin_countries
      @data = data
    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

9 entries across 9 versions & 1 rubygems

Version Path
friendly_shipping-0.8.1 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.8.0 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.7.3 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.7.2 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.7.1 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.7.0 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.6.5 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.6.4 lib/friendly_shipping/shipping_method.rb
friendly_shipping-0.6.3 lib/friendly_shipping/shipping_method.rb