Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand All @@ -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());

Expand All @@ -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: |-
Expand All @@ -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: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.4.2"
".": "0.4.3"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
cloudpayments-ruby (0.4.2)
cloudpayments-ruby (0.4.3)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "cloudpayments-ruby", "~> 0.4.2"
gem "cloudpayments-ruby", "~> 0.4.3"
```

<!-- x-release-please-end -->
Expand Down
16 changes: 15 additions & 1 deletion lib/cloudpayments_ruby/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions lib/cloudpayments_ruby/internal/transport/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion lib/cloudpayments_ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module CloudpaymentsRuby
VERSION = "0.4.2"
VERSION = "0.4.3"
end
2 changes: 1 addition & 1 deletion scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions test/cloudpayments_ruby/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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