Class: UpsPickup::PickupAddress

Inherits:
Address
  • Object
show all
Defined in:
lib/ups_pickup/address.rb

Constant Summary collapse

ADDRESS_TYPES =
{:residential=>"Y",:commercial=>"N"}

Instance Attribute Summary collapse

Attributes inherited from Address

#address_line, #city, #country, #country_code, #postal_code, #state

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PickupAddress

Returns a new instance of PickupAddress.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ups_pickup/address.rb', line 30

def initialize(options={})
  super(options)
  @company_name =options[:company_name]
  @contact_name = options[:contact_name]
  @room = options[:room]
  @floor = options[:floor]
  @residential_indicator = options[:residential_indicator] || "N" #ADDRESS_TYPES[options[:type]]
  @pickup_point = options[:pickup_point]
  @phone_number = options[:phone_number]
  @extension = options[:extension]

end

Instance Attribute Details

#company_nameObject

Returns the value of attribute company_name.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def company_name
  @company_name
end

#contact_nameObject

Returns the value of attribute contact_name.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def contact_name
  @contact_name
end

#extensionObject

Returns the value of attribute extension.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def extension
  @extension
end

#floorObject

Returns the value of attribute floor.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def floor
  @floor
end

#phone_numberObject

Returns the value of attribute phone_number.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def phone_number
  @phone_number
end

#pickup_pointObject

Returns the value of attribute pickup_point.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def pickup_point
  @pickup_point
end

#residential_indicatorObject

Returns the value of attribute residential_indicator.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def residential_indicator
  @residential_indicator
end

#roomObject

Returns the value of attribute room.



29
30
31
# File 'lib/ups_pickup/address.rb', line 29

def room
  @room
end

Instance Method Details

#to_ups_hashObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ups_pickup/address.rb', line 42

def to_ups_hash
  {
    "ns2:CompanyName"=>@company_name,
    "ns2:ContactName"=>@contact_name, 
    "ns2:AddressLine"=>@address_line,
    "ns2:Floor"=>@floor,
    "ns2:Room"=>@room,
    "ns2:City"=>@city,
    "ns2:StateProvince"=>@state,
    "ns2:PostalCode"=>@postal_code,
    "ns2:CountryCode"=>@country_code,
    "ns2:ResidentialIndicator"=>@residential_indicator,
    "ns2:PickupPoint"=>@pickup_point,
    "ns2:Phone"=>{
      "ns2:Number"=>@phone_number,
      "ns2:Extension"=>@extension
    }

  }
end