Class: FriendlyShipping::Services::USPSShip::MachinablePackage

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/usps_ship/machinable_package.rb

Overview

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

Constant Summary collapse

MIN_LENGTH =
Measured::Length(6, :inches)
MIN_WIDTH =
Measured::Length(3, :inches)
MIN_HEIGHT =
Measured::Length(0.25, :inches)
MAX_LENGTH =
Measured::Length(22, :inches)
MAX_WIDTH =
Measured::Length(18, :inches)
MAX_HEIGHT =
Measured::Length(15, :inches)
MIN_WEIGHT =
Measured::Weight(6, :ounces)
MAX_WEIGHT =
Measured::Weight(25, :pounds)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package) ⇒ MachinablePackage

Returns a new instance of MachinablePackage.

Parameters:

  • package (Physical::Package)


26
27
28
# File 'lib/friendly_shipping/services/usps_ship/machinable_package.rb', line 26

def initialize(package)
  @package = package
end

Instance Attribute Details

#packagePhysical::Package (readonly)

Returns:

  • (Physical::Package)


12
13
14
# File 'lib/friendly_shipping/services/usps_ship/machinable_package.rb', line 12

def package
  @package
end

Instance Method Details

#machinable?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/friendly_shipping/services/usps_ship/machinable_package.rb', line 31

def machinable?
  at_least_minimum && at_most_maximum
end