Skip to content

Commit

Permalink
using current uuid if last response does not have location header
Browse files Browse the repository at this point in the history
  • Loading branch information
Celestino Gomes committed Apr 3, 2014
1 parent c1186e4 commit e4fb397
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/charging/charge_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def invalid_domain?
end

def reload_attributes!
new_charge_account = self.class.find_by_uuid(domain, Helpers.extract_uuid(last_response.headers[:location]))
new_charge_account = self.class.find_by_uuid(domain, Helpers.extract_uuid(last_response.headers[:location]) || uuid)

(ATTRIBUTES + COMMON_ATTRIBUTES + READ_ONLY_ATTRIBUTES).each do |attribute|
instance_variable_set "@#{attribute}", new_charge_account.send(attribute)
Expand Down
2 changes: 1 addition & 1 deletion lib/charging/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def self.load_persisted_domain(attributes, response, account = nil) # :nodoc:
private

def reload_attributes!
new_domain = self.class.find_by_uuid(account, Helpers.extract_uuid(last_response.headers[:location]))
new_domain = self.class.find_by_uuid(account, Helpers.extract_uuid(last_response.headers[:location]) || uuid)

(COMMON_ATTRIBUTES + READ_ONLY_ATTRIBUTES).each do |attribute|
instance_variable_set "@#{attribute}", new_domain.send(attribute)
Expand Down
2 changes: 1 addition & 1 deletion lib/charging/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create!
Invoice.post_charge_accounts_invoices(domain, charge_account, attributes)
end

reload_attributes!(Helpers.extract_uuid(last_response.headers[:location]))
reload_attributes!(Helpers.extract_uuid(last_response.headers[:location]) || uuid)
end

# Deletes the invoice at API
Expand Down

0 comments on commit e4fb397

Please sign in to comment.