Beispiel #1
0
  public static User updateUser(OddsAPI api, User user) {
    // Build API call URL
    StringBuilder urlStr = new StringBuilder();
    urlStr.append(api.getURL());
    urlStr.append("User/users");

    HashMap<String, String> params = new HashMap<String, String>();
    params.put("name", user.getName());
    params.put("id", Integer.toString(user.getID()));
    params.put("facebook_id", user.getFbID());

    OddsAPI.POST(urlStr.toString(), params);
    return user;
  }
Beispiel #2
0
  public static User createUser(OddsAPI api, String name, String FbID) {
    // Build API call URL
    StringBuilder urlStr = new StringBuilder();
    urlStr.append(api.getURL());
    urlStr.append("User/users");

    HashMap<String, String> params = new HashMap<String, String>();
    params.put("name", name);
    params.put("facebook_id", FbID);

    OddsAPI.POST(urlStr.toString(), params);

    return getUserByFbID(api, FbID);
  }
Beispiel #3
0
  public static User getUser(OddsAPI api, int id) {
    String FbID = "";
    String name = "";

    // Build API call URL
    StringBuilder urlStr = new StringBuilder();
    urlStr.append(api.getURL());
    urlStr.append("User/users/id/" + id);

    JSONObject obj = OddsAPI.GET(urlStr.toString());

    try {
      FbID = obj.getString("facebook_id");
      name = obj.getString("name");
    } catch (JSONException e) {

    }

    return new User(id, name, FbID);
  }