File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ class Instafeed
7
7
resolution : ' thumbnail'
8
8
sortBy : ' most-recent'
9
9
links : true
10
- limit : 15
11
10
mock : false
12
11
useHttp : false
13
12
@@ -150,7 +149,8 @@ class Instafeed
150
149
if document ? and @options .mock is false
151
150
# limit the number of images if needed
152
151
images = response .data
153
- images = images[0 .. @options .limit ] if images .length > @options .limit
152
+ if @options .limit ?
153
+ images = images[0 .. @options .limit ] if images .length > @options .limit
154
154
155
155
# create the document fragment
156
156
fragment = document .createDocumentFragment ()
@@ -289,7 +289,8 @@ class Instafeed
289
289
final += " ?client_id=#{ @options .clientId } "
290
290
291
291
# add the count limit
292
- final += " &count=#{ @options .limit } "
292
+ if @options .limit ?
293
+ final += " &count=#{ @options .limit } "
293
294
294
295
# add the jsonp callback
295
296
final += " &callback=instafeedCache#{ @unique } .parse"
Original file line number Diff line number Diff line change @@ -64,13 +64,13 @@ describe 'Instafeed instace', ->
64
64
it ' should assemble a url using the client id' , ->
65
65
feed = new Instafeed
66
66
clientId : ' test'
67
- feed ._buildUrl ().should .equal " https://api.instagram.com/v1/media/popular?client_id=test&count=15& callback=instafeedCache#{ feed .unique } .parse"
67
+ feed ._buildUrl ().should .equal " https://api.instagram.com/v1/media/popular?client_id=test&callback=instafeedCache#{ feed .unique } .parse"
68
68
69
69
it ' should use the access token for authentication, when available' , ->
70
70
feed = new Instafeed
71
71
clientId : ' test'
72
72
accessToken : ' mytoken'
73
- feed ._buildUrl ().should .equal " https://api.instagram.com/v1/media/popular?access_token=mytoken&count=15& callback=instafeedCache#{ feed .unique } .parse"
73
+ feed ._buildUrl ().should .equal " https://api.instagram.com/v1/media/popular?access_token=mytoken&callback=instafeedCache#{ feed .unique } .parse"
74
74
75
75
it ' should refuse to build a url with invalid "get" option' , ->
76
76
feed = new Instafeed
You can’t perform that action at this time.
0 commit comments