io-complyance-unify-sdk 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26204dcc61a1c0f05f33ec0bc18e386a0ec2c483f92990e9edeafe48bf41bd2e
4
- data.tar.gz: e6577d5c2818bbdb2cfcc405a33364a723c14221dc6ff00188ebae285144a0c4
3
+ metadata.gz: f4e843b16b491cbd5e53cca5919ad2a51fb0ae98f2cc7b1ad127c0d4d8ea7355
4
+ data.tar.gz: b1b5e78671b2306d35a0a5c29e1ce731458a30749488a91e47411e5303ce89b9
5
5
  SHA512:
6
- metadata.gz: da65ef9cbd02f1768181ae9f6dd6653338984eea2eb192479b219ea7821a35024712b0edd5c0efce55f9a24e74e8c451e3e7d4448a4a5b159f92b7a1875b1ef7
7
- data.tar.gz: 75618fa59b2a27d7e97407083e8ca4a4977389d28bc2e4848642faa17ab97a7d1e1905c3a9e758a3e1e86750d34e3b3d95bea5c47e781b96678e3bfb4f659fa1
6
+ metadata.gz: d9b49d0920d4ece33768479272d6ba782132bc42fd4e1a2a4d08bf1c38b217b8d51cc491df4d4035252e8247579631af466ae48c3b24004fab6063a0ffa5faf9
7
+ data.tar.gz: 5d956c65778fe3fdbc4b82568fce99a57fd3ea99f2a643a6439f5bc42d715ae5aa9170532cf5b23cb212766516c272222eaaccfa80167e507c07ff06ae56ca4b
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'net/http'
5
+ require 'uri'
6
+
7
+ module ComplyanceSDK
8
+ module Onboarding
9
+ class Client
10
+ PATH = '/unified-onboarding/api/onboard'
11
+
12
+ attr_reader :api_key, :base_url, :timeout
13
+
14
+ def initialize(api_key:, base_url:, timeout: 30)
15
+ @api_key = api_key.to_s.strip
16
+ @base_url = base_url.to_s.strip
17
+ @timeout = timeout
18
+
19
+ raise ArgumentError, 'api_key is required' if @api_key.empty?
20
+ raise ArgumentError, 'base_url is required' if @base_url.empty?
21
+ end
22
+
23
+ def create(payload, idempotency_key: nil)
24
+ uri = URI.parse(service_url)
25
+ http = Net::HTTP.new(uri.host, uri.port)
26
+ http.use_ssl = uri.scheme == 'https'
27
+ http.read_timeout = timeout
28
+ http.open_timeout = timeout
29
+
30
+ request = Net::HTTP::Post.new(uri.request_uri)
31
+ request['Accept'] = 'application/json'
32
+ request['Content-Type'] = 'application/json'
33
+ request['Authorization'] = "Bearer #{api_key}"
34
+ request['Idempotency-Key'] = idempotency_key.to_s.strip if idempotency_key
35
+ request.body = payload.to_json
36
+
37
+ response = http.request(request)
38
+ body = response.body.to_s.empty? ? {} : JSON.parse(response.body)
39
+ return body.merge('httpStatus' => response.code.to_i) if response.code.to_i.between?(200, 299) || [422].include?(response.code.to_i)
40
+
41
+ raise "Onboarding request failed with status #{response.code}: #{response.body}"
42
+ rescue JSON::ParserError
43
+ raise "Onboarding request returned invalid JSON: #{response.body}"
44
+ end
45
+
46
+ private
47
+
48
+ def service_url
49
+ normalized = base_url.end_with?('/unify') ? base_url.delete_suffix('/unify') : base_url
50
+ "#{normalized}#{PATH}"
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ComplyanceSDK
4
- VERSION = "3.0.8"
4
+ VERSION = "3.0.9"
5
5
  end
@@ -27,6 +27,7 @@ require "complyance_sdk/retry/circuit_breaker"
27
27
  require "complyance_sdk/retry/retry_strategy"
28
28
  require "complyance_sdk/queue/persistent_queue_manager"
29
29
  require "complyance_sdk/purchase_invoice/models"
30
+ require "complyance_sdk/onboarding/client"
30
31
  require "openssl"
31
32
  require "uri"
32
33
 
@@ -81,6 +82,19 @@ module ComplyanceSDK
81
82
  @retry_manager ||= ComplyanceSDK::Retry::RetryManager.new(configuration, redis_config)
82
83
  end
83
84
 
85
+ def onboarding
86
+ unless configured?
87
+ raise ComplyanceSDK::Exceptions::ConfigurationError.new(
88
+ "SDK must be configured before using onboarding"
89
+ )
90
+ end
91
+
92
+ ComplyanceSDK::Onboarding::Client.new(
93
+ api_key: configuration.api_key,
94
+ base_url: ComplyanceSDK::Models::Environment.base_url(configuration.environment)
95
+ )
96
+ end
97
+
84
98
  # Execute an operation with retry logic
85
99
  #
86
100
  # @param operation_name [String] Name of the operation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-complyance-unify-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Complyance Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-02 00:00:00.000000000 Z
11
+ date: 2026-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -282,6 +282,7 @@ files:
282
282
  - lib/complyance_sdk/models/source_ref.rb
283
283
  - lib/complyance_sdk/models/unify_request.rb
284
284
  - lib/complyance_sdk/models/unify_response.rb
285
+ - lib/complyance_sdk/onboarding/client.rb
285
286
  - lib/complyance_sdk/purchase_invoice/models.rb
286
287
  - lib/complyance_sdk/queue/persistent_queue_manager.rb
287
288
  - lib/complyance_sdk/railtie.rb