diff --git a/src/classes/XeroAccountingApi.cls b/src/classes/XeroAccountingApi.cls
index 551be92..8fd9775 100644
--- a/src/classes/XeroAccountingApi.cls
+++ b/src/classes/XeroAccountingApi.cls
@@ -31,6 +31,33 @@ public with sharing class XeroAccountingApi {
return xeroContacts;
}
+ /**
+ * @author Ben Edwards (ben@benedwards.co.nz)
+ * @description Method to return ALL contacts for your Xero environment
+ * @return List of Xero Contact wrapper classes
+ **/
+ public static XeroContact getContact (String xeroContactId) {
+
+ XeroContact xeroContact = new XeroContact();
+
+ // Execute the callout to the Contacts resource
+ HttpResponse response = XeroCalloutUtility.executeCallout('GET', 'Contacts/' + xeroContactId, null);
+
+ // If successful response
+ if (response.getStatusCode() == 200) {
+
+ // Use the parser to convert the response into Xero objects
+ xeroContact = XeroCalloutResponseParser.parseContacts(response.getBody())[0];
+ }
+ else {
+
+ // Raise error
+ throw new XeroAccountingApiException(response.getStatusCode() + ': ' + response.getBody());
+ }
+
+ return xeroContact;
+ }
+
/**
* @author Ben Edwards (ben@benedwards.co.nz)
* @description Method to create a Contact in Xero.
diff --git a/src/classes/XeroAccountingApi.cls-meta.xml b/src/classes/XeroAccountingApi.cls-meta.xml
index d219ea1..38aa015 100644
--- a/src/classes/XeroAccountingApi.cls-meta.xml
+++ b/src/classes/XeroAccountingApi.cls-meta.xml
@@ -1,5 +1,5 @@
- 35.0
+ 36.0
Active
diff --git a/src/classes/XeroAccountingApiTest.cls-meta.xml b/src/classes/XeroAccountingApiTest.cls-meta.xml
index d219ea1..38aa015 100644
--- a/src/classes/XeroAccountingApiTest.cls-meta.xml
+++ b/src/classes/XeroAccountingApiTest.cls-meta.xml
@@ -1,5 +1,5 @@
- 35.0
+ 36.0
Active
diff --git a/src/classes/XeroAddress.cls-meta.xml b/src/classes/XeroAddress.cls-meta.xml
index d219ea1..38aa015 100644
--- a/src/classes/XeroAddress.cls-meta.xml
+++ b/src/classes/XeroAddress.cls-meta.xml
@@ -1,5 +1,5 @@
- 35.0
+ 36.0
Active
diff --git a/src/classes/XeroCalloutResponseParser.cls b/src/classes/XeroCalloutResponseParser.cls
index aa1cde0..6cb567c 100644
--- a/src/classes/XeroCalloutResponseParser.cls
+++ b/src/classes/XeroCalloutResponseParser.cls
@@ -1,42 +1,49 @@
/**
-* @author Ben Edwards (ben@benedwards.co.nz)
+* @author Ben Edwards (ben@edwards.nz)
* @description Class to parse responses from Xero callouts
**/
public with sharing class XeroCalloutResponseParser {
/**
- * @author Ben Edwards (ben@benedwards.co.nz)
+ * @author Ben Edwards (ben@edwards.nz)
* @description Method to convert JSON responses into Xero objects
* @return Returns a Xero wrapper class object from a given response body
**/
public static List parseContacts(String jsonBody) {
- // Parse the JSON response
- Map jsonResponseMap = (Map) JSON.deserializeUntyped(jsonBody);
-
// Re-serialize just the Contacts portion back to JSOn
- String jsonSerialized = JSON.serialize((List