Class: UpsPickup::Address
- Inherits:
-
Object
- Object
- UpsPickup::Address
- Defined in:
- lib/ups_pickup/address.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address_line ⇒ Object
Returns the value of attribute address_line.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Address
constructor
A new instance of Address.
- #to_ups_hash ⇒ Object
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(={}) ||={} @address_line = [:address_line] @city = [:city] @state = [:state] @postal_code = [:postal_code] #@country = options[:country_code] @country_code = [:country_code] || "US" end |
Instance Attribute Details
#address_line ⇒ Object
Returns the value of attribute address_line.
5 6 7 |
# File 'lib/ups_pickup/address.rb', line 5 def address_line @address_line end |
#city ⇒ Object
Returns the value of attribute city.
5 6 7 |
# File 'lib/ups_pickup/address.rb', line 5 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
5 6 7 |
# File 'lib/ups_pickup/address.rb', line 5 def country @country end |
#country_code ⇒ Object
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_code ⇒ Object
Returns the value of attribute postal_code.
5 6 7 |
# File 'lib/ups_pickup/address.rb', line 5 def postal_code @postal_code end |
#state ⇒ Object
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_hash ⇒ Object
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 |