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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ccb9f74dc7a84cce5b0d2efb7c4755c856d8b3dde24d0fb5d2e8576d3ccd6dc
4
- data.tar.gz: 93aab052eb9761a83c3e27a92d25d863473c3b2d121266d1826e136977f1e482
3
+ metadata.gz: 2963d880fcee8d51bfb3778a181fd6fea3c12759bdfd310ce09dc2ddbcc5439f
4
+ data.tar.gz: 8f76723550f2e041049224b182f5f0b16c29ea48f1529ef1f98129db607bb667
5
5
  SHA512:
6
- metadata.gz: 2d08ab473241901017b84572788b7618b6a6d73d2a23208e799c405182190d75fc3a88573d83f4268d037f3d388505a36f7818bd3c403f4878ac2ca8b033c9e0
7
- data.tar.gz: 7b5274264db61d0781238f777b0cba675cbcd36656128a2b5ee32e52696bfa35a6538a78bf49e69bf8a0108de5ac29761a212cc6936273a2ec4b4702ba070015
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpApiCore
4
- VERSION = '0.0.9'
4
+ VERSION = '0.0.11'
5
5
  end
@@ -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.9
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-05-02 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json