Skip to content

Commit

Permalink
Merge pull request #16 from upwork/v1.2.3
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
mnovozhylov authored May 25, 2018
2 parents 4618b3c + 9a31ea8 commit 82518a0
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 183 deletions.
1 change: 1 addition & 0 deletions .tests
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ant test
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History

## 1.3.0
* Stop supporting deprecated Teamrooms API
* Migrate Workdiaries, Workdays and Snapshots API to v3

## 1.2.2
* Fix wrong method usage in updateRoomSettings and updateRoomMetadata

Expand Down
Binary file modified doc/java-upwork-javadoc.zip
Binary file not shown.
Binary file modified example-android/app/libs/java-upwork.jar
Binary file not shown.
Binary file modified lib/java-upwork.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.Upwork</groupId>
<artifactId>api</artifactId>
<version>1.2.2</version>
<version>1.3.0</version>
<packaging>jar</packaging>
<name>java-upwork</name>
<description>JAVA bindings for Upwork API</description>
Expand Down
54 changes: 7 additions & 47 deletions src/com/Upwork/api/Routers/Snapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
author = "Maksym Novozhylov <[email protected]>",
date = "6/4/2014",
currentRevision = 1,
lastModified = "6/4/2014",
lastModified = "24/5/2014",
lastModifiedBy = "Maksym Novozhylov",
reviewers = {"Yiota Tsakiri"}
)
Expand All @@ -43,56 +43,16 @@ public Snapshot(OAuthClient client) {
oClient.setEntryPoint(ENTRY_POINT);
}

/**
* Get snapshot info
*
* @param company Company
* @param username Username
* @param ts Timestamp
* @throws JSONException If error occurred
* @return {@link JSONObject}
*/
public JSONObject get(String company, String username, String ts) throws JSONException {
return oClient.get("/team/v1/snapshots/" + company + "/" + username + "/" + ts);
}

/**
* Update snapshot
*
* @param company Company
* @param username Username
* @param ts Timestamp
* @param params Parameters
* @throws JSONException If error occurred
* @return {@link JSONObject}
*/
public JSONObject update(String company, String username, String ts, HashMap<String, String> params) throws JSONException {
return oClient.put("/team/v1/snapshots/" + company + "/" + username + "/" + ts, params);
}

/**
* Delete snapshot
*
* @param company Company
* @param username Username
* @param ts Timestamp
* @throws JSONException If error occurred
* @return {@link JSONObject}
*/
public JSONObject delete(String company, String username, String ts) throws JSONException {
return oClient.delete("/team/v1/snapshots/" + company + "/" + username + "/" + ts);
}

/**
* Get snapshot info by specific contract
*
* @param contractId Contract ID
* @param ts Timestamp
* @throws JSONException If error occurred
* @return {@link JSONObject}
* @return {@link JSONObject}
*/
public JSONObject getByContract(String contractId, String ts) throws JSONException {
return oClient.get("/team/v2/snapshots/contracts/" + contractId + "/" + ts);
return oClient.get("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
}

/**
Expand All @@ -102,10 +62,10 @@ public JSONObject getByContract(String contractId, String ts) throws JSONExcepti
* @param ts Timestamp
* @param params Parameters
* @throws JSONException If error occurred
* @return {@link JSONObject}
* @return {@link JSONObject}
*/
public JSONObject updateByContract(String contractId, String ts, HashMap<String, String> params) throws JSONException {
return oClient.put("/team/v2/snapshots/contracts/" + contractId + "/" + ts, params);
return oClient.put("/team/v3/snapshots/contracts/" + contractId + "/" + ts, params);
}

/**
Expand All @@ -114,10 +74,10 @@ public JSONObject updateByContract(String contractId, String ts, HashMap<String,
* @param contractId Contract ID
* @param ts Timestamp
* @throws JSONException If error occurred
* @return {@link JSONObject}
* @return {@link JSONObject}
*/
public JSONObject deleteByContract(String contractId, String ts) throws JSONException {
return oClient.delete("/team/v2/snapshots/contracts/" + contractId + "/" + ts);
return oClient.delete("/team/v3/snapshots/contracts/" + contractId + "/" + ts);
}

}
68 changes: 0 additions & 68 deletions src/com/Upwork/api/Routers/Teams.java

This file was deleted.

