Class: Recharge::Customer

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/recharge/customer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = '') ⇒ Customer

Returns a new instance of Customer.



30
31
32
# File 'lib/recharge/customer.rb', line 30

def initialize(id='')
  @id = id
end

Class Method Details

.create(attributes = {}, apiKey = nil) ⇒ Object



41
42
43
44
# File 'lib/recharge/customer.rb', line 41

def self.create (attributes = {}, apiKey=nil)
  responseXML = Recharge::Base.post('customers', attributes, apiKey)
  parse(responseXML.to_s)
end

.find(id, apiKey = nil) ⇒ Object



37
38
39
40
# File 'lib/recharge/customer.rb', line 37

def self.find (id, apiKey=nil)
  responseXML = Recharge::Base.get('customers/'+id, apiKey)
  parse(responseXML.to_s)
end

.find_all(apiKey = nil) ⇒ Object



33
34
35
36
# File 'lib/recharge/customer.rb', line 33

def self.find_all (apiKey=nil)
  responseXML = Recharge::Base.get('customers', apiKey)
  parse(responseXML.to_s)
end

Instance Method Details

#destroy(apiKey = nil) ⇒ Object



49
50
51
# File 'lib/recharge/customer.rb', line 49

def destroy (apiKey=nil)
  responseXML = Recharge::Base.delete('customers/'+self.id, apiKey)
end

#update(attributes = {}, apiKey = nil) ⇒ Object



45
46
47
48
# File 'lib/recharge/customer.rb', line 45

def update (attributes = {}, apiKey=nil)
  responseXML = Recharge::Base.post('customers/'+self.id, attributes, apiKey)
  Customer.parse(responseXML.to_s)
end