uc3-dmp-external-api 0.0.16 → 0.0.18
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-external-api/client.rb +11 -11
- data/lib/uc3-dmp-external-api/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f90d4ddb8fb538b69df2a510db26b9300e35cb4f3936719ea01c32c32d756243
|
4
|
+
data.tar.gz: a40ed845c95bbd18281c452b5761c1eb55b7f0180e2d62ad5ee84c22aee16693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b5ce219aa58b60e3b3ae00c68bcb5a1570a9abe70d9707096e190ae618de5b47bfe8d9f2895044dab06afaf07949b012cee44634beef4ebf7018f1c0df10ca
|
7
|
+
data.tar.gz: 6dd47fe3f8f7ebf63f1809b359bba1aafea396037c19023fd11d2be12c2bec9b8fead80d5ca7b82a56fe672bee166ea230c1a70bc258f7e400845aaac86e1eb4
|
@@ -17,27 +17,27 @@ module Uc3DmpExternalApi
|
|
17
17
|
|
18
18
|
class << self
|
19
19
|
# Call the specified URL using the specified HTTP method, body and headers
|
20
|
-
# rubocop:disable Metrics/AbcSize
|
20
|
+
# rubocop:disable Metrics/AbcSize, Metrics/ParameterLists
|
21
21
|
def call(url:, method: :get, body: '', basic_auth: {}, additional_headers: {}, logger: nil)
|
22
|
-
uri = URI(url)
|
22
|
+
uri = URI(URI.encode_uri_component(url))
|
23
23
|
# Skip the body if we are doing a get
|
24
24
|
body = nil if method.to_sym == :get
|
25
|
-
opts = _options(body
|
25
|
+
opts = _options(body:, basic_auth:, additional_headers:, logger:)
|
26
26
|
resp = HTTParty.send(method.to_sym, uri, opts)
|
27
27
|
|
28
|
-
|
28
|
+
unless [200, 201].include?(resp.code)
|
29
29
|
msg = "status: #{resp&.code}, body: #{resp&.body}"
|
30
|
-
raise ExternalApiError, "#{format(MSG_ERROR_FROM_EXTERNAL_API, url:
|
30
|
+
raise ExternalApiError, "#{format(MSG_ERROR_FROM_EXTERNAL_API, url:)} - #{msg}"
|
31
31
|
end
|
32
|
-
resp.body.nil? || resp.body.empty? ? nil : _process_response(resp:
|
32
|
+
resp.body.nil? || resp.body.empty? ? nil : _process_response(resp:)
|
33
33
|
rescue JSON::ParserError
|
34
|
-
raise ExternalApiError, format(MSG_UNABLE_TO_PARSE, url:
|
34
|
+
raise ExternalApiError, format(MSG_UNABLE_TO_PARSE, url:)
|
35
35
|
rescue HTTParty::Error => e
|
36
|
-
raise ExternalApiError, "#{format(MSG_HTTPARTY_ERR, url:
|
36
|
+
raise ExternalApiError, "#{format(MSG_HTTPARTY_ERR, url:)} - #{e.message}"
|
37
37
|
rescue URI::InvalidURIError
|
38
|
-
raise ExternalApiError, format(MSG_INVALID_URI, url:
|
38
|
+
raise ExternalApiError, format(MSG_INVALID_URI, url:)
|
39
39
|
end
|
40
|
-
# rubocop:enable Metrics/AbcSize
|
40
|
+
# rubocop:enable Metrics/AbcSize, Metrics/ParameterLists
|
41
41
|
|
42
42
|
private
|
43
43
|
|
@@ -63,7 +63,7 @@ module Uc3DmpExternalApi
|
|
63
63
|
|
64
64
|
# Prepare the HTTParty gem options
|
65
65
|
def _options(body:, basic_auth: nil, additional_headers: {}, logger: nil)
|
66
|
-
hdrs = _headers(additional_headers:
|
66
|
+
hdrs = _headers(additional_headers:)
|
67
67
|
opts = {
|
68
68
|
headers: hdrs,
|
69
69
|
follow_redirects: true,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-external-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sns
|
@@ -152,7 +152,7 @@ licenses:
|
|
152
152
|
- MIT
|
153
153
|
metadata:
|
154
154
|
rubygems_mfa_required: 'false'
|
155
|
-
post_install_message:
|
155
|
+
post_install_message:
|
156
156
|
rdoc_options: []
|
157
157
|
require_paths:
|
158
158
|
- lib
|
@@ -160,15 +160,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
160
|
requirements:
|
161
161
|
- - ">="
|
162
162
|
- !ruby/object:Gem::Version
|
163
|
-
version: '2
|
163
|
+
version: '3.2'
|
164
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
166
|
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
-
signing_key:
|
170
|
+
rubygems_version: 3.4.22
|
171
|
+
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: DMPTool gem that provides general support for accessing external APIs
|
174
174
|
test_files: []
|