Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

change private methods to protected to allow extending the RapleafApi…

… class
  • Loading branch information...
commit f8f948fec67327ef1cfe22a3f650481d6f99b685 1 parent 004deb4
anneka anneka authored

Showing 1 changed file with 11 additions and 11 deletions. Show diff stats Hide diff stats

  1. +11 11 java/src/com/rapleaf/api/personalization/RapleafApi.java
22 java/src/com/rapleaf/api/personalization/RapleafApi.java
@@ -32,13 +32,13 @@
32 32 * are stated at http://www.rapleaf.com/developers/api_usage.
33 33 */
34 34 public class RapleafApi {
35   - private String apiKey;
36   - private final static String BASE_URL = "https://personalize.rapleaf.com/v4/dr";
37   - private final static String BULK_URL = "https://personalize.rapleaf.com/v4/bulk";
38   - private final static int DEFAULT_TIMEOUT = 2000;
39   - private final static int DEFAULT_BULK_TIMEOUT = 30000;
40   - private final int timeout;
41   - private final int bulkTimeout;
  35 + protected String apiKey;
  36 + protected final static String BASE_URL = "https://personalize.rapleaf.com/v4/dr";
  37 + protected final static String BULK_URL = "https://personalize.rapleaf.com/v4/bulk";
  38 + protected final static int DEFAULT_TIMEOUT = 2000;
  39 + protected final static int DEFAULT_BULK_TIMEOUT = 30000;
  40 + protected final int timeout;
  41 + protected final int bulkTimeout;
42 42
43 43 /**
44 44 * Constructor for RapleafApi class
@@ -278,7 +278,7 @@ public JSONArray bulkQuery(List<Map<String,String>> set, boolean showAvailable)
278 278 return new JSONArray(bulkJsonResponse(urlStr, new JSONArray(set).toString()));
279 279 }
280 280
281   - private String bulkJsonResponse(String urlStr, String list) throws Exception {
  281 + protected String bulkJsonResponse(String urlStr, String list) throws Exception {
282 282 URL url = new URL(urlStr);
283 283 HttpURLConnection handle = (HttpURLConnection) url.openConnection();
284 284 handle.setRequestProperty("User-Agent", "RapleafApi/Java/1.0");
@@ -315,7 +315,7 @@ private String bulkJsonResponse(String urlStr, String list) throws Exception {
315 315 * @return Returns a JSONObject hash from fields onto field values
316 316 * @throws Exception Throws error code on all HTTP statuses outside of 200 <= status < 300
317 317 */
318   - private JSONObject getJsonResponse(String urlStr, boolean showAvailable) throws Exception {
  318 + protected JSONObject getJsonResponse(String urlStr, boolean showAvailable) throws Exception {
319 319 if ( showAvailable )
320 320 {
321 321 urlStr = urlStr + "&show_available=true";
@@ -338,7 +338,7 @@ private JSONObject getJsonResponse(String urlStr, boolean showAvailable) throws
338 338 return new JSONObject(responseBody);
339 339 }
340 340
341   - private String MD5Hex(String s) {
  341 + protected String MD5Hex(String s) {
342 342 String result = null;
343 343 try {
344 344 MessageDigest md5 = MessageDigest.getInstance("MD5");
@@ -348,7 +348,7 @@ private String MD5Hex(String s) {
348 348 return result;
349 349 }
350 350
351   - private String toHex(byte[] a) {
  351 + protected String toHex(byte[] a) {
352 352 StringBuilder sb = new StringBuilder(a.length * 2);
353 353 for (int i = 0; i < a.length; i++) {
354 354 sb.append(Character.forDigit((a[i] & 0xf0) >> 4, 16));

0 comments on commit f8f948f

Please sign in to comment.
Something went wrong with that request. Please try again.