digiwin_dsp 0.6.0 → 0.7.0

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: 39cfa7cd414965f7f63ac143177e2dcb4ec36dee5403a7fc211f7a6d782d4ad1
4
- data.tar.gz: 86333bb27dd34ad93c350cdf2b195237faac24ca3c5192e843e4d43958c0c578
3
+ metadata.gz: 23c8f3eda8ff30dc40e2242d5f30b2c8f481f77e3506a5979eb36895d47d9c01
4
+ data.tar.gz: 317c076a5781ac54d9ea77f9d486ac7760ba2851bd11e7ecd8b902a98416dee0
5
5
  SHA512:
6
- metadata.gz: 16f9fc374c1d7bb01d75f7963d616fb4fa26c649450700db75a54b7962756560371cb67f532d4afc06eb79f26d61561bbcfe94a376cd2f78f493814a364705d6
7
- data.tar.gz: a6d881275de661e80a11ed41e0344bb1ec7848e681648c14c8449ddf38a1f153516c303ca36fd340c282fcf40748c1dbb44eade762aaf6adf371c13d7943e827
6
+ metadata.gz: 2440d65fca1a26d1fbdd2ff381c76c57bca8ae4550bb9ed04e8fa5777f21e59473e06b90caae438f8cb0e58bf2cb9c612fe198e761b9e66a65199790f48c618c
7
+ data.tar.gz: 3bf79459c10752a2d3a3fb9b1b750f3d21a10e6ebf9c6af969bd64b4324728c52522832f701ecffc2fc8eb24ed41cc160caa79c37a9c21dca75a06e5e2b8d41e
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] - 2026-11-03
10
+
11
+ ### Fixed
12
+
13
+ - **Requires `faraday-net_http >= 3.0`.** faraday 2.x accepts faraday-net_http 2.0.0, which itself depends on faraday. An app whose lockfile still held 2.0.0 failed `bundle install` with "gems that depend on each other, creating an infinite loop". The new lower bound makes Bundler move off 2.0.0.
14
+ - **`WebhookSubscription` no longer mixes a passed client's credentials with the global `platform_id`.** With `WebhookSubscription.new(client)`, the request used the client's API key but `DigiwinDsp.configuration.platform_id`, so it could register under the wrong platform for a second account. `platform_id` now comes from the client's configuration. New `WebhookSubscription.new(configuration: cfg)` builds the client from that configuration, including its `webhook_base_url`. `Client#configuration` is now a public reader.
15
+
9
16
  ## [0.6.0] - 2026-10-22
10
17
 
11
18
  ### BREAKING
@@ -294,7 +301,8 @@ Initial release. Covers the four Self-hosted Website Module (自有官網模組)
294
301
  - The gem is **synchronous on purpose**. Callers wrap requests in their own background job runner (e.g. ActiveJob) when needed.
295
302
  - Idempotency: clients can send `X-Idempotency-Key` via the `idempotency_key:` kwarg. DSP also dedupes server-side by `form_no + platform_id`.
296
303
 
297
- [Unreleased]: https://github.com/7a6163/digiwin_dsp/compare/v0.6.0...HEAD
304
+ [Unreleased]: https://github.com/7a6163/digiwin_dsp/compare/v0.7.0...HEAD
305
+ [0.7.0]: https://github.com/7a6163/digiwin_dsp/compare/v0.6.0...v0.7.0
298
306
  [0.6.0]: https://github.com/7a6163/digiwin_dsp/compare/v0.5.0...v0.6.0
299
307
  [0.5.0]: https://github.com/7a6163/digiwin_dsp/compare/v0.4.2...v0.5.0
300
308
  [0.4.2]: https://github.com/7a6163/digiwin_dsp/compare/v0.4.1...v0.4.2
data/README.md CHANGED
@@ -332,6 +332,7 @@ DigiwinDsp::Resources::Order.create(
332
332
  bin/setup # bundle install
333
333
  bundle exec rspec # run the full test suite (100% line coverage)
334
334
  bundle exec rubocop # lint
335
+ bundle exec mutant run # mutation testing (~3.5 min; CI runs it with --since on PRs)
335
336
  bin/console # IRB with the gem loaded
336
337
  ```
337
338
 
@@ -66,6 +66,8 @@ module DigiwinDsp
66
66
  [/系統異常:/, ServerError] # DSP internal error
67
67
  ].freeze
68
68
 
69
+ attr_reader :configuration
70
+
69
71
  def initialize(configuration: DigiwinDsp.configuration, authenticator: nil, base_url: nil)
70
72
  @configuration = configuration
71
73
  @authenticator = authenticator || Authenticator.new(configuration)
@@ -56,7 +56,7 @@ module DigiwinDsp
56
56
  end
57
57
 
58
58
  def validate!
59
- return unless api_key.nil? || api_key.to_s.empty?
59
+ return unless api_key.to_s.empty?
60
60
 
61
61
  raise ConfigurationError,
62
62
  "api_key is required (set via DigiwinDsp.configure or DIGIWIN_DSP_API_KEY)"
@@ -79,7 +79,7 @@ module DigiwinDsp
79
79
 
80
80
  # DNS hostnames are case-insensitive.
81
81
  def allowed_host?(host)
82
- !host.nil? && allowed_hosts.any? { |h| h.casecmp?(host) }
82
+ allowed_hosts.any? { |h| h.casecmp?(host) }
83
83
  end
84
84
 
85
85
  def resolve_default_base_url
@@ -21,8 +21,10 @@ module DigiwinDsp
21
21
  new.create(action: action, address: address, platform_id: platform_id, prod: prod)
22
22
  end
23
23
 
24
- def initialize(client = nil)
25
- @client = client || Client.new(base_url: DigiwinDsp.configuration.webhook_base_url)
24
+ # Pass `configuration:` (or a client built from one) to register for a
25
+ # non-global account; platform_id then comes from that same configuration.
26
+ def initialize(client = nil, configuration: DigiwinDsp.configuration)
27
+ @client = client || Client.new(configuration: configuration, base_url: configuration.webhook_base_url)
26
28
  end
27
29
 
28
30
  def create(action:, address:, platform_id: nil, prod: DEFAULT_PROD)
@@ -59,7 +61,7 @@ module DigiwinDsp
59
61
  end
60
62
 
61
63
  def resolve_platform_id(explicit)
62
- id = explicit || DigiwinDsp.configuration.platform_id
64
+ id = explicit || @client.configuration.platform_id
63
65
  return id unless id.nil? || id.to_s.empty?
64
66
 
65
67
  raise DigiwinDsp::ConfigurationError,
@@ -75,7 +75,7 @@ module DigiwinDsp
75
75
  end
76
76
 
77
77
  def present?(value)
78
- !value.nil? && !value.to_s.strip.empty?
78
+ !value.to_s.rstrip.empty? # all-whitespace is "" after rstrip alone
79
79
  end
80
80
 
81
81
  def wrap(records, digi_header)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DigiwinDsp
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digiwin_dsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-22 00:00:00.000000000 Z
11
+ date: 2026-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday-net_http
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: faraday-retry
29
43
  requirement: !ruby/object:Gem::Requirement