Class: Slipmate::Customer

Inherits:
Object
  • Object
show all
Defined in:
lib/slipmate/customer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_1Object

Returns the value of attribute address_1.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def address_1
  @address_1
end

#address_2Object

Returns the value of attribute address_2.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def address_2
  @address_2
end

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def city
  @city
end

#companyObject

Returns the value of attribute company.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def company
  @company
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def last_name
  @last_name
end

#phoneObject

Returns the value of attribute phone.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def phone
  @phone
end

#stateObject

Returns the value of attribute state.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def state
  @state
end

#tldObject

Returns the value of attribute tld.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def tld
  @tld
end

#zipObject

Returns the value of attribute zip.



3
4
5
# File 'lib/slipmate/customer.rb', line 3

def zip
  @zip
end

Instance Method Details

#serializeObject



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