Class: Rack::Payment::BillingAddress
- Inherits:
-
Object
- Object
- Rack::Payment::BillingAddress
- Defined in:
- lib/rack-payment/billing_address.rb
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Returns the value of attribute address1.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
defaults to ‘US’.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#active_merchant_hash ⇒ Object
Returns a hash that can be passed to a Gateway#authorize call.
- #address ⇒ Object
- #address=(value) ⇒ Object
- #full_name ⇒ Object
- #full_name=(value) ⇒ Object
- #partially_filled_out? ⇒ Boolean
-
#street ⇒ Object
Aliases.
- #street=(value) ⇒ Object
- #update(options) ⇒ Object
Instance Attribute Details
#address1 ⇒ Object
Returns the value of attribute address1.
5 6 7 |
# File 'lib/rack-payment/billing_address.rb', line 5 def address1 @address1 end |
#city ⇒ Object
Returns the value of attribute city.
5 6 7 |
# File 'lib/rack-payment/billing_address.rb', line 5 def city @city end |
#country ⇒ Object
defaults to ‘US’
24 25 26 |
# File 'lib/rack-payment/billing_address.rb', line 24 def country @country end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/rack-payment/billing_address.rb', line 5 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/rack-payment/billing_address.rb', line 5 def state @state end |
#zip ⇒ Object
Returns the value of attribute zip.
5 6 7 |
# File 'lib/rack-payment/billing_address.rb', line 5 def zip @zip end |
Instance Method Details
#[](key) ⇒ Object
7 8 9 |
# File 'lib/rack-payment/billing_address.rb', line 7 def [] key send key end |
#active_merchant_hash ⇒ Object
Returns a hash that can be passed to a Gateway#authorize call
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rack-payment/billing_address.rb', line 40 def active_merchant_hash { :name => name, :address1 => street, :city => city, :state => state, :country => country, :zip => zip } end |
#address ⇒ Object
33 |
# File 'lib/rack-payment/billing_address.rb', line 33 def address() address1 end |
#address=(value) ⇒ Object
34 |
# File 'lib/rack-payment/billing_address.rb', line 34 def address=(value) self.address1=(value) end |
#full_name ⇒ Object
36 |
# File 'lib/rack-payment/billing_address.rb', line 36 def full_name() name end |
#full_name=(value) ⇒ Object
37 |
# File 'lib/rack-payment/billing_address.rb', line 37 def full_name=(value) self.name=(value) end |
#partially_filled_out? ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/rack-payment/billing_address.rb', line 15 def partially_filled_out? %w( name address1 city state zip ).each do |field| return true unless send(field).nil? end return false end |
#street ⇒ Object
Aliases
30 |
# File 'lib/rack-payment/billing_address.rb', line 30 def street() address1 end |
#street=(value) ⇒ Object
31 |
# File 'lib/rack-payment/billing_address.rb', line 31 def street=(value) self.address1=(value) end |
#update(options) ⇒ Object
11 12 13 |
# File 'lib/rack-payment/billing_address.rb', line 11 def update .each {|key, value| send "#{key}=", value } end |