class FriendlyShipping::Services::Usps::MachinablePackage

USPS has certain size and weight requirements for packages to be considered machinable. Machinable packages are generally less expensive to ship. For more information see:

https://pe.usps.com/BusinessMail101?ViewName=Parcels

Constants

MAX_HEIGHT
MAX_LENGTH
MAX_WEIGHT
MAX_WIDTH
MIN_HEIGHT
MIN_LENGTH
MIN_WIDTH

Attributes

package[R]

Public Class Methods

new(package) click to toggle source

@param [Physical::Package]

# File lib/friendly_shipping/services/usps/machinable_package.rb, line 25
def initialize(package)
  @package = package
end

Public Instance Methods

machinable?() click to toggle source
# File lib/friendly_shipping/services/usps/machinable_package.rb, line 29
def machinable?
  at_least_minimum && at_most_maximum
end

Private Instance Methods

at_least_minimum() click to toggle source
# File lib/friendly_shipping/services/usps/machinable_package.rb, line 35
def at_least_minimum
  package.length >= MIN_LENGTH &&
    package.width >= MIN_WIDTH &&
    package.height >= MIN_HEIGHT
end
at_most_maximum() click to toggle source
# File lib/friendly_shipping/services/usps/machinable_package.rb, line 41
def at_most_maximum
  package.length <= MAX_LENGTH &&
    package.width <= MAX_WIDTH &&
    package.height <= MAX_HEIGHT &&
    package.weight <= MAX_WEIGHT
end