uc3-dmp-api-core 0.0.9 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-api-core/paginator.rb +4 -4
- data/lib/uc3-dmp-api-core/responder.rb +1 -5
- data/lib/uc3-dmp-api-core/version.rb +1 -1
- data/lib/uc3-dmp-api-core.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2963d880fcee8d51bfb3778a181fd6fea3c12759bdfd310ce09dc2ddbcc5439f
|
4
|
+
data.tar.gz: 8f76723550f2e041049224b182f5f0b16c29ea48f1529ef1f98129db607bb667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d632347da9f3f7b057482eee4ff1de6d2951c3d2a011a4a9c51b26a173f5bb8a7d143ecb3cd0498d52707374bf0460adfcfefa4b3a4efdfb456d06d80ab5ee27
|
7
|
+
data.tar.gz: 72d7427e3081c77810b44101bad0167a77d86071781dcee1a0d6b9dd6cbf89c3334d1145548487b529c41343aad5306344f152d923e191e7cf4bd2ddadaee927
|
@@ -46,10 +46,10 @@ module Uc3DmpApiCore
|
|
46
46
|
|
47
47
|
# Fetch the current :page and :per_page from the params or use the defaults
|
48
48
|
def _current_page(item_count: 0, params: {})
|
49
|
-
page = params.fetch('page', DEFAULT_PAGE)
|
50
|
-
page = DEFAULT_PAGE if page.nil? || page <= 1
|
51
|
-
per_page = params.fetch('per_page', DEFAULT_PER_PAGE)
|
52
|
-
per_page = DEFAULT_PER_PAGE if per_page.nil? || per_page >= MAXIMUM_PER_PAGE || per_page < 1
|
49
|
+
page = params.fetch('page', DEFAULT_PAGE).to_i
|
50
|
+
page = DEFAULT_PAGE if page.nil? || page.to_i <= 1
|
51
|
+
per_page = params.fetch('per_page', DEFAULT_PER_PAGE).to_i
|
52
|
+
per_page = DEFAULT_PER_PAGE if per_page.nil? || per_page.to_i >= MAXIMUM_PER_PAGE || per_page.to_i < 1
|
53
53
|
|
54
54
|
total_pages = _page_count(total: item_count, per_page: per_page)
|
55
55
|
page = total_pages if page > total_pages
|
@@ -82,11 +82,7 @@ module Uc3DmpApiCore
|
|
82
82
|
def headers
|
83
83
|
return {} if ENV['CORS_ORIGIN'].nil?
|
84
84
|
|
85
|
-
{
|
86
|
-
'Access-Control-Allow-Headers': ENV.fetch('CORS_HEADERS', nil),
|
87
|
-
'Access-Control-Allow-Origin': ENV.fetch('CORS_ORIGIN', nil),
|
88
|
-
'Access-Control-Allow-Methods': ENV.fetch('CORS_METHODS', nil)
|
89
|
-
}
|
85
|
+
{ 'access-control-allow-origin': ENV['CORS_ORIGIN'] }
|
90
86
|
end
|
91
87
|
end
|
92
88
|
end
|
data/lib/uc3-dmp-api-core.rb
CHANGED
@@ -16,5 +16,7 @@ module Uc3DmpApiCore
|
|
16
16
|
MSG_SUCCESS = 'Success'
|
17
17
|
MSG_INVALID_ARGS = 'Invalid arguments.' # For HTTP 400 (Bad request)
|
18
18
|
MSG_SERVER_ERROR = 'Unable to process your request at this time.' # For HTTP 500 (Server error)
|
19
|
+
MSG_NOT_FOUND = 'Record not found'
|
20
|
+
MSG_FORBIDDEN = 'Unauthorized'
|
19
21
|
end
|
20
22
|
# rubocop:enable Naming/FileName
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-api-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|