Method: Magenthor::Customer#initialize

Defined in:
lib/magenthor/customer.rb

#initialize(params = {}) ⇒ Magenthor::Customer

Initialize a new Customer entity

Parameters:

  • params (Hash) (defaults to: {})

    the to save in the instance on initialization



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/magenthor/customer.rb', line 19

def initialize params = {}
    methods.grep(/\w=$/).each do |m|
        send(m, nil)
    end
    params.each do |k, v|
        send("#{k}=", v) if respond_to? "#{k}="
    end
    self.customer_id = params["customer_id"]
    self.increment_id = params["increment_id"]
    self.created_at = params["created_at"]
    self.updated_at = params["updated_at"]
    self.password_hash = params["password_hash"]
    
end