Class: Shipping::Pickup

Inherits:
Object
  • Object
show all
Defined in:
lib/ups_shipping/pickup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Pickup

Returns a new instance of Pickup.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ups_shipping/pickup.rb', line 7

def initialize(options={})
  @type = options[:type]
  if options[:pickup_day]
    @pickup_day = options[:pickup_day]
  end
  if options[:contact_method]
    @contact_method = options[:contact_method]
  end

  @pickupTypes = {
      "01" => "Daily Pickup",
      "03" => "Customer Counter",
      "06" => "One Time Pickup",
      "07" => "On Call Air",
      "19" => "Letter Center",
      "20" => "Air Service Center"
  }
end

Instance Attribute Details

#address_linesObject

Returns the value of attribute address_lines.



5
6
7
# File 'lib/ups_shipping/pickup.rb', line 5

def address_lines
  @address_lines
end

#contact_methodObject

Returns the value of attribute contact_method.



5
6
7
# File 'lib/ups_shipping/pickup.rb', line 5

def contact_method
  @contact_method
end

#pickup_dayObject

Returns the value of attribute pickup_day.



5
6
7
# File 'lib/ups_shipping/pickup.rb', line 5

def pickup_day
  @pickup_day
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/ups_shipping/pickup.rb', line 5

def type
  @type
end

Instance Method Details

#build_schedule(xml) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ups_shipping/pickup.rb', line 26

def build_schedule(xml)
  xml.OnCallAir {
    xml.Schedule {
      if @pickup_day
        xml.PickupDay @pickup_day
      end
      if @contact_method
        xml.Method @contact_method
      end
    }
  }
end

#build_type(xml) ⇒ Object



39
40
41
42
43
44
# File 'lib/ups_shipping/pickup.rb', line 39

def build_type(xml)
  xml.PickupType {
    xml.Code type
    xml.Description @pickupTypes[type]
  }
end