Class: Rack::Payment::BillingAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-payment/billing_address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



5
6
7
# File 'lib/rack-payment/billing_address.rb', line 5

def address1
  @address1
end

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/rack-payment/billing_address.rb', line 5

def city
  @city
end

#countryObject

defaults to ‘US’



24
25
26
# File 'lib/rack-payment/billing_address.rb', line 24

def country
  @country
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/rack-payment/billing_address.rb', line 5

def name
  @name
end

#stateObject

Returns the value of attribute state.



5
6
7
# File 'lib/rack-payment/billing_address.rb', line 5

def state
  @state
end

#zipObject

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_hashObject

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

#addressObject



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_nameObject



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

Returns:

  • (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

#streetObject

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 options
  options.each {|key, value| send "#{key}=", value }
end