View difference between Paste ID: MYkaF1jZ and 9cZdH5fA
SHOW: | | - or go back to the newest paste.
1
//get all information about an item (a single HTTP request is made), save them in a variable (jsonObject), 
2
//make necessary adjustment on item's value and return the result
3
function GetItem(itemID) {
4
  var myUrl = "http://www.gw2spidy.com/api/v0.9/json/item/" + escape(itemID);
5
  var jsonData = UrlFetchApp.fetch(myUrl);  
6
  var jsonString = jsonData.getContentText();
7
  var jsonObject = JSON.parse(jsonString).result;
8
  jsonObject.min_sale_unit_price=jsonObject.min_sale_unit_price / 100;
9-
function GetItemSellValue(jsonObject) {
9+
  jsonObject.sale_price_change_last_hour=jsonObject.sale_price_change_last_hour / 100;
10-
      var adjustedValue = (jsonObject.min_sale_unit_price / 100);
10+
  jsonObject.max_offer_unit_price=jsonObject.max_offer_unit_price / 100;
11-
      return adjustedValue;  
11+
  jsonObject.offer_price_change_last_hour= jsonObject.offer_price_change_last_hour / 100;
12
  return jsonObject;  
13-
     
13+
14-
function SalePriceChangedLastHour(jsonObject) {
14+
15-
      var adjustedValue = (jsonObject.sale_price_change_last_hour / 100);
15+
16-
      return adjustedValue;  
16+
17
18-
     
18+
//get adjusted values getting property of the item
19-
function GetItemBuyValue(jsonObject) {
19+
var sell=ecto.min_sale_unit_price;
20-
      var adjustedValue = (jsonObject.max_offer_unit_price / 100);
20+
var sell_changed=ecto.sale_price_change_last_hour;
21-
      return adjustedValue;
21+
var buy=ecto.max_offer_unit_price;
22
var buy_changed=ecto.offer_price_change_last_hour;