Class: SagePay::Server::Address

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, Validators
Defined in:
lib/sage_pay/server/address.rb

Constant Summary

Constants included from Validators

Validators::ADDRESS_FORMAT, Validators::COUNTRY_OPTIONS, Validators::EMAIL_FORMAT, Validators::NAME_FORMAT, Validators::PHONE_FORMAT, Validators::POST_CODE_FORMAT, Validators::US_STATE_OPTIONS, Validators::VENDOR_NAME_FORMAT, Validators::VENDOR_TX_CODE_FORMAT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Address

Returns a new instance of Address.



39
40
41
42
43
# File 'lib/sage_pay/server/address.rb', line 39

def initialize(attributes = {})
  attributes.each do |k, v|
    send("#{k}=", v)
  end
end

Instance Attribute Details

#address_1Object

Returns the value of attribute address_1.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def address_1
  @address_1
end

#address_2Object

Returns the value of attribute address_2.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def address_2
  @address_2
end

#cityObject

Returns the value of attribute city.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def city
  @city
end

#countryObject

Returns the value of attribute country.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def country
  @country
end

#first_namesObject

Returns the value of attribute first_names.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def first_names
  @first_names
end

#phoneObject

Returns the value of attribute phone.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def phone
  @phone
end

#post_codeObject

Returns the value of attribute post_code.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def post_code
  @post_code
end

#stateObject

Returns the value of attribute state.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def state
  @state
end

#surnameObject

Returns the value of attribute surname.



7
8
9
# File 'lib/sage_pay/server/address.rb', line 7

def surname
  @surname
end

Instance Method Details

#in_us?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/sage_pay/server/address.rb', line 45

def in_us?
  country == "US"
end