Class: AusPost::DRC::Parcel
- Inherits:
-
Object
- Object
- AusPost::DRC::Parcel
- Defined in:
- lib/aus_post/drc/parcel.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
Returns the value of attribute country.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#height ⇒ Object
Returns the value of attribute height.
-
#length ⇒ Object
Returns the value of attribute length.
-
#pickup ⇒ Object
Returns the value of attribute pickup.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#service_type ⇒ Object
Returns the value of attribute service_type.
-
#weight ⇒ Object
Returns the value of attribute weight.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Parcel
constructor
A new instance of Parcel.
- #to_params ⇒ Object
- #to_params_hash ⇒ Object
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( = {}) .each_pair do |key, value| real_key = :"#{key}=" send(real_key, value) if respond_to?(real_key) end end |
Instance Attribute Details
#country ⇒ Object
Returns the value of attribute country.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def country @country end |
#destination ⇒ Object
Returns the value of attribute destination.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def destination @destination end |
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def height @height end |
#length ⇒ Object
Returns the value of attribute length.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def length @length end |
#pickup ⇒ Object
Returns the value of attribute pickup.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def pickup @pickup end |
#quantity ⇒ Object
Returns the value of attribute quantity.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def quantity @quantity end |
#service_type ⇒ Object
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 |
#weight ⇒ Object
Returns the value of attribute weight.
7 8 9 |
# File 'lib/aus_post/drc/parcel.rb', line 7 def weight @weight end |
#width ⇒ Object
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_params ⇒ Object
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_hash ⇒ Object
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 |