Skip to content

Commit

Permalink
1) Remove debug statement
Browse files Browse the repository at this point in the history
2) comparisonLink() helper function
  • Loading branch information
jamesdlow committed Mar 9, 2016
1 parent 667d333 commit 6e11bc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/com/reverb/api/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ public byte[] sendRaw(byte[] content) throws IOException {
if(METHOD_GET.equals(method)){
baseurl = baseurl + (content !=null && content.length > 0 ? (baseurl.indexOf('?') < 0 ? '?' : '&') + new String(content) : "");
}
ReverbApi.echo(baseurl);
conn = (HttpURLConnection) new URL(baseurl).openConnection();
conn.setRequestMethod(method);
for (Map.Entry<String, String> header : headers.entrySet()) {
Expand Down
10 changes: 6 additions & 4 deletions src/com/reverb/api/ReverbAffiliates.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ public class ReverbAffiliates {
public static final String HORIZONAL = "horizontal";
public static final String VERTICAL = "vertical";

public static String comparisonEmbed(JSONObject json, boolean horizontal, String affiliateid) {
//Check if json is a result or
public static String comparisonLink(JSONObject json) {
JSONObject item = ReverbApi.getFirstItem(json, ReverbApi.COMPARISON_SHOPPING_PAGES);
JSONObject links = item.optJSONObject(ReverbApi.LINKS);
JSONObject web = links.optJSONObject(ReverbApi.WEB);
return comparisonEmbed(web.optString(ReverbApi.HREF), horizontal, affiliateid);
return web.optString(ReverbApi.HREF);
}
public static String comparisonEmbed(JSONObject json, boolean horizontal, String affiliateid) {
return comparisonEmbed(comparisonLink(json), horizontal, affiliateid);
}
public static String comparisonEmbed(String weburl, boolean horizontal, String affiliateid) {
//<iframe frameborder='0' id='iframe' scrolling='no' src='https://reverb.com/affiliates/comparison_shopping_embeds/bearfoot-fx-sea-blue-eq?_aid=geartube&orientation=horizontal' style='width: 100%; height: 300px;'></iframe>
//<iframe frameborder='0' id='iframe' scrolling='no' src='https://reverb.com/affiliates/comparison_shopping_embeds/bearfoot-fx-sea-blue-eq?_aid=AFFILIATEID&orientation=horizontal' style='width: 100%; height: 300px;'></iframe>
//?_aid=geartube&orientation=horizontal
String suffix = weburl.substring(weburl.lastIndexOf('/')+1);
return affiliateLink(ReverbApi.URL+"/affiliates/comparison_shopping_embeds/"+suffix+"?orientation="+(horizontal?HORIZONAL:VERTICAL), affiliateid);
Expand Down

0 comments on commit 6e11bc3

Please sign in to comment.