Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
addition deprecation check and bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zcourts committed Apr 22, 2016
1 parent 612a3d6 commit ab7161f
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -95,8 +95,8 @@ public Instagram byLocation(float longitude, float latitude, int distance) {
* is provided
*
* @param fourSquareLocation a valid foursquare location ID e.g. 5XfVJe
* @deprecated Instagram has deprecated foursquare support since 20th April 2016
* @return this
* @deprecated Instagram has deprecated foursquare support since 20th April 2016
*/
public Instagram byFoursquareLocation(String fourSquareLocation) throws Exception {
throw new UnsupportedOperationException("Instagram has deprecated foursquare support since 20th April 2016");
Expand Down Expand Up @@ -139,14 +139,15 @@ protected Instagram addResource(Type type, String value, float longitude, float
break;
case AREA:
case LOCATION:
if (value == null || distance > 5000) {
if (distance > 5000) {
throw new IllegalArgumentException("If provided distance must be between 1 and 5000 metres or < 0" +
" to be ignored");
}
if (type == Type.LOCATION) {
parameterSet.set("type", "location");
if (fourSquareLocation != null) {
parameterSet.set("foursq", fourSquareLocation);
throw new UnsupportedOperationException("Instagram has deprecated foursquare support " +
"since 20th April 2016");
}
} else {
parameterSet.set("type", "area");
Expand All @@ -155,7 +156,7 @@ protected Instagram addResource(Type type, String value, float longitude, float
parameterSet.set("lat", lattitude);
parameterSet.set("lng", longitude);
if (distance > 0) {
parameterSet.set("distance", lattitude);
parameterSet.set("distance", distance);
}
}
break;
Expand Down

0 comments on commit ab7161f

Please sign in to comment.