Update customer.rb

This commit is contained in:
2016-05-11 14:12:08 -04:00
parent 0c2a5c0297
commit 12a6bb575c

View File

@@ -137,26 +137,26 @@ class Customer < ActiveRecord::Base
# Push the updates # Push the updates
def push def push
begin # begin
#tries ||= 3 #tries ||= 3
@details = Qbo.get_base(:customer).service.update(@details) @details = Qbo.get_base(:customer).service.update(@details)
rescue Exception => e # rescue Exception => e
#retry unless (tries -= 1).zero? #retry unless (tries -= 1).zero?
errors.add(e.message) # errors.add(e.message)
end # end
end end
# Creates a new qbo customer and aquires ID number # Creates a new qbo customer and aquires ID number
def create_customer def create_customer
if new_record? if new_record?
begin # begin
#tries ||= 3 #tries ||= 3
@details = Qbo.get_base(:customer).service.create(@details) @details = Qbo.get_base(:customer).service.create(@details)
self.id = @details.id self.id = @details.id
rescue Exception => e # rescue Exception => e
#retry unless (tries -= 1).zero? #retry unless (tries -= 1).zero?
errors.add(:id, e.message) errors.add(:id, e.message)
end #end
end end
end end
end end