Examples of AmazonBookModel


Examples of com.apps.ubc.cc.model.AmazonBookModel

    requestURL = lookUpPrice(asin,PRICE_LOOKUP);
    String priceNew = fetch(requestURL, FETCH_NEW_PRICE);
    String priceUsed = fetch(requestURL, FETCH_USED_PRICE);
    requestURL = lookUpImage(asin);
    String imageUrl = fetch(requestURL, FETCH_IMAGE);
    AmazonBookModel abm = new AmazonBookModel(asin, title, imageUrl,
        detail, priceNew, priceUsed);
    return abm;
  }
View Full Code Here

Examples of com.apps.ubc.cc.model.AmazonBookModel

 
  AmazonWebService aws = AmazonWebServiceFactory.getAmazonWebService();
 
  public void doGet(HttpServletRequest req, HttpServletResponse resp) {
    String isbn = req.getParameter("isbn");
    AmazonBookModel abm = aws.search(isbn);
    String out = "<book>\n";
    out += "\t<title>"+StringEscapeUtils.escapeXml(abm.getTitle())+"</title>\n";
    out += "\t<image>"+abm.getImageUrl()+"</image>\n";
    out += "\t<detail>"+StringEscapeUtils.escapeXml(abm.getDetailUrl())+"</detail>\n";
    out += "\t<newPrice>"+StringEscapeUtils.escapeXml(abm.getPriceNew())+"</newPrice>\n";
    out += "\t<usedPrice>"+StringEscapeUtils.escapeXml(abm.getPriceUsed())+"</usedPrice>\n";
    out += "</book>";
    try {
      resp.setContentType("text/xml; charset=UTF-8");
      resp.getWriter().write(out);
    } catch (IOException e) {
View Full Code Here

Examples of com.apps.ubc.cc.model.AmazonBookModel

      out += "</tr>\n";
    }
    for(Iterator<BookInformation> i = biol.iterator(); i.hasNext();){
      BookInformation bio = i.next();
      AmazonWebService aws = AmazonWebServiceFactory.getAmazonWebService();
      AmazonBookModel abm = aws.search(bio.getISBN());
      out += "<tr>\n";
      out += "<table>\n";
      if (!abm.getAsin().equals("")) {
        out += "<tr>\n";
        out += "<a href=\"" + abm.getDetailUrl() + "\">Amazon</a>";
        out += "</tr>\n";
        out += "<tr>\n";
        out += "<td><img src=\"" + abm.getImageUrl() + "\"></td>\n";
        out += "<td><b>Title: </b>" + abm.getTitle() + " - "
            + bio.getRequired() + "</td>\n";
        out += "</tr>\n";
        out += "<tr>\n";
        out += "<td><b>Price(New): </b>" + abm.getPriceNew()
            + "</td>\n";
        out += "</tr>\n";
        out += "<tr>\n";
        out += "<td><b>Price(Used): </b>" + abm.getPriceUsed()
            + "</td>\n";
        out += "</tr>\n";
      }
      out += "</table>\n";
      out += "</tr>\n";
View Full Code Here

Examples of com.apps.ubc.cc.model.AmazonBookModel

public class AmazonWebServiceTest {

  @Test
  public void test() {
    AmazonWebService aws = AmazonWebServiceFactory.getAmazonWebService();
    AmazonBookModel abm = aws.search("9780495391326");
   
    assertTrue(abm.getAsin().equals("0495391328"));
    assertTrue(abm.getDetailUrl().equals("http://www.amazon.ca/Discrete-Mathematics-Applications-Susanna-Epp/dp/0495391328%3FSubscriptionId%3DAKIAI2EIYYQQFCWV6XCA%26tag%3Dubcoco03-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0495391328"));
    assertTrue(abm.getImageUrl().equals("http://ecx.images-amazon.com/images/I/41BEcqUOPbL._SL75_.jpg"));
    assertTrue(abm.getPriceNew().equals("CDN$ 172.33"));
    assertTrue(abm.getPriceUsed().equals("CDN$ 130.00"));
    assertTrue(abm.getTitle().equals("Discrete Mathematics with Applications"));
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.