Class: Iugu::Customer

Inherits:
APIResource show all
Includes:
APICreate, APIDelete, APIFetch, APISave
Defined in:
lib/iugu/customer.rb

Instance Attribute Summary

Attributes inherited from Object

#errors

Instance Method Summary collapse

Methods included from APIDelete

#delete

Methods included from APISave

#save

Methods included from APICreate

included

Methods included from APIFetch

included, #refresh

Methods inherited from APIResource

#is_new?, url

Methods inherited from Object

#add_accessor, #attributes, #copy, #initialize, #method_missing, #modified_attributes, #set_attributes

Constructor Details

This class inherits a constructor from Iugu::Object

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Iugu::Object

Instance Method Details

#default_payment_methodObject



16
17
18
19
# File 'lib/iugu/customer.rb', line 16

def default_payment_method
  return false unless @attributes['default_payment_method_id']
  PaymentMethod.fetch({ id: @attributes['default_payment_method_id'], customer_id: self.id })
end

#invoicesObject



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

def invoices
  APIChildResource.new({ customer_id: self.id }, Iugu::Invoice)
end

#payment_methodsObject



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

def payment_methods
  APIChildResource.new({ customer_id: self.id }, Iugu::PaymentMethod)
end