diff --git a/classes/CMarketItem.js b/classes/CMarketItem.js index 52b595b..76b88d1 100644 --- a/classes/CMarketItem.js +++ b/classes/CMarketItem.js @@ -2,7 +2,6 @@ var SteamCommunity = require('../index.js'); var Cheerio = require('cheerio'); SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, callback) { - // steamCommunity.getMarketItem(appID, hashName, function(){...}); if (typeof currency == "function") { callback = currency; currency = 1; @@ -20,7 +19,7 @@ SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, cal } var item = new CMarketItem(appid, hashName, self, body, $); - item.updatePrice({currency: currency}, function(err) { + item.updatePrice(currency, function(err) { if(err) { callback(err); } else { @@ -103,25 +102,19 @@ function CMarketItem(appid, hashName, community, body, $) { // TODO: Buying listings and placing buy orders } -CMarketItem.prototype.updatePrice = function (options, callback) { - options = options || {}; - options.currency = options.currency || 1; - +CMarketItem.prototype.updatePrice = function (currency, callback) { if (this.commodity) { - this.updatePriceForCommodity(options, callback); + this.updatePriceForCommodity(currency, callback); } else { - this.updatePriceForNonCommodity(options, callback); + this.updatePriceForNonCommodity(currency, callback); } }; -CMarketItem.prototype.updatePriceForCommodity = function(options, callback) { +CMarketItem.prototype.updatePriceForCommodity = function(currency, callback) { if(!this.commodity) { throw new Error("Cannot update price for non-commodity item"); } - options = options || {}; - var currency = options.currency; - var self = this; this._community.request({ "uri": "https://steamcommunity.com/market/itemordershistogram?country=US&language=english¤cy=" + currency + "&item_nameid=" + this.commodityID, @@ -160,14 +153,11 @@ CMarketItem.prototype.updatePriceForCommodity = function(options, callback) { }); }; -CMarketItem.prototype.updatePriceForNonCommodity = function (options, callback) { +CMarketItem.prototype.updatePriceForNonCommodity = function (currency, callback) { if(this.commodity) { throw new Error("Cannot update price for commodity item"); } - options = options || {}; - var currency = options.currency; - var self = this; this._community.request({ "uri": "https://steamcommunity.com/market/listings/" +