Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

media fetching for locations works

  • Loading branch information...
commit a544dd7280ef8de77692f1cf33a57a581bbe9eee 1 parent 546a8ba
Swizec Teller authored
Showing with 32 additions and 4 deletions.
  1. +13 −0 index.js
  2. +19 −4 tests/locations.js
13 index.js
View
@@ -99,6 +99,19 @@ InstagramLocationsClient.prototype.id = function (id, callback) {
this.parent.fetch('/v1/locations/'+id, callback);
}
+InstagramLocationsClient.prototype.media = function (id, params, callback) {
+ if (arguments.length < 3) {
+ var callback = params;
+ params = {};
+ }
+
+ this.parent.fetch('/v1/locations/'+id+'/media/recent',
+ params,
+ callback);
+}
+
+
+
exports.createClient = function (client_id, client_secret) {
var instagram_client = new InstagramClient(client_id, client_secret);
23 tests/locations.js
View
@@ -14,14 +14,29 @@ exports.testLocationsFetchById = function (test) {
}
exports.testLocationsMedia = function (test) {
- test.expect(2);
+ test.expect(12);
+
+ var max_id = 0, min_id = 0;
- instagram.locations.media(1, function (images, error) {
- test.ok((images.length > 0));
+ var callback = function (media, error, pagination) {
+ test.ok((media.length > 0));
+ test.ok((pagination != null));
test.equal(error, null);
+ }
- test.done();
+ instagram.tags.media(1, function (media, error, pagination) {
+ callback(media, error, pagination);
+
+ max_id = media[0].id;
+ min_id = media[media.length-1].id;
});
+ instagram.tags.media(1, {max_id: max_id}, callback);
+ instagram.tags.media(1, {min_id: min_id}, callback);
+ instagram.tags.media(1, {max_id: max_id, min_id: min_id},
+ function (media, error, pagination) {
+ callback(media, error, pagination);
+ test.done();
+ });
}
exports.testLocationsSearch = function (test) {
Please sign in to comment.
Something went wrong with that request. Please try again.