Class: Brownie::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/brownie/package.rb

Constant Summary collapse

LETTER =
"01"
CUSTOMER_SUPPLIED_PACKAGE =
"02"
TUBE =
"03"
PAK =
"04"
UPS_EXPRESS_BOX =
"21"
UPS_25KG_BOX =
"24"
UPS_10KG_BOX =
"25"
PALLET =
"30"
SMALL_EXPRESS_BOX =
"2a"
MEDIUM_EXPRESS_BOX =
"2b"
LARGE_EXPRESS_BOX =
"2c"
FLATS =
"56"
PARCELS =
"57"
BPM =
"58"
FIRST_CLASS =
"59"
PRIORITY =
"60"
MACHINABLES =
"61"
IRREGULARS =
"62"
PARCEL_POST =
"63"
BPM_PARCEL =
"64"
MEDIA_MAIL =
"65"
BPM_FLAT =
"66"
STANDARD_FLAT =
"67"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#declared_valueObject

Returns the value of attribute declared_value.



29
30
31
# File 'lib/brownie/package.rb', line 29

def declared_value
  @declared_value
end

#heightObject

Returns the value of attribute height.



29
30
31
# File 'lib/brownie/package.rb', line 29

def height
  @height
end

#lengthObject

Returns the value of attribute length.



29
30
31
# File 'lib/brownie/package.rb', line 29

def length
  @length
end

#package_typeObject

Returns the value of attribute package_type.



29
30
31
# File 'lib/brownie/package.rb', line 29

def package_type
  @package_type
end

#unit_of_measurementObject

Returns the value of attribute unit_of_measurement.



29
30
31
# File 'lib/brownie/package.rb', line 29

def unit_of_measurement
  @unit_of_measurement
end

#weightObject

Returns the value of attribute weight.



29
30
31
# File 'lib/brownie/package.rb', line 29

def weight
  @weight
end

#widthObject

Returns the value of attribute width.



29
30
31
# File 'lib/brownie/package.rb', line 29

def width
  @width
end

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/brownie/package.rb', line 32

def create
	data = Hash.from_xml(template)["Package"]	
      	data["PackagingType"]["Code"] = self.package_type
      	data["PackageServiceOptions"]["InsuredValue"]["MonetaryValue"] = self.declared_value.to_s
      	data["PackageWeight"]["Weight"] = self.weight.nil? ? 1.0.to_s : self.weight.to_s
      	data["Dimensions"]["UnitOfMeasurement"]["Code"] = self.unit_of_measurement
      	data["Dimensions"]["Length"] = self.length
      	data["Dimensions"]["Width"] = self.width
      	data["Dimensions"]["Height"] = self.height
  		return data
end