api-pagination 4.7.1 → 4.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4cf55ba5db9b488ae0e9e16e9d14b839a8ada930697c39c00d1192f7cfc5456
4
- data.tar.gz: a79c32b444ab9b6b84d3f5bbf6312feb46a031ae5ee8b930b3dd553456b207d2
3
+ metadata.gz: fcd1a8e55bce363ef14c8fca2ff4a06ea1cf325e61fe2eba564d6bcbcb0cbb43
4
+ data.tar.gz: 66a8a77cc4e1fa163ce3e644c2828388778efaab24783967c2c9e7986a83ac30
5
5
  SHA512:
6
- metadata.gz: 6208062d94a1f57d62be3cbf2cd552d6fe86a2af30ae3dde1d2efe1f3ff2c629215ec69aa6c5fd04452ce99be6e79c9395af76a0821e5f4fb039d44c470b8d44
7
- data.tar.gz: c91fa40ad83fade4d1d76f0977828b7263d07b6d5d3b1b47e76a65f9fb3bd8530ed143548b6b89e8ba1b1f73b0a04a3498cd0bfb0e3f4541a379aad4e4b5ac38
6
+ metadata.gz: 475209b5986a009d9bc52cded5269fec22998e6d94c419635772950ee17ea7a1b0a01818b6791f009fe9da545022522f2ba0303a5fae93d81a364f3bc740cb1e
7
+ data.tar.gz: 355d8e7786bf49318941d48ea57ff6fd81fd6cf9b97d9e185fb1302eb20dc4144100f3fce675809d73bffc0341b0f100e37fb3f12a2e6c51ea9b98e4d9db5a03
@@ -1,26 +1,3 @@
1
- begin; require 'rails'; rescue LoadError; end
2
- begin; require 'rails-api'; rescue LoadError; end
3
-
4
- if defined?(Rails)
5
- module ApiPagination
6
- module Hooks
7
- def self.rails_parent_controller
8
- if Gem::Version.new(Rails.version) >= Gem::Version.new('5') || defined?(ActionController::API)
9
- ActionController::API
10
- else
11
- ActionController::Base
12
- end
13
- end
14
- end
15
- end
16
-
17
- require 'rails/pagination'
18
-
19
- ActiveSupport.on_load(:action_controller) do
20
- ApiPagination::Hooks.rails_parent_controller.send(:include, Rails::Pagination)
21
- end
22
- end
23
-
24
1
  begin; require 'grape'; rescue LoadError; end
25
2
  if defined?(Grape::API)
26
3
  require 'grape/pagination'
@@ -40,3 +17,18 @@ unless defined?(Kaminari) || defined?(WillPaginate::CollectionMethods)
40
17
  WARNING
41
18
  end
42
19
 
20
+ if defined?(Rails)
21
+ module ApiPagination
22
+ module Hooks
23
+ def self.rails_parent_controller
24
+ if Rails::VERSION::MAJOR >= 5 || defined?(ActionController::API)
25
+ ActionController::API
26
+ else
27
+ ActionController::Base
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ require 'api-pagination/railtie'
34
+ end
@@ -0,0 +1,19 @@
1
+ require 'rails/railtie'
2
+
3
+ module ApiPagination
4
+ class Railtie < ::Rails::Railtie
5
+ initializer :api_pagination do
6
+ ActiveSupport.on_load(:action_controller) do
7
+ require 'rails/pagination'
8
+
9
+ klass = if Rails::VERSION::MAJOR >= 5 || defined?(ActionController::API)
10
+ ActionController::API
11
+ else
12
+ ActionController::Base
13
+ end
14
+
15
+ klass.send(:include, Rails::Pagination)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -2,7 +2,7 @@ module ApiPagination
2
2
  class Version
3
3
  MAJOR = 4
4
4
  MINOR = 7
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].join('.')
@@ -1,4 +1,4 @@
1
- require 'action_controller'
1
+ require 'action_controller/railtie'
2
2
  require 'api-pagination/hooks'
3
3
  require 'ostruct'
4
4
 
@@ -59,7 +59,7 @@ class NumbersSerializer
59
59
  end
60
60
  end
61
61
 
62
- class NumbersController < ApiPagination::Hooks.rails_parent_controller
62
+ class NumbersController < ActionController::API
63
63
  include Rails.application.routes.url_helpers
64
64
 
65
65
  def index
@@ -99,3 +99,5 @@ class NumbersController < ApiPagination::Hooks.rails_parent_controller
99
99
  render json: NumbersSerializer.new(numbers)
100
100
  end
101
101
  end
102
+
103
+ ApiPagination::Railtie.initializers.each(&:run)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.1
4
+ version: 4.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-25 00:00:00.000000000 Z
11
+ date: 2018-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0
47
+ version: 5.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.0
54
+ version: 5.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: actionpack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.0
61
+ version: 5.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.0.0
68
+ version: 5.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sequel
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +90,7 @@ files:
90
90
  - lib/api-pagination.rb
91
91
  - lib/api-pagination/configuration.rb
92
92
  - lib/api-pagination/hooks.rb
93
+ - lib/api-pagination/railtie.rb
93
94
  - lib/api-pagination/version.rb
94
95
  - lib/grape/pagination.rb
95
96
  - lib/rails/pagination.rb