module Iugu::APICreate::ClassMethods

Public Instance Methods

create(attributes = {}) click to toggle source
# File lib/iugu/api_create.rb, line 4
def create(attributes = {})
  Iugu::Factory.create_from_response self.object_type,  APIRequest.request("POST", self.url(attributes), attributes)
rescue Iugu::RequestWithErrors => ex
  obj = self.new
  obj.set_attributes attributes, true
  obj.errors = ex.errors
  obj
end