class Dhl::Packages

Attributes

packs[RW]

Public Class Methods

new() click to toggle source
# File lib/dhl/packages.rb, line 6
def initialize
  @packs = []
end

Public Instance Methods

add(weight, width, height, length, reference='') click to toggle source
# File lib/dhl/packages.rb, line 10
def add(weight, width, height, length, reference='')
  @packs << Dhl::Package.new(weight, width, height, length, reference)
end
packs_hash() click to toggle source
# File lib/dhl/packages.rb, line 14
def packs_hash
  @packs.map(&:to_hash)
end
to_hash() click to toggle source
# File lib/dhl/packages.rb, line 18
def to_hash
  {
    requested_packages: packs_hash,
    :attributes! => { requested_packages: { number: (1..@packs.size).to_a } }
  }
end