uc3-dmp-api-core 0.0.8 → 0.0.10

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: b372c891259df150205f23eb61ad9c9c68951126c4bc4f1d5fd0d32ab4dd3ff2
4
- data.tar.gz: '0508bbdf68392163c5a13900fd99c61823c090819d68aae5fb0e7dbfb0a62813'
3
+ metadata.gz: 63205a96813c40c4f0b7969dc629d998c263187277748bc1d934ff62f6a35fe4
4
+ data.tar.gz: ad1dfc82eb0fc361ca63b2acf2cc898f7cf8749f4fee9e9b43d8c1e7aa8827c5
5
5
  SHA512:
6
- metadata.gz: ce17d75b93aea0290a32af242b675eb615a85361fdef226ed860d10df6c1cb4d22f6cf038ce9e4b03259c793ba4241d838012dfaf9cbc8f8142922d095bf8995
7
- data.tar.gz: 0e3fb0a4d917ad4730ec6bebefbd450d993d140c7d790bb8408dbbd7b5022b7eab0d446f07c2e5cc2906f4b1bf4d279a454121b232214ef91a8e89c4e15cb683
6
+ metadata.gz: a6283ea52aa5caa6f2e03a0bd147796d16edc52642f93fa9e33320911d0b56ecaf7b7211de871fe642536ea7cd0f1b9ee2ca026b989c302d86d4b147355643c8
7
+ data.tar.gz: fd08016205d931d6ab40bb74df0893bc862b2b216da306cd9546b29fb8a35bd85a782c5654846531dccf1474c34aafb9f667f3632044b09fa2c9a68ff6ae7dfb
@@ -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
@@ -44,7 +44,7 @@ module Uc3DmpApiCore
44
44
  body = body.merge(Paginator.pagination_meta(url: url, item_count: item_count, params: args))
45
45
 
46
46
  # If this is a server error, then notify the administrator!
47
- Logger.log_error(source: url, message: errors, details: body, event: args[:event]) if status.to_s[0] == '5'
47
+ LogWriter.log_error(source: url, message: errors, details: body, event: args[:event]) if status.to_s[0] == '5'
48
48
 
49
49
  { statusCode: status.to_i, body: body.compact.to_json, headers: headers }
50
50
  rescue StandardError => e
@@ -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.8'
4
+ VERSION = '0.0.10'
5
5
  end
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.8
4
+ version: 0.0.10
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-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json