From cd58e8a0d8b2b887707aeaa577cc14b7a503d2d9 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Fri, 14 Aug 2026 14:23:50 -0700 Subject: [PATCH 1/3] Remove User-Agent override --- lib/seam/request.rb | 1 - spec/seam_client/headers_spec.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/seam/request.rb b/lib/seam/request.rb index 49e6c49..aaa3512 100644 --- a/lib/seam/request.rb +++ b/lib/seam/request.rb @@ -40,7 +40,6 @@ def self.create_faraday_client(endpoint, auth_headers, faraday_options = {}, far def self.default_headers { - "User-Agent" => "seam-ruby/#{Seam::VERSION}", "Content-Type" => "application/json", :"seam-sdk-name" => "seamapi/ruby", :"seam-sdk-version" => Seam::VERSION, diff --git a/spec/seam_client/headers_spec.rb b/spec/seam_client/headers_spec.rb index e27e6e5..a71d36a 100644 --- a/spec/seam_client/headers_spec.rb +++ b/spec/seam_client/headers_spec.rb @@ -15,7 +15,6 @@ "seam-sdk-name" => "seamapi/ruby", "seam-sdk-version" => Seam::VERSION, "seam-lts-version" => Seam::LTS_VERSION, - "User-Agent" => "seam-ruby/#{Seam::VERSION}" } ) .to_return( From a3a318dd2e448c501a9ec21174069e24abd3ecff Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Fri, 14 Aug 2026 14:24:48 -0700 Subject: [PATCH 2/3] feat: Remove lts_version (unused) --- lib/seam.rb | 5 ----- lib/seam/http_multi_workspace.rb | 9 --------- lib/seam/http_single_workspace.rb | 4 ---- lib/seam/lts_version.rb | 5 ----- lib/seam/request.rb | 4 +--- spec/module_spec.rb | 1 - spec/seam_client/defaults_spec.rb | 9 --------- spec/seam_client/headers_spec.rb | 8 +------- 8 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 lib/seam/lts_version.rb diff --git a/lib/seam.rb b/lib/seam.rb index 796386c..911951b 100644 --- a/lib/seam.rb +++ b/lib/seam.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require_relative "seam/lts_version" require_relative "seam/http" require_relative "seam/http_multi_workspace" require_relative "seam/webhook" @@ -19,8 +18,4 @@ def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, tim def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil) Seam::Http.from_personal_access_token(personal_access_token, workspace_id, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt, timeout: timeout) end - - def self.lts_version - Seam::LTS_VERSION - end end diff --git a/lib/seam/http_multi_workspace.rb b/lib/seam/http_multi_workspace.rb index df2c2ca..e714fa9 100644 --- a/lib/seam/http_multi_workspace.rb +++ b/lib/seam/http_multi_workspace.rb @@ -2,7 +2,6 @@ require_relative "request" require_relative "parse_options" -require_relative "lts_version" require_relative "version" require_relative "auth" require_relative "resources/index" @@ -24,14 +23,6 @@ def initialize(personal_access_token:, endpoint: nil, wait_for_action_attempt: t faraday_retry_options, timeout: timeout) end - def self.lts_version - Seam::LTS_VERSION - end - - def lts_version - Seam::LTS_VERSION - end - def workspaces @workspaces ||= WorkspacesProxy.new(Seam::Clients::Workspaces.new(client: @client, defaults: @defaults)) end diff --git a/lib/seam/http_single_workspace.rb b/lib/seam/http_single_workspace.rb index ce3ad60..72763df 100644 --- a/lib/seam/http_single_workspace.rb +++ b/lib/seam/http_single_workspace.rb @@ -35,10 +35,6 @@ def initialize(client: nil, api_key: nil, personal_access_token: nil, workspace_ initialize_routes(client: @client, defaults: @defaults) end - def lts_version - Seam::LTS_VERSION - end - def create_paginator(request, params = {}) Paginator.new(request, params) end diff --git a/lib/seam/lts_version.rb b/lib/seam/lts_version.rb deleted file mode 100644 index 65daf42..0000000 --- a/lib/seam/lts_version.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -module Seam - LTS_VERSION = "1.0.0" -end diff --git a/lib/seam/request.rb b/lib/seam/request.rb index aaa3512..83864f6 100644 --- a/lib/seam/request.rb +++ b/lib/seam/request.rb @@ -3,7 +3,6 @@ require "faraday" require "faraday/retry" require_relative "defaults" -require_relative "lts_version" require_relative "version" require_relative "paginator" @@ -42,8 +41,7 @@ def self.default_headers { "Content-Type" => "application/json", :"seam-sdk-name" => "seamapi/ruby", - :"seam-sdk-version" => Seam::VERSION, - :"seam-lts-version" => Seam::LTS_VERSION + :"seam-sdk-version" => Seam::VERSION } end diff --git a/spec/module_spec.rb b/spec/module_spec.rb index 1990de2..7b08cfd 100644 --- a/spec/module_spec.rb +++ b/spec/module_spec.rb @@ -6,6 +6,5 @@ end it "has a LTS version number" do - expect(Seam::LTS_VERSION).not_to be nil end end diff --git a/spec/seam_client/defaults_spec.rb b/spec/seam_client/defaults_spec.rb index b9cc77c..2b881dd 100644 --- a/spec/seam_client/defaults_spec.rb +++ b/spec/seam_client/defaults_spec.rb @@ -32,13 +32,4 @@ expect(seam.defaults.wait_for_action_attempt).to be false end end - - describe "#lts_version" do - it "is exposed on the instance and the module" do - seam = Seam.new(api_key: "seam_some_api_key") - - expect(seam.lts_version).to eq(Seam::LTS_VERSION) - expect(Seam.lts_version).to eq(Seam::LTS_VERSION) - end - end end diff --git a/spec/seam_client/headers_spec.rb b/spec/seam_client/headers_spec.rb index a71d36a..0116408 100644 --- a/spec/seam_client/headers_spec.rb +++ b/spec/seam_client/headers_spec.rb @@ -13,8 +13,7 @@ "Authorization" => "Bearer seam_some_api_key", "Content-Type" => "application/json", "seam-sdk-name" => "seamapi/ruby", - "seam-sdk-version" => Seam::VERSION, - "seam-lts-version" => Seam::LTS_VERSION, + "seam-sdk-version" => Seam::VERSION } ) .to_return( @@ -49,9 +48,4 @@ expect(stub).to have_been_requested end - - it "exposes the LTS version on the module and the client" do - expect(Seam.lts_version).to eq(Seam::LTS_VERSION) - expect(Seam.new(api_key: "seam_some_api_key").lts_version).to eq(Seam::LTS_VERSION) - end end From 01f53bd39a15dfd4ebc2fa8aacf8c4b680c33385 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Fri, 14 Aug 2026 14:30:34 -0700 Subject: [PATCH 3/3] fix: Do now allow sdk header override --- lib/seam/request.rb | 24 +++++++++++++++++- spec/seam_client/faraday_options_spec.rb | 20 +++++++++++++++ spec/seam_client/headers_spec.rb | 32 ++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/lib/seam/request.rb b/lib/seam/request.rb index 83864f6..130178e 100644 --- a/lib/seam/request.rb +++ b/lib/seam/request.rb @@ -20,6 +20,12 @@ def self.create_faraday_client(endpoint, auth_headers, faraday_options = {}, far } options = deep_merge(default_options, faraday_options) + options.delete("headers") + options[:headers] = merge_headers( + faraday_options[:headers] || faraday_options["headers"] || {}, + auth_headers, + default_headers + ) default_faraday_retry_options = { max: 2, @@ -104,7 +110,23 @@ def self.deep_merge(hash1, hash2) result end - private_class_method :deep_merge + def self.merge_headers(*headers_list) + result = {} + header_keys = {} + + headers_list.each do |headers| + headers.each do |key, value| + normalized_key = key.to_s.downcase + result.delete(header_keys[normalized_key]) if header_keys.key?(normalized_key) + header_keys[normalized_key] = key + result[key] = value + end + end + + result + end + + private_class_method :deep_merge, :merge_headers end end end diff --git a/spec/seam_client/faraday_options_spec.rb b/spec/seam_client/faraday_options_spec.rb index d882683..e5f48d4 100644 --- a/spec/seam_client/faraday_options_spec.rb +++ b/spec/seam_client/faraday_options_spec.rb @@ -27,6 +27,26 @@ expect(seam.client.headers["seam-sdk-name"]).to eq("seamapi/ruby") end + it "does not let faraday_options override auth or SDK headers" do + seam = described_class.new( + api_key: seed["seam_apikey1_token"], + endpoint: endpoint, + faraday_options: { + headers: { + "Authorization" => "Bearer caller_token", + "Content-Type" => "text/plain", + "Seam-Sdk-Name" => "caller-sdk", + :"seam-sdk-version" => "0.0.0" + } + } + ) + + expect(seam.client.headers["Authorization"]).to eq("Bearer #{seed["seam_apikey1_token"]}") + expect(seam.client.headers["Content-Type"]).to eq("application/json") + expect(seam.client.headers["seam-sdk-name"]).to eq("seamapi/ruby") + expect(seam.client.headers["seam-sdk-version"]).to eq(Seam::VERSION) + end + it "still authorizes requests against the server" do seam = described_class.new( api_key: seed["seam_apikey1_token"], diff --git a/spec/seam_client/headers_spec.rb b/spec/seam_client/headers_spec.rb index 0116408..adbd557 100644 --- a/spec/seam_client/headers_spec.rb +++ b/spec/seam_client/headers_spec.rb @@ -29,6 +29,38 @@ expect(stub).to have_been_requested end + it "sends the SDK and auth headers over caller-provided duplicates" do + stub = stub_request(:post, "#{Seam::DEFAULT_ENDPOINT}/devices/get") + .with( + headers: { + "Authorization" => "Bearer seam_some_api_key", + "Content-Type" => "application/json", + "seam-sdk-name" => "seamapi/ruby", + "seam-sdk-version" => Seam::VERSION + } + ) + .to_return( + status: 200, + body: {device: {device_id: device_id}}.to_json, + headers: {"Content-Type" => "application/json"} + ) + + seam = Seam.new( + api_key: "seam_some_api_key", + faraday_options: { + headers: { + "Authorization" => "Bearer caller_token", + "Content-Type" => "text/plain", + "Seam-Sdk-Name" => "caller-sdk", + :"seam-sdk-version" => "0.0.0" + } + } + ) + seam.devices.get(device_id: device_id) + + expect(stub).to have_been_requested + end + it "sends the workspace header with a personal access token" do stub = stub_request(:post, "#{Seam::DEFAULT_ENDPOINT}/devices/get") .with(