mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-13 22:40:12 +08:00
remove options argument for updatePrice method
This commit is contained in:
parent
5c2894a7d4
commit
eae78aab93
@ -2,7 +2,6 @@ var SteamCommunity = require('../index.js');
|
|||||||
var Cheerio = require('cheerio');
|
var Cheerio = require('cheerio');
|
||||||
|
|
||||||
SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, callback) {
|
SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, callback) {
|
||||||
// steamCommunity.getMarketItem(appID, hashName, function(){...});
|
|
||||||
if (typeof currency == "function") {
|
if (typeof currency == "function") {
|
||||||
callback = currency;
|
callback = currency;
|
||||||
currency = 1;
|
currency = 1;
|
||||||
@ -20,7 +19,7 @@ SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, cal
|
|||||||
}
|
}
|
||||||
|
|
||||||
var item = new CMarketItem(appid, hashName, self, body, $);
|
var item = new CMarketItem(appid, hashName, self, body, $);
|
||||||
item.updatePrice({currency: currency}, function(err) {
|
item.updatePrice(currency, function(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
} else {
|
} else {
|
||||||
@ -103,25 +102,19 @@ function CMarketItem(appid, hashName, community, body, $) {
|
|||||||
// TODO: Buying listings and placing buy orders
|
// TODO: Buying listings and placing buy orders
|
||||||
}
|
}
|
||||||
|
|
||||||
CMarketItem.prototype.updatePrice = function (options, callback) {
|
CMarketItem.prototype.updatePrice = function (currency, callback) {
|
||||||
options = options || {};
|
|
||||||
options.currency = options.currency || 1;
|
|
||||||
|
|
||||||
if (this.commodity) {
|
if (this.commodity) {
|
||||||
this.updatePriceForCommodity(options, callback);
|
this.updatePriceForCommodity(currency, callback);
|
||||||
} else {
|
} else {
|
||||||
this.updatePriceForNonCommodity(options, callback);
|
this.updatePriceForNonCommodity(currency, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CMarketItem.prototype.updatePriceForCommodity = function(options, callback) {
|
CMarketItem.prototype.updatePriceForCommodity = function(currency, callback) {
|
||||||
if(!this.commodity) {
|
if(!this.commodity) {
|
||||||
throw new Error("Cannot update price for non-commodity item");
|
throw new Error("Cannot update price for non-commodity item");
|
||||||
}
|
}
|
||||||
|
|
||||||
options = options || {};
|
|
||||||
var currency = options.currency;
|
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this._community.request({
|
this._community.request({
|
||||||
"uri": "https://steamcommunity.com/market/itemordershistogram?country=US&language=english¤cy=" + currency + "&item_nameid=" + this.commodityID,
|
"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) {
|
if(this.commodity) {
|
||||||
throw new Error("Cannot update price for commodity item");
|
throw new Error("Cannot update price for commodity item");
|
||||||
}
|
}
|
||||||
|
|
||||||
options = options || {};
|
|
||||||
var currency = options.currency;
|
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this._community.request({
|
this._community.request({
|
||||||
"uri": "https://steamcommunity.com/market/listings/" +
|
"uri": "https://steamcommunity.com/market/listings/" +
|
||||||
|
Loading…
Reference in New Issue
Block a user