Class: LabelMe::Order::Customer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row) ⇒ Customer

Returns a new instance of Customer.



4
5
6
7
8
9
10
11
# File 'lib/label_me/order/customer.rb', line 4

def initialize(row)
  @number       = row.customer_id.to_i
  @name         = row.customer_name
  @email        = row.customer_email
  @phone_number = row.customer_phone_number
  @address      = row.customer_address
  @postal_code  = row.customer_postal_code
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



17
18
19
# File 'lib/label_me/order/customer.rb', line 17

def address
  @address
end

#emailObject

Returns the value of attribute email.



15
16
17
# File 'lib/label_me/order/customer.rb', line 15

def email
  @email
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/label_me/order/customer.rb', line 14

def name
  @name
end

#numberObject

Returns the value of attribute number.



13
14
15
# File 'lib/label_me/order/customer.rb', line 13

def number
  @number
end

#phone_numberObject

Returns the value of attribute phone_number.



16
17
18
# File 'lib/label_me/order/customer.rb', line 16

def phone_number
  @phone_number
end

#postal_codeObject

Returns the value of attribute postal_code.



18
19
20
# File 'lib/label_me/order/customer.rb', line 18

def postal_code
  @postal_code
end

Instance Method Details

#===(other) ⇒ Object



31
32
33
# File 'lib/label_me/order/customer.rb', line 31

def ===(other)
  self.number == other.number
end

#to_hashObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/label_me/order/customer.rb', line 20

def to_hash
  {
    number:       number,
    name:         name,
    email:        email,
    phone_number: phone_number,
    address:      address,
    postal_code:  postal_code
  }
end