Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/etsyjs/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@
}]));
};

Shop.prototype.activeListings = function(_arg, cb) {
var limit, offset, params, secret, token, _ref;
token = _arg.token, secret = _arg.secret, limit = _arg.limit, offset = _arg.offset;
params = {};
if (limit != null) {
params.limit = limit;
}
if (offset != null) {
params.offset = offset;
}
return (_ref = this.client).get.apply(_ref, ["/shops/" + this.shopId + "/listings/active", token, secret].concat(__slice.call(params), [function(err, status, body, headers) {
if (err) {
return cb(err);
}
if (status !== 200) {
return cb(new Error('Get active listings error'));
} else {
return cb(null, body, headers);
}
}]));
};

return Shop;

})();
Expand Down
15 changes: 14 additions & 1 deletion src/etsyjs/shop.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,17 @@ class Shop
else
cb null, body, headers

module.exports = Shop
# Retrieves Listings associated to a Shop that are active
# '/shops/:shop_id/listings/active' GET
activeListings: ({token, secret, limit, offset}, cb) ->
params = {}
params.limit = limit if limit?
params.offset = offset if offset?
@client.get "/shops/#{@shopId}/listings/active", token, secret, params..., (err, status, body, headers) ->
return cb(err) if err
if status isnt 200
cb(new Error('Get active listings error'))
else
cb null, body, headers

module.exports = Shop