Skip to content

Commit

Permalink
remove default limit. closes stevenschobert#64.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenschobert committed Mar 9, 2014
1 parent 49cc211 commit acaf0f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/instafeed.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class Instafeed
resolution: 'thumbnail'
sortBy: 'most-recent'
links: true
limit: 15
mock: false
useHttp: false

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions test/instafeedTest.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit acaf0f1

Please sign in to comment.