otpor 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/otpor/json_response.rb +17 -1
- data/lib/otpor/templates/shared/response.json.jbuilder +1 -0
- data/lib/otpor/version.rb +1 -1
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4340270f71be5b4cbd00baccd71c95a2c033a39471929a462fb03afde8130aa8
|
4
|
+
data.tar.gz: a409d5bda7dece03040e0dcb2cf4708aa17d686e554526430309246aa961562f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef54d3dd06854ec8c2fd6eccb796d67b8e6593e178c2586465d9728ae621f328814fde258bb7da2b25d71127b2f5bf73834bd98724f46c1119f7341bf10bebe8
|
7
|
+
data.tar.gz: 1ad41976acf90f647ca04b7d9d9857a9102211390c19fe25f192fdf864e04e02c8e360a955d0165deea90db6a2faa64f8ed2306fab2f2eb3ac3b0bc3aff59128
|
data/lib/otpor/json_response.rb
CHANGED
@@ -103,7 +103,23 @@ module Otpor
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def infer_meta
|
106
|
-
|
106
|
+
pagination = infer_pagination
|
107
|
+
api_version = infer_api_version
|
108
|
+
|
109
|
+
return nil if pagination.nil? && api_version.nil?
|
110
|
+
|
111
|
+
meta = {}
|
112
|
+
meta = meta.merge(pagination) if pagination.present?
|
113
|
+
meta = meta.merge(api_version) if api_version.present?
|
114
|
+
meta
|
115
|
+
end
|
116
|
+
|
117
|
+
def infer_api_version
|
118
|
+
{ api_version: "v#{::Regexp.last_match(1)}" } if request.path =~ %r{/v(\d+)/}
|
119
|
+
end
|
120
|
+
|
121
|
+
def infer_pagination
|
122
|
+
@instance_variables.each do |_key, value|
|
107
123
|
next unless value.respond_to?(:total_pages)
|
108
124
|
|
109
125
|
return {
|
data/lib/otpor/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: otpor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renan Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: jbuilder
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.12.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.12.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: kaminari
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 5.0.0
|
48
48
|
type: :runtime
|
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:
|
54
|
+
version: 5.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: request_store
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +110,10 @@ files:
|
|
110
110
|
homepage: https://github.com/renan-garcia/otpor
|
111
111
|
licenses:
|
112
112
|
- MIT
|
113
|
-
metadata:
|
113
|
+
metadata:
|
114
|
+
changelog_uri: https://github.com/renan-garcia/otpor/main/CHANGELOG.md
|
115
|
+
source_code_uri: https://github.com/renan-garcia/otpor/
|
116
|
+
rubygems_mfa_required: 'true'
|
114
117
|
post_install_message:
|
115
118
|
rdoc_options: []
|
116
119
|
require_paths:
|