From e0ac0b81918825217fb21a2245bf4971e0d4385d 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:06:47 +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/tilda_ruby/client.rb | 16 +++++++++++++++- lib/tilda_ruby/internal/transport/base_client.rb | 5 +++++ test/tilda_ruby/client_test.rb | 9 +++++---- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99f10d1..4418e4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: github.repository == 'stainless-sdks/tilda-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/tilda-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/tilda-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 294c205..abf1459 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 0b4bed6..cc29a25 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'Hexlet/tilda-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 56de4a6..95f246e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hexlet%2Ftilda-d06441794bcf349b37439e4084aa5accb40ad16d553d5013cd33b9379f183dc1.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hexlet/tilda-4b9ed812f142b4f682bdfd8880631642dae5ec0e2710119fbce3f601356f51bc.yml openapi_spec_hash: 231389205a35d2d6c56bd1cac4091e81 config_hash: 815230c382ea68d8cedd4946cdc9ef51 diff --git a/lib/tilda_ruby/client.rb b/lib/tilda_ruby/client.rb index 89c929e..ced74bf 100644 --- a/lib/tilda_ruby/client.rb +++ b/lib/tilda_ruby/client.rb @@ -80,6 +80,19 @@ def initialize( ) base_url ||= "https://api.tildacdn.info" + headers = {} + custom_headers_env = ENV["TILDA_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 + @publickey = publickey&.to_s @secretkey = secretkey&.to_s @@ -88,7 +101,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 ) @projects = TildaRuby::Resources::Projects.new(client: self) diff --git a/lib/tilda_ruby/internal/transport/base_client.rb b/lib/tilda_ruby/internal/transport/base_client.rb index 30f8b06..ee46ff7 100644 --- a/lib/tilda_ruby/internal/transport/base_client.rb +++ b/lib/tilda_ruby/internal/transport/base_client.rb @@ -305,6 +305,11 @@ def initialize( TildaRuby::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 = TildaRuby::Internal::Util.join_parsed_uri( @base_url_components, {**req, path: path, query: query} diff --git a/test/tilda_ruby/client_test.rb b/test/tilda_ruby/client_test.rb index b3d55b9..96ccb98 100644 --- a/test/tilda_ruby/client_test.rb +++ b/test/tilda_ruby/client_test.rb @@ -274,8 +274,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 @@ -385,8 +385,9 @@ def test_default_headers tilda.projects.list 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 6704aaa66b1430b893ea9b3dcaaf927525f7313c 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:07:09 +0000 Subject: [PATCH 2/2] release: 0.1.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/tilda_ruby/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5547f83..cda9cbd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.1" + ".": "0.1.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c91647d..aecf2ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.2 (2026-06-20) + +Full Changelog: [v0.1.1...v0.1.2](https://github.com/Hexlet/tilda-ruby/compare/v0.1.1...v0.1.2) + +### Chores + +* **internal:** codegen related update ([e0ac0b8](https://github.com/Hexlet/tilda-ruby/commit/e0ac0b81918825217fb21a2245bf4971e0d4385d)) + ## 0.1.1 (2026-04-23) Full Changelog: [v0.1.0...v0.1.1](https://github.com/Hexlet/tilda-ruby/compare/v0.1.0...v0.1.1) diff --git a/Gemfile.lock b/Gemfile.lock index f040ee0..e619f8f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - tilda-ruby (0.1.1) + tilda-ruby (0.1.2) cgi connection_pool diff --git a/README.md b/README.md index 6066170..66b1d62 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "tilda-ruby", "~> 0.1.1" +gem "tilda-ruby", "~> 0.1.2" ``` diff --git a/lib/tilda_ruby/version.rb b/lib/tilda_ruby/version.rb index 9a8fcdb..7609e06 100644 --- a/lib/tilda_ruby/version.rb +++ b/lib/tilda_ruby/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module TildaRuby - VERSION = "0.1.1" + VERSION = "0.1.2" end