From 95b35be274a2f95c73491e15bfbf755c198dc885 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Jun 2026 02:08:16 +0000 Subject: [PATCH 1/2] chore(internal): codegen related update --- .github/workflows/ci.yml | 14 +++++++------- .github/workflows/publish-gem.yml | 4 ++-- .github/workflows/release-doctor.yml | 2 +- .stats.yml | 2 +- lib/cloudpayments_ruby/client.rb | 16 +++++++++++++++- .../internal/transport/base_client.rb | 5 +++++ scripts/bootstrap | 2 +- test/cloudpayments_ruby/client_test.rb | 9 +++++---- 8 files changed, 37 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 618d09a..44d70a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: github.repository == 'stainless-sdks/cloudpayments-ruby' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- @@ -39,7 +39,7 @@ jobs: github.repository == 'stainless-sdks/cloudpayments-ruby' && !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc - uses: actions/github-script@v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: core.setOutput('github_token', await core.getIDToken()); @@ -60,9 +60,9 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- @@ -76,9 +76,9 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/cloudpayments-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml index 95c967e..dc5af5d 100644 --- a/.github/workflows/publish-gem.yml +++ b/.github/workflows/publish-gem.yml @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: false - run: |- diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 96786ea..141fc8b 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'Hexlet/cloudpayments-ruby' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Check release environment run: | diff --git a/.stats.yml b/.stats.yml index ac83981..e5d832e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hexlet%2Fcloudpayments-737bf804f9ef1282c03bc532fc392f69a6e00eb5d229fa39368ea8ca2ff02de1.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hexlet/cloudpayments-4507579a1358673b79cba50bafaa9ab634177712ad8556bd71fb05a6b8d11440.yml openapi_spec_hash: 68aafd72cb1fa7266ab697cc29f73583 config_hash: 7e3e36dabba4af552324a8ffefba23f5 diff --git a/lib/cloudpayments_ruby/client.rb b/lib/cloudpayments_ruby/client.rb index ea8a090..03caf19 100644 --- a/lib/cloudpayments_ruby/client.rb +++ b/lib/cloudpayments_ruby/client.rb @@ -74,6 +74,19 @@ def initialize( raise ArgumentError.new("api_secret is required, and can be set via environ: \"CLOUDPAYMENTS_API_SECRET\"") end + headers = {} + custom_headers_env = ENV["CLOUDPAYMENTS_CUSTOM_HEADERS"] + unless custom_headers_env.nil? + parsed = {} + custom_headers_env.split("\n").each do |line| + colon = line.index(":") + unless colon.nil? + parsed[line[0...colon].strip] = line[(colon + 1)..].strip + end + end + headers = parsed.merge(headers) + end + @public_id = public_id.to_s @api_secret = api_secret.to_s @@ -82,7 +95,8 @@ def initialize( timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, - max_retry_delay: max_retry_delay + max_retry_delay: max_retry_delay, + headers: headers ) @payments = CloudpaymentsRuby::Resources::Payments.new(client: self) diff --git a/lib/cloudpayments_ruby/internal/transport/base_client.rb b/lib/cloudpayments_ruby/internal/transport/base_client.rb index 1d60944..bc994f5 100644 --- a/lib/cloudpayments_ruby/internal/transport/base_client.rb +++ b/lib/cloudpayments_ruby/internal/transport/base_client.rb @@ -306,6 +306,11 @@ def initialize( CloudpaymentsRuby::Internal::Util.deep_merge(*[req[:body], opts[:extra_body]].compact) end + # Generated methods always pass `req[:body]` for operations that define a + # request body, so only elide the content-type header when the operation + # has no body at all, not when an optional body param was omitted. + headers.delete("content-type") if body.nil? && !req.key?(:body) + url = CloudpaymentsRuby::Internal::Util.join_parsed_uri( @base_url_components, {**req, path: path, query: query} diff --git a/scripts/bootstrap b/scripts/bootstrap index 3487864..a5e1b80 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd -- "$(dirname -- "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { echo -n "==> Install Homebrew dependencies? (y/N): " read -r response diff --git a/test/cloudpayments_ruby/client_test.rb b/test/cloudpayments_ruby/client_test.rb index 2048def..cd2a7a2 100644 --- a/test/cloudpayments_ruby/client_test.rb +++ b/test/cloudpayments_ruby/client_test.rb @@ -309,8 +309,8 @@ def test_client_redirect_307 assert_equal(recorded.method, _1.method) assert_equal(recorded.body, _1.body) assert_equal( - recorded.headers.transform_keys(&:downcase).fetch("content-type"), - _1.headers.transform_keys(&:downcase).fetch("content-type") + recorded.headers.transform_keys(&:downcase)["content-type"], + _1.headers.transform_keys(&:downcase)["content-type"] ) end end @@ -440,8 +440,9 @@ def test_default_headers ) assert_requested(:any, /./) do |req| - headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") - headers.each { refute_empty(_1) } + headers = req.headers.transform_keys(&:downcase) + expected = req.body.nil? ? ["accept"] : %w[accept content-type] + headers.fetch_values(*expected).each { refute_empty(_1) } end end end From 5772a1a54781f0dd016d2f1ddefb75214df58410 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Jun 2026 02:08:38 +0000 Subject: [PATCH 2/2] release: 0.4.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/cloudpayments_ruby/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 980ea05..f800719 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.2" + ".": "0.4.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e40d558..b3677bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.4.3 (2026-06-20) + +Full Changelog: [v0.4.2...v0.4.3](https://github.com/Hexlet/cloudpayments-ruby/compare/v0.4.2...v0.4.3) + +### Chores + +* **internal:** codegen related update ([95b35be](https://github.com/Hexlet/cloudpayments-ruby/commit/95b35be274a2f95c73491e15bfbf755c198dc885)) + ## 0.4.2 (2026-04-09) Full Changelog: [v0.4.1...v0.4.2](https://github.com/Hexlet/cloudpayments-ruby/compare/v0.4.1...v0.4.2) diff --git a/Gemfile.lock b/Gemfile.lock index 660c30e..f9f3d70 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - cloudpayments-ruby (0.4.2) + cloudpayments-ruby (0.4.3) cgi connection_pool diff --git a/README.md b/README.md index 4dd30b8..9ae94b4 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "cloudpayments-ruby", "~> 0.4.2" +gem "cloudpayments-ruby", "~> 0.4.3" ``` diff --git a/lib/cloudpayments_ruby/version.rb b/lib/cloudpayments_ruby/version.rb index 9b7fe58..3f66761 100644 --- a/lib/cloudpayments_ruby/version.rb +++ b/lib/cloudpayments_ruby/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module CloudpaymentsRuby - VERSION = "0.4.2" + VERSION = "0.4.3" end