Module: Iugu::APISave

Included in:
Customer, Invoice, PaymentMethod, Plan, Subscription
Defined in:
lib/iugu/api_save.rb

Instance Method Summary collapse

Instance Method Details

#saveObject



3
4
5
6
7
8
9
10
# File 'lib/iugu/api_save.rb', line 3

def save
  copy Iugu::Factory.create_from_response(self.class.object_type, APIRequest.request(is_new? ? "POST" : "PUT", self.class.url(self.attributes), modified_attributes))
  self.errors = nil
  true
rescue Iugu::RequestWithErrors => ex
  self.errors = ex.errors
  false
end