pager_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +7 -7
- data/lib/pager_api/pagination/kaminari.rb +0 -1
- data/lib/pager_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c159819ca884e9159350451533063c135c89ac6
|
4
|
+
data.tar.gz: 9fec8569c260389a25f299cc138f95fa992672d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a231ce1af6ecb7c1d2c1bbb14bba3f981a380600d55245d8e7acde0d5f916d810e01c37ec1d3956ffba451b194a20361bcd06fccd5fc39b434e7b64cf23b20df
|
7
|
+
data.tar.gz: 020d52f3a0ba4e686f730c4f1b945e7fb7e131d6abce28803d9a2eb10c01c37fb3fbaee356fcca493a096077afd9f82c37809db82cacfa376b240655e57d6f7c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
![Pager](http://iplp.com/pagers/images/448/Gold+Alphanumeric+Pager+-+2871+-+3+-+400.jpg)
|
4
4
|
|
5
|
-
API Pagination
|
5
|
+
API Pagination done right. Pager API is a library to help you add `meta` information and the adecuate header with pagination information based on the [JSON API standard](http://jsonapi.org) for your Rails app.
|
6
6
|
|
7
7
|
## Table of contents
|
8
8
|
- [Quick start](#quick-start)
|
@@ -18,7 +18,7 @@ API Pagination made it right. Pager API is a library to help you add `meta` info
|
|
18
18
|
|
19
19
|
## Quick Start
|
20
20
|
|
21
|
-
`pager_api` depends on [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate) to handle pagination. You need to add one of these to your Gemfile:
|
21
|
+
`pager_api` depends on [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate) to handle pagination. You need to add one of these gems to your Gemfile **before** the `pager_api` gem:
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
# gem 'will_paginate'
|
@@ -44,11 +44,11 @@ The gem comes with an installer for you to configure it, for example to switch b
|
|
44
44
|
|
45
45
|
This will create a file under the `initializers` directory called `pager_api.rb`. You can easily configure it there to meet your needs.
|
46
46
|
|
47
|
-
By default `pager_api` uses [Kaminari](https://github.com/amatsuda/kaminari).
|
47
|
+
By default `pager_api` uses [Kaminari](https://github.com/amatsuda/kaminari). Configure the `pager_api.rb` initializer in order to use [WillPaginate](https://github.com/mislav/will_paginate).
|
48
48
|
|
49
49
|
## Usage
|
50
50
|
|
51
|
-
|
51
|
+
In the controller where you are providing a paginated collection, you may have something like this:
|
52
52
|
|
53
53
|
```ruby
|
54
54
|
class UsersController < ApplicationController
|
@@ -64,7 +64,7 @@ class UsersController < ApplicationController
|
|
64
64
|
end
|
65
65
|
```
|
66
66
|
|
67
|
-
With `pager_api` is really easy to achieve
|
67
|
+
With `pager_api` it is really easy to achieve the above by:
|
68
68
|
|
69
69
|
```ruby
|
70
70
|
class UsersController < ApplicationController
|
@@ -109,7 +109,7 @@ By default it will also include a `Link` header with the following information:
|
|
109
109
|
# <http://example.com/api/v1/users?page="1">; rel="prev",
|
110
110
|
```
|
111
111
|
|
112
|
-
The header will be created with the corresponding `first`, `last`, `prev` and `next
|
112
|
+
The header will be created with the corresponding `first`, `last`, `prev` and `next` links.
|
113
113
|
|
114
114
|
## Bug tracker & feature request
|
115
115
|
|
@@ -117,7 +117,7 @@ Have a bug or a feature request? [Please open a new issue](https://github.com/Ic
|
|
117
117
|
|
118
118
|
## Contributing
|
119
119
|
|
120
|
-
Please submit all pull requests against a separate branch. Although
|
120
|
+
Please submit all pull requests against a separate branch. Although `pager_api` does not have tests yet, be a nice guy and add some for your feature. We'll be working hard to add them too.
|
121
121
|
|
122
122
|
In case you are wondering what to attack, we have a milestone with the version to work, some fixes and refactors. Feel free to start one.
|
123
123
|
|
data/lib/pager_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pager_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abraham Kuri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|