Skip to content

Commit 37ea6fd

Browse files
authored
Merge pull request #10 from dblock/with-mongoid
Fixes for infinite scroll.
2 parents c19c75f + cb2b3af commit 37ea6fd

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,40 @@ $ rackup
1919
[2013-06-20 08:57:58] INFO WEBrick::HTTPServer#start: pid=247 port=9292
2020
```
2121

22+
Try with Hyperclient and `irb`.
23+
24+
```
25+
require 'hyperclient'
26+
```
27+
28+
Create some splines.
29+
30+
```ruby
31+
client = Hyperclient.new('http://localhost:9292/api')
32+
33+
3.times do |i|
34+
client.splines._post(spline: { name: i.to_s, reticulated: [true, false].sample })
35+
end
36+
```
37+
38+
Show splines.
39+
40+
```ruby
41+
client = Hyperclient.new('http://localhost:9292/api')
42+
43+
client.splines.each do |spline|
44+
puts "spline #{spline.id} #{spline.reticulated ? 'is' : 'is not'} reticulated"
45+
end
46+
```
47+
48+
Delete splines.
49+
50+
```ruby
51+
client = Hyperclient.new('http://localhost:9292/api')
52+
53+
client.splines.each(&:_delete)
54+
```
55+
2256
### Hello World
2357

2458
Navigate to [localhost:9292/api](http://localhost:9292/api) with a browser. This is a hypermedia API, so all links are clickable.

api/presenters/paginated_presenter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module PaginatedPresenter
1111
end
1212

1313
link :next do |opts|
14-
"#{request_url(opts)}#{query_string_for_cursor(represented[:next], opts)}" if represented.key?(:next)
14+
"#{request_url(opts)}#{query_string_for_cursor(represented[:next], opts)}" if represented[:next]
1515
end
1616

1717
private

0 commit comments

Comments
 (0)