From acaf0f18e3eb37531ebaa192a3f17a539477f7b8 Mon Sep 17 00:00:00 2001 From: Steven Schobert Date: Sat, 8 Mar 2014 19:56:49 -0600 Subject: [PATCH] remove default limit. closes #64. --- src/instafeed.coffee | 7 ++++--- test/instafeedTest.coffee | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/instafeed.coffee b/src/instafeed.coffee index cac757d..778655a 100644 --- a/src/instafeed.coffee +++ b/src/instafeed.coffee @@ -7,7 +7,6 @@ class Instafeed resolution: 'thumbnail' sortBy: 'most-recent' links: true - limit: 15 mock: false useHttp: false @@ -150,7 +149,8 @@ class Instafeed if document? and @options.mock is false # limit the number of images if needed images = response.data - images = images[0..@options.limit] if images.length > @options.limit + if @options.limit? + images = images[0..@options.limit] if images.length > @options.limit # create the document fragment fragment = document.createDocumentFragment() @@ -289,7 +289,8 @@ class Instafeed final += "?client_id=#{@options.clientId}" # add the count limit - final += "&count=#{@options.limit}" + if @options.limit? + final += "&count=#{@options.limit}" # add the jsonp callback final += "&callback=instafeedCache#{@unique}.parse" diff --git a/test/instafeedTest.coffee b/test/instafeedTest.coffee index be98157..2f6ce7c 100644 --- a/test/instafeedTest.coffee +++ b/test/instafeedTest.coffee @@ -64,13 +64,13 @@ describe 'Instafeed instace', -> it 'should assemble a url using the client id', -> feed = new Instafeed clientId: 'test' - feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?client_id=test&count=15&callback=instafeedCache#{feed.unique}.parse" + feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?client_id=test&callback=instafeedCache#{feed.unique}.parse" it 'should use the access token for authentication, when available', -> feed = new Instafeed clientId: 'test' accessToken: 'mytoken' - feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?access_token=mytoken&count=15&callback=instafeedCache#{feed.unique}.parse" + feed._buildUrl().should.equal "https://api.instagram.com/v1/media/popular?access_token=mytoken&callback=instafeedCache#{feed.unique}.parse" it 'should refuse to build a url with invalid "get" option', -> feed = new Instafeed