Class: UpsPickup::Address

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

Direct Known Subclasses

PickupAddress

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Address

Returns a new instance of Address.



6
7
8
9
10
11
12
13
14
# File 'lib/ups_pickup/address.rb', line 6

def initialize(options={})
  options ||={}
  @address_line = options[:address_line]
  @city = options[:city]
  @state = options[:state]
  @postal_code = options[:postal_code]
  #@country = options[:country_code]
  @country_code = options[:country_code] || "US"
end

Instance Attribute Details

#address_lineObject

Returns the value of attribute address_line.



5
6
7
# File 'lib/ups_pickup/address.rb', line 5

def address_line
  @address_line
end

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/ups_pickup/address.rb', line 5

def city
  @city
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/ups_pickup/address.rb', line 5

def country
  @country
end

#country_codeObject

Returns the value of attribute country_code.



5
6
7
# File 'lib/ups_pickup/address.rb', line 5

def country_code
  @country_code
end

#postal_codeObject

Returns the value of attribute postal_code.



5
6
7
# File 'lib/ups_pickup/address.rb', line 5

def postal_code
  @postal_code
end

#stateObject

Returns the value of attribute state.



5
6
7
# File 'lib/ups_pickup/address.rb', line 5

def state
  @state
end

Instance Method Details

#to_ups_hashObject



16
17
18
19
20
21
22
23
24
# File 'lib/ups_pickup/address.rb', line 16

def to_ups_hash
  {
  "ns2:AddressLine"=>@address_line,
  "ns2:City"=>@city,
  "ns2:StateProvince"=>@state,
  "ns2:PostalCode"=>@postal_code,
  "ns2:CountryCode"=>@country_code
  }
end