api_pagination_headers 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +109 -0
- data/MIT-LICENSE +20 -0
- data/README.md +49 -0
- data/Rakefile +8 -0
- data/api_pagination_headers.gemspec +23 -0
- data/lib/api_pagination_headers.rb +28 -0
- data/lib/api_pagination_headers/version.rb +3 -0
- data/spec/controllers/posts_controller_spec.rb +101 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/posts_controller.rb +8 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +17 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/migrate/20131001123917_create_posts.rb +9 -0
- data/spec/dummy/db/schema.rb +22 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/posts.rb +6 -0
- data/spec/spec_helper.rb +17 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35814c87aed688c6c42e3fa945a6bb03577c655b
|
4
|
+
data.tar.gz: 4de3bfa064064a4a779911fbea668d333f63ad0c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 204c618c1da93248ccff5ea218dab5ca501bd4930dbd43cbca5be9805cb893ffe564371266809df85911a8703250018dd2d42e1a14a135af5bb34bd0f1edd0ca
|
7
|
+
data.tar.gz: 4d3918d4c766aeb69f582374000cc9c840be70473de6b122a6f91e940b1f890804befcde616dfd97451322c36353c300c20616990153c4400b20464ce12ce907
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
api_pagination_headers (1.0.0)
|
5
|
+
rails (~> 4.0.0)
|
6
|
+
will_paginate (~> 3.0.5)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (4.0.0)
|
12
|
+
actionpack (= 4.0.0)
|
13
|
+
mail (~> 2.5.3)
|
14
|
+
actionpack (4.0.0)
|
15
|
+
activesupport (= 4.0.0)
|
16
|
+
builder (~> 3.1.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
rack (~> 1.5.2)
|
19
|
+
rack-test (~> 0.6.2)
|
20
|
+
activemodel (4.0.0)
|
21
|
+
activesupport (= 4.0.0)
|
22
|
+
builder (~> 3.1.0)
|
23
|
+
activerecord (4.0.0)
|
24
|
+
activemodel (= 4.0.0)
|
25
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
26
|
+
activesupport (= 4.0.0)
|
27
|
+
arel (~> 4.0.0)
|
28
|
+
activerecord-deprecated_finders (1.0.3)
|
29
|
+
activesupport (4.0.0)
|
30
|
+
i18n (~> 0.6, >= 0.6.4)
|
31
|
+
minitest (~> 4.2)
|
32
|
+
multi_json (~> 1.3)
|
33
|
+
thread_safe (~> 0.1)
|
34
|
+
tzinfo (~> 0.3.37)
|
35
|
+
arel (4.0.0)
|
36
|
+
atomic (1.1.14)
|
37
|
+
builder (3.1.4)
|
38
|
+
diff-lcs (1.2.4)
|
39
|
+
erubis (2.7.0)
|
40
|
+
factory_girl (4.2.0)
|
41
|
+
activesupport (>= 3.0.0)
|
42
|
+
factory_girl_rails (4.2.1)
|
43
|
+
factory_girl (~> 4.2.0)
|
44
|
+
railties (>= 3.0.0)
|
45
|
+
hike (1.2.3)
|
46
|
+
i18n (0.6.5)
|
47
|
+
mail (2.5.4)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.25)
|
51
|
+
minitest (4.7.5)
|
52
|
+
multi_json (1.8.0)
|
53
|
+
polyglot (0.3.3)
|
54
|
+
rack (1.5.2)
|
55
|
+
rack-test (0.6.2)
|
56
|
+
rack (>= 1.0)
|
57
|
+
rails (4.0.0)
|
58
|
+
actionmailer (= 4.0.0)
|
59
|
+
actionpack (= 4.0.0)
|
60
|
+
activerecord (= 4.0.0)
|
61
|
+
activesupport (= 4.0.0)
|
62
|
+
bundler (>= 1.3.0, < 2.0)
|
63
|
+
railties (= 4.0.0)
|
64
|
+
sprockets-rails (~> 2.0.0)
|
65
|
+
railties (4.0.0)
|
66
|
+
actionpack (= 4.0.0)
|
67
|
+
activesupport (= 4.0.0)
|
68
|
+
rake (>= 0.8.7)
|
69
|
+
thor (>= 0.18.1, < 2.0)
|
70
|
+
rake (10.1.0)
|
71
|
+
rspec-core (2.14.5)
|
72
|
+
rspec-expectations (2.14.3)
|
73
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
74
|
+
rspec-mocks (2.14.3)
|
75
|
+
rspec-rails (2.14.0)
|
76
|
+
actionpack (>= 3.0)
|
77
|
+
activesupport (>= 3.0)
|
78
|
+
railties (>= 3.0)
|
79
|
+
rspec-core (~> 2.14.0)
|
80
|
+
rspec-expectations (~> 2.14.0)
|
81
|
+
rspec-mocks (~> 2.14.0)
|
82
|
+
sprockets (2.10.0)
|
83
|
+
hike (~> 1.2)
|
84
|
+
multi_json (~> 1.0)
|
85
|
+
rack (~> 1.0)
|
86
|
+
tilt (~> 1.1, != 1.3.0)
|
87
|
+
sprockets-rails (2.0.0)
|
88
|
+
actionpack (>= 3.0)
|
89
|
+
activesupport (>= 3.0)
|
90
|
+
sprockets (~> 2.8)
|
91
|
+
sqlite3 (1.3.8)
|
92
|
+
thor (0.18.1)
|
93
|
+
thread_safe (0.1.3)
|
94
|
+
atomic
|
95
|
+
tilt (1.4.1)
|
96
|
+
treetop (1.4.15)
|
97
|
+
polyglot
|
98
|
+
polyglot (>= 0.3.1)
|
99
|
+
tzinfo (0.3.37)
|
100
|
+
will_paginate (3.0.5)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
ruby
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
api_pagination_headers!
|
107
|
+
factory_girl_rails
|
108
|
+
rspec-rails
|
109
|
+
sqlite3
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Richard Käll
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#api_pagination_headers [![Build Status](https://travis-ci.org/richardkall/api_pagination_headers.png)](http://travis-ci.org/richardkall/api_pagination_headers) [![Dependency Status](https://gemnasium.com/richardkall/api_pagination_headers.png)](https://gemnasium.com/richardkall/api_pagination_headers)
|
2
|
+
|
3
|
+
api_pagination_headers is a gem that adds pagination info to a `Link` response header. This is considered to be the [best practice](http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#pagination) for REST APIs and is currently used by [GitHub](http://developer.github.com/v3/#pagination). It also adds the total number of records into a `X-Total-Count` header.
|
4
|
+
|
5
|
+
Example:
|
6
|
+
|
7
|
+
```
|
8
|
+
Link: <http://example.com/posts?page=2&per_page=10>;rel="next",<http://example.com/posts?page=2&per_page=10>;rel="last"
|
9
|
+
X-Total-Count: 11
|
10
|
+
```
|
11
|
+
|
12
|
+
##Installation
|
13
|
+
|
14
|
+
Include in your Gemfile:
|
15
|
+
|
16
|
+
```
|
17
|
+
gem 'api_pagination_headers'
|
18
|
+
gem 'will_paginate'
|
19
|
+
```
|
20
|
+
|
21
|
+
Only tested with [will_paginate](https://github.com/mislav/will_paginate) at the moment, but should be easily customized for any other pagination gem.
|
22
|
+
|
23
|
+
Support for [rails-api](https://github.com/rails-api/rails-api) is built in.
|
24
|
+
|
25
|
+
##Usage
|
26
|
+
|
27
|
+
In the controller:
|
28
|
+
|
29
|
+
```
|
30
|
+
class PostsController < ApplicationController
|
31
|
+
after_action only: [:index] { set_pagination_headers(:posts) }
|
32
|
+
|
33
|
+
def index
|
34
|
+
@posts = Post.all.paginate(per_page: params[:per_page], page: params[:page])
|
35
|
+
respond_with @posts
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
##Contributing
|
41
|
+
|
42
|
+
1. Fork it
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create a new Pull Request
|
47
|
+
|
48
|
+
##License
|
49
|
+
Copyright © 2013 [Richard Käll](http://richardkall.se). Licensed under the MIT license.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'api_pagination_headers/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'api_pagination_headers'
|
7
|
+
s.version = ApiPaginationHeaders::VERSION
|
8
|
+
s.authors = ['Richard Käll']
|
9
|
+
s.email = ['richard.kall@me.com']
|
10
|
+
s.homepage = 'https://github.com/richardkall/api_pagination_headers'
|
11
|
+
s.summary = 'Link header pagination for APIs'
|
12
|
+
s.description = 'Add pagination info to the response headers, GitHub style.'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split($/)
|
15
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
|
+
|
17
|
+
s.add_dependency 'rails', '~> 4.0.0'
|
18
|
+
s.add_dependency 'will_paginate', '~> 3.0.5'
|
19
|
+
|
20
|
+
s.add_development_dependency 'factory_girl_rails'
|
21
|
+
s.add_development_dependency 'sqlite3'
|
22
|
+
s.add_development_dependency 'rspec-rails'
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ApiPaginationHeaders
|
2
|
+
protected
|
3
|
+
|
4
|
+
def set_pagination_headers(name)
|
5
|
+
scope = instance_variable_get("@#{name}")
|
6
|
+
request_params = request.query_parameters
|
7
|
+
url_without_params = request.url.split('?').first
|
8
|
+
per_page = params[:per_page] ? params[:per_page].to_i : WillPaginate.per_page
|
9
|
+
|
10
|
+
page = {}
|
11
|
+
page[:first] = 1 if scope.total_pages > 1 && scope.current_page > 1
|
12
|
+
page[:prev] = scope.current_page - 1 if scope.current_page > 1
|
13
|
+
page[:next] = scope.current_page + 1 if scope.current_page < scope.total_pages
|
14
|
+
page[:last] = scope.total_pages if scope.total_pages > 1 && scope.current_page < scope.total_pages
|
15
|
+
|
16
|
+
pagination_links = []
|
17
|
+
page.each do |key, value|
|
18
|
+
new_request_hash = request_params.merge({ page: value, per_page: per_page })
|
19
|
+
pagination_links << "<#{url_without_params}?#{new_request_hash.to_param}>; rel=\"#{key}\""
|
20
|
+
end
|
21
|
+
|
22
|
+
headers['Link'] = pagination_links.join(', ') unless pagination_links.empty?
|
23
|
+
headers['X-Total-Count'] = "#{scope.total_entries}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
ActionController::Base.send(:include, ApiPaginationHeaders) if defined?(ActionController::Base)
|
28
|
+
ActionController::API.send(:include, ApiPaginationHeaders) if defined?(ActionController::API)
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PostsController, '#index' do
|
4
|
+
context 'when one page' do
|
5
|
+
before { FactoryGirl.create(:post) }
|
6
|
+
|
7
|
+
it 'does not respond with Link header' do
|
8
|
+
get :index, format: :json
|
9
|
+
expect(response.headers).not_to include('Link')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'responds with X-Total-Count header' do
|
13
|
+
get :index, format: :json
|
14
|
+
expect(response.headers['X-Total-Count']).to eq('1')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when two pages' do
|
19
|
+
before { FactoryGirl.create_list(:post, 2) }
|
20
|
+
|
21
|
+
context 'current page is first page' do
|
22
|
+
it 'responds with Link header' do
|
23
|
+
get :index, format: :json
|
24
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 2, per_page: 1, format: :json)}>; rel=\"next\", <#{posts_url(page: 2, per_page: 1, format: :json)}>; rel=\"last\"")
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'responds with X-Total-Count header' do
|
28
|
+
get :index, format: :json
|
29
|
+
expect(response.headers['X-Total-Count']).to eq('2')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'current page is last page' do
|
34
|
+
it 'responds with Link header' do
|
35
|
+
get :index, page: 2, format: :json
|
36
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 1, per_page: 1, format: :json)}>; rel=\"first\", <#{posts_url(page: 1, per_page: 1, format: :json)}>; rel=\"prev\"")
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'responds with X-Total-Count header' do
|
40
|
+
get :index, format: :json
|
41
|
+
expect(response.headers['X-Total-Count']).to eq('2')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when three pages' do
|
47
|
+
before { FactoryGirl.create_list(:post, 3) }
|
48
|
+
|
49
|
+
context 'current page is 1/3' do
|
50
|
+
it 'responds with Link header' do
|
51
|
+
get :index, format: :json
|
52
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 2, per_page: 1, format: :json)}>; rel=\"next\", <#{posts_url(page: 3, per_page: 1, format: :json)}>; rel=\"last\"")
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'responds with X-Total-Count header' do
|
56
|
+
get :index, format: :json
|
57
|
+
expect(response.headers['X-Total-Count']).to eq('3')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'current page is 2/3' do
|
62
|
+
it 'responds with Link header' do
|
63
|
+
get :index, page: 2, format: :json
|
64
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 1, per_page: 1, format: :json)}>; rel=\"first\", <#{posts_url(page: 1, per_page: 1, format: :json)}>; rel=\"prev\", <#{posts_url(page: 3, per_page: 1, format: :json)}>; rel=\"next\", <#{posts_url(page: 3, per_page: 1, format: :json)}>; rel=\"last\"")
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'responds with X-Total-Count header' do
|
68
|
+
get :index, format: :json
|
69
|
+
expect(response.headers['X-Total-Count']).to eq('3')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'current page is 3/3' do
|
74
|
+
it 'responds with Link header' do
|
75
|
+
get :index, page: 3, format: :json
|
76
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 1, per_page: 1, format: :json)}>; rel=\"first\", <#{posts_url(page: 2, per_page: 1, format: :json)}>; rel=\"prev\"")
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'responds with X-Total-Count header' do
|
80
|
+
get :index, format: :json
|
81
|
+
expect(response.headers['X-Total-Count']).to eq('3')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when request has per_page param' do
|
87
|
+
it 'changes per_page value in Link header' do
|
88
|
+
FactoryGirl.create_list(:post, 3)
|
89
|
+
get :index, per_page: 2, format: :json
|
90
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 2, per_page: 2, format: :json)}>; rel=\"next\", <#{posts_url(page: 2, per_page: 2, format: :json)}>; rel=\"last\"")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'when request has other params' do
|
95
|
+
it 'adds params to Link header' do
|
96
|
+
FactoryGirl.create_list(:post, 2)
|
97
|
+
get :index, order: 'asc', format: :json
|
98
|
+
expect(response.headers['Link']).to eq("<#{posts_url(page: 2, per_page: 1, order: 'asc', format: :json)}>; rel=\"next\", <#{posts_url(page: 2, per_page: 1, order: 'asc', format: :json)}>; rel=\"last\"")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
data/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'active_record/railtie'
|
4
|
+
require 'action_controller/railtie'
|
5
|
+
require 'action_mailer/railtie'
|
6
|
+
|
7
|
+
Bundler.require(*Rails.groups)
|
8
|
+
require 'api_pagination_headers'
|
9
|
+
require 'will_paginate'
|
10
|
+
|
11
|
+
module Dummy
|
12
|
+
class Application < Rails::Application
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Rails.application.routes.default_url_options[:host] = 'test.host'
|
17
|
+
WillPaginate.per_page = 1
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
37
|
+
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
47
|
+
|
48
|
+
# Prepend all log lines with the following tags.
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
+
|
51
|
+
# Use a different logger for distributed setups.
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
+
|
54
|
+
# Use a different cache store in production.
|
55
|
+
# config.cache_store = :mem_cache_store
|
56
|
+
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
+
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
+
# config.assets.precompile += %w( search.js )
|
63
|
+
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
+
# config.action_mailer.raise_delivery_errors = false
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Send deprecation notices to registered listeners.
|
73
|
+
config.active_support.deprecation = :notify
|
74
|
+
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
76
|
+
# config.autoflush_log = false
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
80
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '943acfc8eed1cfad81ef39ad1a8e97a627c4b440f3d31ce835fbb9eff02f3d2007a53bb5288e31339fbb70dca7944ba841f29a6758176c0931b7e6f75263978f'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20131001123917) do
|
15
|
+
|
16
|
+
create_table "posts", force: true do |t|
|
17
|
+
t.string "content"
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
ENV['RAILS_ENV'] = 'test'
|
2
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
3
|
+
require 'rspec/rails'
|
4
|
+
require 'rspec/autorun'
|
5
|
+
require 'factory_girl_rails'
|
6
|
+
|
7
|
+
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.order = 'random'
|
11
|
+
config.include Rails.application.routes.url_helpers
|
12
|
+
|
13
|
+
config.after(:each) do
|
14
|
+
Post.destroy_all
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: api_pagination_headers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Käll
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: will_paginate
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: factory_girl_rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Add pagination info to the response headers, GitHub style.
|
84
|
+
email:
|
85
|
+
- richard.kall@me.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- MIT-LICENSE
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- api_pagination_headers.gemspec
|
98
|
+
- lib/api_pagination_headers.rb
|
99
|
+
- lib/api_pagination_headers/version.rb
|
100
|
+
- spec/controllers/posts_controller_spec.rb
|
101
|
+
- spec/dummy/Rakefile
|
102
|
+
- spec/dummy/app/assets/images/.keep
|
103
|
+
- spec/dummy/app/assets/javascripts/application.js
|
104
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
105
|
+
- spec/dummy/app/controllers/application_controller.rb
|
106
|
+
- spec/dummy/app/controllers/concerns/.keep
|
107
|
+
- spec/dummy/app/controllers/posts_controller.rb
|
108
|
+
- spec/dummy/app/helpers/application_helper.rb
|
109
|
+
- spec/dummy/app/mailers/.keep
|
110
|
+
- spec/dummy/app/models/.keep
|
111
|
+
- spec/dummy/app/models/concerns/.keep
|
112
|
+
- spec/dummy/app/models/post.rb
|
113
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
114
|
+
- spec/dummy/bin/bundle
|
115
|
+
- spec/dummy/bin/rails
|
116
|
+
- spec/dummy/bin/rake
|
117
|
+
- spec/dummy/config.ru
|
118
|
+
- spec/dummy/config/application.rb
|
119
|
+
- spec/dummy/config/boot.rb
|
120
|
+
- spec/dummy/config/database.yml
|
121
|
+
- spec/dummy/config/environment.rb
|
122
|
+
- spec/dummy/config/environments/development.rb
|
123
|
+
- spec/dummy/config/environments/production.rb
|
124
|
+
- spec/dummy/config/environments/test.rb
|
125
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
126
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
127
|
+
- spec/dummy/config/initializers/inflections.rb
|
128
|
+
- spec/dummy/config/initializers/mime_types.rb
|
129
|
+
- spec/dummy/config/initializers/secret_token.rb
|
130
|
+
- spec/dummy/config/initializers/session_store.rb
|
131
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
132
|
+
- spec/dummy/config/locales/en.yml
|
133
|
+
- spec/dummy/config/routes.rb
|
134
|
+
- spec/dummy/db/migrate/20131001123917_create_posts.rb
|
135
|
+
- spec/dummy/db/schema.rb
|
136
|
+
- spec/dummy/lib/assets/.keep
|
137
|
+
- spec/dummy/log/.keep
|
138
|
+
- spec/dummy/public/404.html
|
139
|
+
- spec/dummy/public/422.html
|
140
|
+
- spec/dummy/public/500.html
|
141
|
+
- spec/dummy/public/favicon.ico
|
142
|
+
- spec/factories/posts.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
homepage: https://github.com/richardkall/api_pagination_headers
|
145
|
+
licenses: []
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.0.3
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: Link header pagination for APIs
|
167
|
+
test_files: []
|