Class: AusPost::DRC::Parcel

Inherits:
Object
  • Object
show all
Defined in:
lib/aus_post/drc/parcel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Parcel

Returns a new instance of Parcel.



10
11
12
13
14
15
# File 'lib/aus_post/drc/parcel.rb', line 10

def initialize(options = {})
  options.each_pair do |key, value|
    real_key = :"#{key}="
    send(real_key, value) if respond_to?(real_key)
  end
end

Instance Attribute Details

#countryObject

Returns the value of attribute country.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def country
  @country
end

#destinationObject

Returns the value of attribute destination.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def destination
  @destination
end

#heightObject

Returns the value of attribute height.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def height
  @height
end

#lengthObject

Returns the value of attribute length.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def length
  @length
end

#pickupObject

Returns the value of attribute pickup.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def pickup
  @pickup
end

#quantityObject

Returns the value of attribute quantity.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def quantity
  @quantity
end

#service_typeObject

Returns the value of attribute service_type.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def service_type
  @service_type
end

#weightObject

Returns the value of attribute weight.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def weight
  @weight
end

#widthObject

Returns the value of attribute width.



7
8
9
# File 'lib/aus_post/drc/parcel.rb', line 7

def width
  @width
end

Instance Method Details

#to_paramsObject



53
54
55
56
57
58
59
# File 'lib/aus_post/drc/parcel.rb', line 53

def to_params
  params = []
  to_params_hash.each_pair do |key, value|
    params << "#{key}=#{value}"
  end
  params.join("&")
end

#to_params_hashObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/aus_post/drc/parcel.rb', line 41

def to_params_hash
  {'Pickup_Postcode'      => self.pickup,
   'Destination_Postcode' => self.destination,
   'Country'              => self.country,
   'Service_Type'         => self.service_type,
   'Weight'               => self.weight,
   'Length'               => self.length,
   'Width'                => self.width,
   'Height'               => self.height,
   'Quantity'             => self.quantity}
end