Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed properly some methods and variables related to new user synch…

…ronization.
  • Loading branch information...
commit 30f0e84efa0289ca77ba8883e1752455e67306ab 1 parent 3c01977
@amartinfraguas amartinfraguas authored
View
18 lib/api_operations/contacts.rb
@@ -25,27 +25,27 @@ def self.synchronize_account(account, new_user_maps)
COMPLEX_CONVERSIONS = [:im,:website,:address]
- def self.synchronize_account_process(account, user_map)
+ def self.synchronize_account_process(account, new_user_map)
# if there is a new user map
- if user_map
- ApiOperations::Common.log(:debug,nil,"Started contact synchronization of the new user map with id = " + user_map.id.to_s + " and account with id = " + account.id.to_s)
+ if new_user_map
+ ApiOperations::Common.log(:debug,nil,"Started contact synchronization of the new user map with id = " + new_user_map.id.to_s + " and account with id = " + account.id.to_s)
begin
# get the feed of all contacts for this new user map of this Ringio account from Ringio
- user_rg_feed = self.fetch_individual_user_rg_feed user_map
+ user_rg_feed = self.fetch_individual_new_user_rg_feed new_user_map
# as it is the first synchronization for this user map, we are not interested in deleted contacts
rg_deleted_contact_ids = []
rescue Exception => e
- ApiOperations::Common.log(:error,e,"\nProblem fetching the contacts of the new user map with id = " + user_map.id.to_s + " and account with id = " + account.id.to_s)
+ ApiOperations::Common.log(:error,e,"\nProblem fetching the contacts of the new user map with id = " + new_user_map.id.to_s + " and account with id = " + account.id.to_s)
end
begin
- self.synchronize_user(true,user_map,user_rg_feed,rg_deleted_contact_ids)
+ self.synchronize_user(true,new_user_map,user_rg_feed,rg_deleted_contact_ids)
rescue Exception => e
- ApiOperations::Common.log(:error,e,"\nProblem synchronizing the contacts of the new user map with id = " + um.id.to_s)
+ ApiOperations::Common.log(:error,e,"\nProblem synchronizing the contacts of the new user map with id = " + new_user_map.id.to_s)
end
- ApiOperations::Common.log(:debug,nil,"Finished contact synchronization of the new user map with id = " + user_map.id.to_s + " and account with id = " + account.id.to_s)
+ ApiOperations::Common.log(:debug,nil,"Finished contact synchronization of the new user map with id = " + new_user_map.id.to_s + " and account with id = " + account.id.to_s)
else
begin
# get the feed of changed contacts per user of this Ringio account from Ringio
@@ -127,7 +127,7 @@ def self.fetch_user_rg_feeds(account_rg_feed, account)
end
# behaves like self.fetch_user_rg_feeds but just for the element of the array for this user map
- def self.fetch_individual_user_rg_feed(user_map)
+ def self.fetch_individual_new_user_rg_feed(user_map)
updated_rg_contacts = user_map.all_rg_contacts_feed.updated.inject([]) do |u_rg_contacts,rg_contact_id|
rg_contact = RingioAPI::Contact.find rg_contact_id
View
20 lib/api_operations/notes.rb
@@ -41,27 +41,27 @@ def self.remove_subject_name(hr_note)
private
- def self.synchronize_account_process(account, user_map)
+ def self.synchronize_account_process(account, new_user_map)
# if there is a new user map
- if user_map
- ApiOperations::Common.log(:debug,nil,"Started note synchronization for the new user map with id = " + user_map.id.to_s + " of the account with id = " + account.id.to_s)
+ if new_user_map
+ ApiOperations::Common.log(:debug,nil,"Started note synchronization for the new user map with id = " + new_user_map.id.to_s + " of the account with id = " + account.id.to_s)
begin
# get the feed of changed notes per contact of this new user map
- user_feed = self.fetch_individual_user_feed user_map
+ user_feed = self.fetch_individual_new_user_feed new_user_map
# as it is the first synchronization for this user map, we are not interested in deleted notes
rg_deleted_notes_ids = []
rescue Exception => e
- ApiOperations::Common.log(:error,e,"\nProblem fetching the changed notes for the new user map with id = " + user_map.id.to_s + " of the account with id = " + account.id.to_s)
+ ApiOperations::Common.log(:error,e,"\nProblem fetching the changed notes for the new user map with id = " + new_user_map.id.to_s + " of the account with id = " + account.id.to_s)
end
begin
- self.synchronize_user user_feed
+ self.synchronize_new_user user_feed
rescue Exception => e
- ApiOperations::Common.log(:error,e,"\nProblem synchronizing the notes of the new user map with id = " + user_map.id.to_s)
+ ApiOperations::Common.log(:error,e,"\nProblem synchronizing the notes of the new user map with id = " + new_user_map.id.to_s)
end
- ApiOperations::Common.log(:debug,nil,"Finished note synchronization for the new user map with id = " + user_map.id.to_s + " of the account with id = " + account.id.to_s)
+ ApiOperations::Common.log(:debug,nil,"Finished note synchronization for the new user map with id = " + new_user_map.id.to_s + " of the account with id = " + account.id.to_s)
else
begin
# get the feed of changed notes per contact of this Ringio account
@@ -78,7 +78,7 @@ def self.synchronize_account_process(account, user_map)
end
- def self.synchronize_user(user_feed)
+ def self.synchronize_new_user(user_feed)
begin
user_map = user_feed[0]
if user_map
@@ -162,7 +162,7 @@ def self.synchronize_contacts(account, user_feeds, rg_deleted_notes_ids)
# behaves like self.fetch_user_rg_feeds but just for the element of the array for this user map
- def self.fetch_individual_user_feed(user_map)
+ def self.fetch_individual_new_user_feed(user_map)
# get updated notes from Ringio
user_feed = user_map.account.all_rg_notes_feed.updated.inject([user_map,[]]) do |user_feed,rg_note_id|
rg_note = RingioAPI::Note.find rg_note_id
View
26 lib/api_operations/rings.rb
@@ -27,18 +27,18 @@ def self.synchronize_account(account, new_user_maps)
private
- def self.synchronize_account_process(account, user_map)
+ def self.synchronize_account_process(account, new_user_map)
# if there is a new user map
- if user_map
- ApiOperations::Common.log(:debug,nil,"Started ring synchronization for the new user map with id = " + user_map.id.to_s + " of the account with id = " + account.id.to_s)
+ if new_user_map
+ ApiOperations::Common.log(:debug,nil,"Started ring synchronization for the new user map with id = " + new_user_map.id.to_s + " of the account with id = " + account.id.to_s)
begin
# get the feed of changed rings per contact of this new user map from Ringio,
# we will not check for deleted rings, because they cannot be deleted
account_rg_feed = account.all_rg_rings_feed
- contact_rg_feeds = self.fetch_contact_rg_feeds(user_map,account_rg_feed,account)
+ contact_rg_feeds = self.fetch_contact_rg_feeds(new_user_map,account_rg_feed,account)
rescue Exception => e
- ApiOperations::Common.log(:error,e,"\nProblem fetching the changed rings for the new user map with id = " + user_map.id.to_s + " of the account with id = " + account.id.to_s)
+ ApiOperations::Common.log(:error,e,"\nProblem fetching the changed rings for the new user map with id = " + new_user_map.id.to_s + " of the account with id = " + account.id.to_s)
end
else
begin
@@ -54,8 +54,8 @@ def self.synchronize_account_process(account, user_map)
self.synchronize_contacts contact_rg_feeds
- if user_map
- ApiOperations::Common.log(:debug,nil,"Finished ring synchronization for the new user map with id = " + user_map.id.to_s + " of the account with id = " + account.id.to_s)
+ if new_user_map
+ ApiOperations::Common.log(:debug,nil,"Finished ring synchronization for the new user map with id = " + new_user_map.id.to_s + " of the account with id = " + account.id.to_s)
end
end
@@ -110,14 +110,14 @@ def self.synchronize_contacts(contact_rg_feeds)
# [0] => contact map
# [1] => updated Ringio rings for this contact map
# we will choose the author of the ring event note in Highrise as the owner of the contact
- def self.fetch_contact_rg_feeds(user_map, account_rg_feed, account)
+ def self.fetch_contact_rg_feeds(new_user_map, account_rg_feed, account)
account_rg_feed.updated.inject([]) do |contact_feeds,rg_ring_id|
rg_ring = RingioAPI::Ring.find rg_ring_id
if rg_ring.attributes['from_type'].present? && rg_ring.from_type == 'contact'
- self.process_rg_ring_new_user_map(user_map,rg_ring.from_id,contact_feeds,rg_ring,account)
+ self.process_rg_ring_user_map(new_user_map,rg_ring.from_id,contact_feeds,rg_ring,account)
elsif rg_ring.attributes['to_type'].present? && rg_ring.to_type == 'contact'
- self.process_rg_ring_new_user_map(user_map,rg_ring.to_id,contact_feeds,rg_ring,account)
+ self.process_rg_ring_user_map(new_user_map,rg_ring.to_id,contact_feeds,rg_ring,account)
end
contact_feeds
@@ -125,10 +125,10 @@ def self.fetch_contact_rg_feeds(user_map, account_rg_feed, account)
end
- def self.process_rg_ring_new_user_map(user_map, rg_contact_id, contact_feeds, rg_ring, account)
+ def self.process_rg_ring_user_map(new_user_map, rg_contact_id, contact_feeds, rg_ring, account)
# synchronize only notes of contacts already mapped for this account
- if user_map
- if (cm = ContactMap.find_by_user_map_id_and_rg_contact_id(user_map.id,rg_contact_id))
+ if new_user_map
+ if (cm = ContactMap.find_by_user_map_id_and_rg_contact_id(new_user_map.id,rg_contact_id))
self.process_rg_ring(cm,contact_feeds,rg_ring)
end
else
Please sign in to comment.
Something went wrong with that request. Please try again.