Class: Magento::Customer

Inherits:
Abstract show all
Defined in:
lib/customer.rb

Instance Attribute Summary

Attributes inherited from Abstract

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

commit, connect, first, #method_missing, #object_attributes=

Constructor Details

#initializeCustomer

Returns a new instance of Customer.



7
8
9
# File 'lib/customer.rb', line 7

def initialize
  connect
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Magento::Abstract

Class Method Details

.create(*args) ⇒ Object



26
27
28
29
# File 'lib/customer.rb', line 26

def self.create(*args)
  connect
  @connection.call("customer.create",args)
end

.delete(customer_id = nil) ⇒ Object

Raises:



31
32
33
34
35
# File 'lib/customer.rb', line 31

def self.delete(customer_id = nil)
  raise CustomerException, "Invalid customer id" if customer_id.nil?
  connect
  @connection.call("customer.delete",customer_id)
end

.find(*args) ⇒ Object



11
12
13
14
# File 'lib/customer.rb', line 11

def self.find(*args)
  connect
  @connection.call("customer.info",args)
end

.list(*args) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/customer.rb', line 16

def self.list(*args)
  connect
  customers = @connection.call("customer.list",args)
  customer_list = []
  customers.each do |customer|
    customer_list.push(customer.to_struct(self.class.to_s))
  end
  customer_list
end