Skip to content

Instantly share code, notes, and snippets.

@xgeek-net
Created September 30, 2016 03:43
Show Gist options
  • Save xgeek-net/e33c3baa437e492d5d2a0d48ada828f2 to your computer and use it in GitHub Desktop.
Save xgeek-net/e33c3baa437e492d5d2a0d48ada828f2 to your computer and use it in GitHub Desktop.
SocialApi Type
Contact contact = [SELECT Id, Type__c, AccessToken__c FROM Contact LIMIT 1];
System.assertEquals(contact.Type__c, 'Facebook');
String socialType = contact.Type__c + 'Api';
Type t = Type.forName(socialType);
SocialApi api = (SocialApi)t.newInstance();
String profile = api.getProfile(contact.AccessToken__c);
System.assertEquals(profile, 'https://scontent.xx.fbcdn.net/xxxxxx.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment