Refactor improvements from Fredrik Wendt; and initial LinkedIn and
[hermes] / package / src / org / maemo / hermes / engine / service.py
1 class Service:
2     """The notional `Service' for a provider. This is responsible for communicating
3        with the backend service and enhancing contacts.
4        
5        Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
6        Released under the Artistic Licence."""
7        
8     def __init__(self):
9         """Should make initial calls to the service and retrieve a list of friends."""
10
11
12     # -----------------------------------------------------------------------
13     def get_name(self):
14         """Should return the same name as the provider class - debugging only - REMOVE/FIXME"""
15         
16         return None
17
18     
19     # -----------------------------------------------------------------------
20     def pre_process_contact(self, contact):
21         """If the contact have an URL (or similar) that proves an existing matching
22            to a friend on this service, then this should be remembered to avoid
23            name collission/mapping the same friend to other contacts with the same 
24            name."""
25          
26         return None
27
28     
29     # -----------------------------------------------------------------------
30     def process_contact(self, contact, friend):
31         """Called for each contact in the address book. Any friends linked to
32            from the contact should have their matching updated. The back end should 
33            enrich the friend passed with any meta-data it can."""
34            
35         pass
36     
37     
38     # -----------------------------------------------------------------------
39     def get_unmatched_friends(self):
40         """Return a list of friends not matched to a contact, or 'None' if manual mapping
41            is not supported."""
42          
43         return None
44
45
46     # -----------------------------------------------------------------------
47     def finalise(self, updated, overwrite = False):
48         """Once all contacts have been processed, allows for any tidy-up/additional
49            enrichment. If any contacts are updated at this stage, 'updated' should
50            be added to."""
51            
52         pass