Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Commit

Permalink
Merge pull request #2 from kipanshi/staging
Browse files Browse the repository at this point in the history
Add missing calls and refactoring
  • Loading branch information
mnovozhylov committed Sep 12, 2014
2 parents 36992f5 + fb158ad commit 7ded64b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 19 deletions.
12 changes: 12 additions & 0 deletions src/com/oDesk/api/Routers/Activities/Team.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params);
}

}
22 changes: 16 additions & 6 deletions src/com/oDesk/api/Routers/Freelancers/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
}
}
2 changes: 1 addition & 1 deletion src/com/oDesk/api/Routers/Mc.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions test/com/oDesk/api/Routers/Activities/TeamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String>());

assertTrue(json instanceof JSONObject);
}

@Test public void updateActivity() throws Exception {
Team activities = new Team(client);
JSONObject json = activities.updateActivity("company", "team", "code", new HashMap<String, String>());

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<String, String>());

assertTrue(json instanceof JSONObject);
}

}
11 changes: 9 additions & 2 deletions test/com/oDesk/api/Routers/Freelancers/ProfileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 7ded64b

Please sign in to comment.