Class: PayTrace::Address
- Inherits:
-
Object
- Object
- PayTrace::Address
- Defined in:
- lib/paytrace/address.rb
Instance Attribute Summary collapse
-
#address_type ⇒ Object
Returns the value of attribute address_type.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#name ⇒ Object
Returns the value of attribute name.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#region ⇒ Object
Returns the value of attribute region.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
-
#street2 ⇒ Object
Returns the value of attribute street2.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Address
constructor
A new instance of Address.
- #set_request(request) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Address
Returns a new instance of Address.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/paytrace/address.rb', line 5 def initialize(={}) @name = [:name] @street = [:street] @street2 = [:street2] @city = [:city] @state = [:state] @country = [:country] @postal_code = [:postal_code ] @address_type = [:address_type] || :billing @region = [:region] if @address_type == :shipping # special case for shipping addresses end |
Instance Attribute Details
#address_type ⇒ Object
Returns the value of attribute address_type.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def address_type @address_type end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def country @country end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def name @name end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def postal_code @postal_code end |
#region ⇒ Object
Returns the value of attribute region.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def region @region end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def street @street end |
#street2 ⇒ Object
Returns the value of attribute street2.
3 4 5 |
# File 'lib/paytrace/address.rb', line 3 def street2 @street2 end |
Instance Method Details
#set_request(request) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/paytrace/address.rb', line 17 def set_request(request) atype_str = address_type.to_s request.set_param(:"#{atype_str}_name", name) if name request.set_param(:"#{atype_str}_address", street) if street request.set_param(:"#{atype_str}_address2", street2) if street2 request.set_param(:"#{atype_str}_city", city) if city request.set_param(:"#{atype_str}_region", region) if region request.set_param(:"#{atype_str}_state", state) if state request.set_param(:"#{atype_str}_postal_code", postal_code) if postal_code request.set_param(:"#{atype_str}_country", country) if country end |