From 3641d7618c33371360508e7a377f49bf06b8f855 Mon Sep 17 00:00:00 2001 From: Cyril Panshine Date: Sat, 6 Sep 2014 12:44:00 +0700 Subject: [PATCH 1/5] Add `Profile.getSpecificBrief` call --- .../api/Routers/Freelancers/Profile.java | 22 ++++++++++++++----- .../api/Routers/Freelancers/ProfileTest.java | 11 ++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/com/oDesk/api/Routers/Freelancers/Profile.java b/src/com/oDesk/api/Routers/Freelancers/Profile.java index 453eb65..40bb89f 100644 --- a/src/com/oDesk/api/Routers/Freelancers/Profile.java +++ b/src/com/oDesk/api/Routers/Freelancers/Profile.java @@ -4,7 +4,7 @@ * Licensed under the oDesk's API Terms of Use; * you may not use this file except in compliance with the Terms. * You may obtain a copy of the Terms at - * + * * http://developers.odesk.com/API-Terms-of-Use * * Unless required by applicable law or agreed to in writing, software @@ -31,25 +31,35 @@ reviewers = {"Yiota Tsakiri"} ) public final class Profile { - + final static String ENTRY_POINT = "api"; - + private OAuthClient oClient = null; public Profile(OAuthClient client) { oClient = client; oClient.setEntryPoint(ENTRY_POINT); } - - /** + + /** * Get specific Freelancer's Profile * * @param key Profile key * @throws JSONException If error occurred * @return {@link JSONObject} */ - public JSONObject getSpecific(String key) throws JSONException { + public JSONObject getSpecific(String key) throws JSONException { return oClient.get("/profiles/v1/providers/" + key); } + /** + * Get brief info for the specific Freelancer's Profile + * + * @param key Profile key + * @throws JSONException If error occurred + * @return {@link JSONObject} + */ + public JSONObject getSpecificBrief(String key) throws JSONException { + return oClient.get("/profiles/v1/providers/" + key + "/brief"); + } } diff --git a/test/com/oDesk/api/Routers/Freelancers/ProfileTest.java b/test/com/oDesk/api/Routers/Freelancers/ProfileTest.java index 852b690..14622f3 100644 --- a/test/com/oDesk/api/Routers/Freelancers/ProfileTest.java +++ b/test/com/oDesk/api/Routers/Freelancers/ProfileTest.java @@ -19,7 +19,14 @@ public class ProfileTest extends Helper { @Test public void getSpecific() throws Exception { Profile profile = new Profile(client); JSONObject json = profile.getSpecific("key"); - + + assertTrue(json instanceof JSONObject); + } + + @Test public void getSpecificBrief() throws Exception { + Profile profile = new Profile(client); + JSONObject json = profile.getSpecificBrief("key"); + assertTrue(json instanceof JSONObject); } -} \ No newline at end of file +} From 8f27264b9bc408f6a73c6c797e70e0546373eb7c Mon Sep 17 00:00:00 2001 From: Cyril Panshine Date: Sat, 6 Sep 2014 12:54:09 +0700 Subject: [PATCH 2/5] Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32aefc5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +TestApi.class \ No newline at end of file From 87731452deaaa1911c7533f3ed3985ea753db79c Mon Sep 17 00:00:00 2001 From: Cyril Panshine Date: Wed, 10 Sep 2014 09:03:27 +0700 Subject: [PATCH 3/5] Add `updateBatch` call for the Activities API --- .../oDesk/api/Routers/Activities/Team.java | 12 ++++++++ src/com/oDesk/api/Routers/Mc.java | 2 +- .../api/Routers/Activities/TeamTest.java | 28 ++++++++++++------- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/com/oDesk/api/Routers/Activities/Team.java b/src/com/oDesk/api/Routers/Activities/Team.java index f381d27..646207c 100644 --- a/src/com/oDesk/api/Routers/Activities/Team.java +++ b/src/com/oDesk/api/Routers/Activities/Team.java @@ -138,4 +138,16 @@ public JSONObject unarchiveActivity(String company, String team, String code) th return oClient.put("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/unarchive/" + code); } + /** + * Update a group of oTask/Activity records + * + * @param company Company ID + * @param params Parameters + * @throws JSONException If error occurred + * @return {@link JSONObject} + */ + public JSONObject updateBatch(String company, HashMap params) throws JSONException { + return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params); + } + } diff --git a/src/com/oDesk/api/Routers/Mc.java b/src/com/oDesk/api/Routers/Mc.java index 493d697..916b749 100644 --- a/src/com/oDesk/api/Routers/Mc.java +++ b/src/com/oDesk/api/Routers/Mc.java @@ -62,7 +62,7 @@ public JSONObject getThreadDetails(String username, String threadId) throws JSON } /** - * Get a specific thread by context + * Get a specific thread by "Interview" context * * @param username Username * @param jobKey Job key diff --git a/test/com/oDesk/api/Routers/Activities/TeamTest.java b/test/com/oDesk/api/Routers/Activities/TeamTest.java index 09f76b1..4d59736 100644 --- a/test/com/oDesk/api/Routers/Activities/TeamTest.java +++ b/test/com/oDesk/api/Routers/Activities/TeamTest.java @@ -21,41 +21,49 @@ public class TeamTest extends Helper { @Test public void getList() throws Exception { Team activities = new Team(client); JSONObject json = activities.getList("company", "team"); - + assertTrue(json instanceof JSONObject); } - + @Test public void getSpecificList() throws Exception { Team activities = new Team(client); JSONObject json = activities.getSpecificList("company", "team", "code"); assertTrue(json instanceof JSONObject); } - + @Test public void addActivity() throws Exception { Team activities = new Team(client); JSONObject json = activities.addActivity("company", "team", new HashMap()); - + assertTrue(json instanceof JSONObject); } - + @Test public void updateActivity() throws Exception { Team activities = new Team(client); JSONObject json = activities.updateActivity("company", "team", "code", new HashMap()); - + assertTrue(json instanceof JSONObject); } - + @Test public void archiveActivity() throws Exception { Team activities = new Team(client); JSONObject json = activities.archiveActivity("company", "team", "code"); - + assertTrue(json instanceof JSONObject); } - + @Test public void unarchiveActivity() throws Exception { Team activities = new Team(client); JSONObject json = activities.unarchiveActivity("company", "team", "code"); - + assertTrue(json instanceof JSONObject); } + + @Test public void updateBatch() throws Exception { + Team activities = new Team(client); + JSONObject json = activities.updateBatch("company", new HashMap()); + + assertTrue(json instanceof JSONObject); + } + } From 25578d6a4602d1d896c12aa2b2d7bc0b63e8cbfb Mon Sep 17 00:00:00 2001 From: Cyril Panshine Date: Wed, 10 Sep 2014 09:23:53 +0700 Subject: [PATCH 4/5] Fix gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 32aefc5..6e18eb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -TestApi.class \ No newline at end of file +example/src/TestApi.class \ No newline at end of file From fb158ad9880664e27a605cf941e536a976c077ec Mon Sep 17 00:00:00 2001 From: Cyril Panshine Date: Fri, 12 Sep 2014 22:34:40 +0700 Subject: [PATCH 5/5] Remove gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6e18eb1..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -example/src/TestApi.class \ No newline at end of file