Class: Slipmate::Customer
- Inherits:
-
Object
- Object
- Slipmate::Customer
- Defined in:
- lib/slipmate/customer.rb
Instance Attribute Summary collapse
-
#address_1 ⇒ Object
Returns the value of attribute address_1.
-
#address_2 ⇒ Object
Returns the value of attribute address_2.
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#state ⇒ Object
Returns the value of attribute state.
-
#tld ⇒ Object
Returns the value of attribute tld.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Customer
constructor
A new instance of Customer.
- #serialize ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Customer
Returns a new instance of Customer.
17 18 19 20 21 |
# File 'lib/slipmate/customer.rb', line 17 def initialize(attributes={}) attributes.reverse_merge! :tld => "USA" attributes.stringify_keys! attributes.each_pair{|key,value| send("#{key}=", value) if self.respond_to? "#{key}=" } end |
Instance Attribute Details
#address_1 ⇒ Object
Returns the value of attribute address_1.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def address_1 @address_1 end |
#address_2 ⇒ Object
Returns the value of attribute address_2.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def address_2 @address_2 end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def company @company end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def last_name @last_name end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def phone @phone end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def state @state end |
#tld ⇒ Object
Returns the value of attribute tld.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def tld @tld end |
#zip ⇒ Object
Returns the value of attribute zip.
3 4 5 |
# File 'lib/slipmate/customer.rb', line 3 def zip @zip end |
Instance Method Details
#serialize ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/slipmate/customer.rb', line 23 def serialize h={} self.instance_variables.each do |variab| h[variab[1..-1].to_sym] = self.instance_variable_get(variab) end h end |