8 changes: 4 additions & 4 deletions src/com/Upwork/api/Routers/Workdays.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
author = "Maksym Novozhylov <[email protected]>",
date = "14/7/2015",
currentRevision = 1,
lastModified = "14/7/2015",
lastModified = "24/5/2018",
lastModifiedBy = "Maksym Novozhylov",
reviewers = {"Yiota Tsakiri"}
)
Expand All @@ -54,7 +54,7 @@ public Workdays(OAuthClient client) {
* @return {@link JSONObject}
*/
public JSONObject getByCompany(String company, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v2/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
return oClient.get("/team/v3/workdays/companies/" + company + "/" + fromDate + "," + tillDate, params);
}

/**
Expand All @@ -68,7 +68,7 @@ public JSONObject getByCompany(String company, String fromDate, String tillDate,
* @return {@link JSONObject}
*/
public JSONObject getByContract(String contract, String fromDate, String tillDate, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v2/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
return oClient.get("/team/v3/workdays/contracts/" + contract + "/" + fromDate + "," + tillDate, params);
}

}
}
9 changes: 4 additions & 5 deletions src/com/Upwork/api/Routers/Workdiary.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
author = "Maksym Novozhylov <[email protected]>",
date = "6/3/2014",
currentRevision = 1,
lastModified = "6/3/2014",
lastModified = "24/5/2018",
lastModifiedBy = "Maksym Novozhylov",
reviewers = {"Yiota Tsakiri"}
)
Expand All @@ -47,14 +47,13 @@ public Workdiary(OAuthClient client) {
* Get Workdiary
*
* @param company Company ID
* @param username User ID
* @param date Date
* @param params (Optional) Parameters
* @throws JSONException If error occurred
* @return {@link JSONObject}
*/
public JSONObject get(String company, String username, String date, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v1/workdiaries/" + company + "/" + username + "/" + date, params);
public JSONObject get(String company, String date, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v3/workdiaries/companies/" + company + "/" + date, params);
}

/**
Expand All @@ -67,7 +66,7 @@ public JSONObject get(String company, String username, String date, HashMap<Stri
* @return {@link JSONObject}
*/
public JSONObject getByContract(String contract, String date, HashMap<String, String> params) throws JSONException {
return oClient.get("/team/v2/workdiaries/contracts/" + contract + "/" + date, params);
return oClient.get("/team/v3/workdiaries/contracts/" + contract + "/" + date, params);
}

}
23 changes: 1 addition & 22 deletions test/com/Upwork/api/Routers/SnapshotTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,6 @@
Snapshot.class
})
public class SnapshotTest extends Helper {
@Test public void get() throws Exception {
Snapshot snapshot = new Snapshot(client);
JSONObject json = snapshot.get("company", "username", "date");

assertTrue(json instanceof JSONObject);
}

@Test public void update() throws Exception {
Snapshot snapshot = new Snapshot(client);
JSONObject json = snapshot.update("company", "username", "date", new HashMap<String, String>());

assertTrue(json instanceof JSONObject);
}

@Test public void delete() throws Exception {
Snapshot snapshot = new Snapshot(client);
JSONObject json = snapshot.delete("company", "username", "date");

assertTrue(json instanceof JSONObject);
}

@Test public void getByContract() throws Exception {
Snapshot snapshot = new Snapshot(client);
JSONObject json = snapshot.getByContract("1234", "date");
Expand All @@ -59,4 +38,4 @@ public class SnapshotTest extends Helper {

assertTrue(json instanceof JSONObject);
}
}
}
34 changes: 0 additions & 34 deletions test/com/Upwork/api/Routers/TeamsTest.java

This file was deleted.

4 changes: 2 additions & 2 deletions test/com/Upwork/api/Routers/WorkdiaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class WorkdiaryTest extends Helper {
@Test public void get() throws Exception {
Workdiary workdiary = new Workdiary(client);
JSONObject json = workdiary.get("company", "username", "date", new HashMap<String, String>());
JSONObject json = workdiary.get("company", "date", new HashMap<String, String>());

assertTrue(json instanceof JSONObject);
}
Expand All @@ -31,4 +31,4 @@ public class WorkdiaryTest extends Helper {

assertTrue(json instanceof JSONObject);
}
}
}

0 comments on commit 82518a0

Please sign in to comment.