Created
September 29, 2015 00:48
-
-
Save apotema/b0f210eed1541c1db65b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fellow Procorians, | |
I have spent part of my time working on the Quickbooks and on the HH2 system. | |
I have seen some points of improvement on the SAGE integration, one of them is related to repeated | |
code to access to the HH2 system. All along the code we can see this code to access the Hh2 systemm. | |
commitment_change_order_conversation.rb | |
```ruby | |
def flush_hh2_cco_queue(origin_id) | |
retry_cntr ||= 1 | |
RestClient.post(flush_hh2_cco_url(origin_id), nil, { cookies: account.cookie, content_type: "application/json" }) | |
rescue RestClient::RequestTimeout => e | |
if (retry_cntr -= 1) > 0 | |
sleep HH2_TIMEOUT_RETRY_INTERVAL | |
retry | |
else | |
Hh2::Integration::SyncEventResponse.new(account).error(sync_event_id, cco_params[:procore_cco_id], 'ChangeOrderPackage', e) | |
end | |
rescue RestClient::Exception => e | |
Hh2::Integration::SyncEventResponse.new(account).error(sync_event_id, cco_params[:procore_cco_id], 'ChangeOrderPackage', e) | |
end | |
``` | |
commitment_conversation.rb | |
```ruby | |
def flush_hh2_queue(origin_id) | |
retry_cntr ||= 1 | |
RestClient.post(flush_hh2_url(origin_id), nil, { cookies: account.cookie, content_type: "application/json" }) | |
rescue RestClient::RequestTimeout => e | |
if (retry_cntr -= 1) > 0 | |
sleep HH2_TIMEOUT_RETRY_INTERVAL | |
retry | |
else | |
Hh2::Integration::SyncEventResponse.new(account).error(sync_event_id, commitment_params[:procore_commitment_id], 'Contract', e) | |
end | |
rescue RestClient::Exception => e | |
Hh2::Integration::SyncEventResponse.new(account).error(sync_event_id, commitment_params[:procore_commitment_id], 'Contract', e) | |
end | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment