uc3-dmp-external-api 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: e178888492267ac893548e8da18b84cedd8176aeb53cdba538d062a70c20ad86
4
- data.tar.gz: 4ad54d6b09e2b4387166b0cf8cfd4e4ea30f494f06c8359441bde9eca1bff8c8
3
+ metadata.gz: 5291594d890b3b298fbce129471457f5ba22e366ee04c3d03b65618ee888558e
4
+ data.tar.gz: 30d3bf8f25120347694ceffbddc5b7c489a1fc66145ccaddee817d8d096b25af
5
5
  SHA512:
6
- metadata.gz: eb09f23c248470c64789cef799aec2825f0c710421321710daaa61d864b7868749eb1781bdba2d28cd2377cbb535e6dfcbae561844c3f830647aaee94afe38a5
7
- data.tar.gz: 9e9ec1d090510c09b9dbb2086a0875a3ad294b1c9b297d00ec73a19e1f05a9be808add4e79206ac69c3a49154d64accc02197b3370badecf1fc25de75f3baeb4
6
+ metadata.gz: bbaa5371dfe62ebca5515d1252382f5a7d8acac598c923ae5c35d7069e947c5ac525766cba055df522ac110d338d858e06cee884aab7ec5478e96d7f6cb4f980
7
+ data.tar.gz: be5a2004950fd260cac041519f7379a84d1f9a4ea603c53c4ac41289d530731d77de73439a2e29fd14a9e7904e100b6a3053cebaff62239e7df8afe78251117a
@@ -18,11 +18,11 @@ module Uc3DmpExternalApi
18
18
  class << self
19
19
  # Call the specified URL using the specified HTTP method, body and headers
20
20
  # rubocop:disable Metrics/AbcSize
21
- def call(url:, method: :get, body: '', additional_headers: {}, logger: nil)
21
+ def call(url:, method: :get, body: '', basic_auth: {}, additional_headers: {}, logger: nil)
22
22
  uri = URI(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: body, additional_headers: additional_headers, logger: logger)
25
+ opts = _options(body: body, basic_auth: basic_auth, additional_headers: additional_headers, logger: logger)
26
26
  resp = HTTParty.send(method.to_sym, uri, opts)
27
27
 
28
28
  if resp.code != 200
@@ -62,13 +62,14 @@ module Uc3DmpExternalApi
62
62
  end
63
63
 
64
64
  # Prepare the HTTParty gem options
65
- def _options(body:, additional_headers: {}, logger: nil)
65
+ def _options(body:, basic_auth: nil, additional_headers: {}, logger: nil)
66
66
  hdrs = _headers(additional_headers: additional_headers)
67
67
  opts = {
68
68
  headers: hdrs,
69
69
  follow_redirects: true,
70
70
  limit: 6
71
71
  }
72
+ opts[:basic_auth] = basic_auth if basic_auth.is_a?(Hash)
72
73
  # If the body is not already JSON and we intend to send JSON, convert it
73
74
  opts[:body] = body.is_a?(Hash) && hdrs['Content-Type'] == 'application/json' ? body.to_json : body
74
75
  # If debug is enabled then tap into the HTTParty gem's debug option
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpExternalApi
4
- VERSION = '0.0.9'
4
+ VERSION = '0.0.11'
5
5
  end
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.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-07-06 00:00:00.000000000 Z
11
+ date: 2023-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sns