From 48d3666bc0f986607596b455646eebbc721d153a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:44:04 +0000 Subject: [PATCH 1/3] Initial plan From ca648755f74c10b46981f90f5626cf8fe76533fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:45:33 +0000 Subject: [PATCH 2/3] Fix CI workflow: Add bundle exec to gem require check Co-authored-by: sonnyt <183387+sonnyt@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60e7891..51f1af2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Check gem can be required run: | - ruby -e "require './lib/bundleup'; puts '✓ Gem requires successfully'" + bundle exec ruby -e "require './lib/bundleup'; puts '✓ Gem requires successfully'" lint: runs-on: ubuntu-latest From 96f2061fd19c92536607adeac48c6d127bf1cb29 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 02:52:57 +0000 Subject: [PATCH 3/3] Fix RuboCop lint errors with auto-correction Co-authored-by: sonnyt <183387+sonnyt@users.noreply.github.com> --- lib/bundleup/base.rb | 2 - lib/bundleup/client.rb | 16 +++-- lib/bundleup/proxy.rb | 2 +- lib/bundleup/unify/base.rb | 2 +- spec/bundleup/base_spec.rb | 32 +++++----- spec/bundleup/client_spec.rb | 16 +++-- spec/bundleup/proxy_spec.rb | 74 +++++++++++------------ spec/bundleup/unify_spec.rb | 112 +++++++++++++++++------------------ 8 files changed, 134 insertions(+), 122 deletions(-) diff --git a/lib/bundleup/base.rb b/lib/bundleup/base.rb index 832e6d9..5c0899b 100644 --- a/lib/bundleup/base.rb +++ b/lib/bundleup/base.rb @@ -64,8 +64,6 @@ def resource_name end def request(method, path, body = nil) - url = "#{BASE_URL}#{path}" - response = connection.public_send(method) do |req| req.url path req.headers['Content-Type'] = 'application/json' diff --git a/lib/bundleup/client.rb b/lib/bundleup/client.rb index 9aff603..b7afae0 100644 --- a/lib/bundleup/client.rb +++ b/lib/bundleup/client.rb @@ -11,7 +11,7 @@ class Client # @raise [ArgumentError] if api_key is nil or empty def initialize(api_key) raise ArgumentError, 'API key is required to initialize BundleUp SDK.' if api_key.nil? || api_key.to_s.empty? - + @api_key = api_key end @@ -42,8 +42,11 @@ def webhooks # @return [Bundleup::Proxy] Proxy instance # @raise [ArgumentError] if connection_id is nil or empty def proxy(connection_id) - raise ArgumentError, 'Connection ID is required to create a Proxy instance.' if connection_id.nil? || connection_id.to_s.empty? - + if connection_id.nil? || connection_id.to_s.empty? + raise ArgumentError, + 'Connection ID is required to create a Proxy instance.' + end + Bundleup::Proxy.new(@api_key, connection_id) end @@ -53,8 +56,11 @@ def proxy(connection_id) # @return [Hash] Hash with :chat, :git, and :pm Unify instances # @raise [ArgumentError] if connection_id is nil or empty def unify(connection_id) - raise ArgumentError, 'Connection ID is required to create a Unify instance.' if connection_id.nil? || connection_id.to_s.empty? - + if connection_id.nil? || connection_id.to_s.empty? + raise ArgumentError, + 'Connection ID is required to create a Unify instance.' + end + { chat: Bundleup::Unify::Chat.new(@api_key, connection_id), git: Bundleup::Unify::Git.new(@api_key, connection_id), diff --git a/lib/bundleup/proxy.rb b/lib/bundleup/proxy.rb index 3f6410f..28c6582 100644 --- a/lib/bundleup/proxy.rb +++ b/lib/bundleup/proxy.rb @@ -69,7 +69,7 @@ def request(method, path, body = nil) req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = "Bearer #{api_key}" req.headers['BU-Connection-Id'] = connection_id - + if body && %i[post patch put].include?(method) req.body = body.to_json elsif body && method == :get diff --git a/lib/bundleup/unify/base.rb b/lib/bundleup/unify/base.rb index 8294981..956816e 100644 --- a/lib/bundleup/unify/base.rb +++ b/lib/bundleup/unify/base.rb @@ -27,7 +27,7 @@ def request(method, path, params = {}, include_raw: false) req.headers['Authorization'] = "Bearer #{api_key}" req.headers['BU-Connection-Id'] = connection_id req.headers['BU-Include-Raw'] = include_raw.to_s - + if params && %i[post patch put].include?(method) req.body = params.to_json elsif params && method == :get diff --git a/spec/bundleup/base_spec.rb b/spec/bundleup/base_spec.rb index b13d01f..22212af 100644 --- a/spec/bundleup/base_spec.rb +++ b/spec/bundleup/base_spec.rb @@ -24,8 +24,8 @@ def resource_name describe '#list' do it 'makes a GET request to the resource path' do stub = stub_request(:get, 'https://api.bundleup.io/v1/test_resources') - .with(headers: { 'Authorization' => 'Bearer test_api_key' }) - .to_return(status: 200, body: '{"data": []}', headers: { 'Content-Type' => 'application/json' }) + .with(headers: { 'Authorization' => 'Bearer test_api_key' }) + .to_return(status: 200, body: '{"data": []}', headers: { 'Content-Type' => 'application/json' }) instance.list @@ -36,11 +36,11 @@ def resource_name describe '#create' do it 'makes a POST request with data' do stub = stub_request(:post, 'https://api.bundleup.io/v1/test_resources') - .with( - headers: { 'Authorization' => 'Bearer test_api_key', 'Content-Type' => 'application/json' }, - body: '{"name":"Test"}' - ) - .to_return(status: 201, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { 'Authorization' => 'Bearer test_api_key', 'Content-Type' => 'application/json' }, + body: '{"name":"Test"}' + ) + .to_return(status: 201, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) instance.create(name: 'Test') @@ -51,8 +51,8 @@ def resource_name describe '#retrieve' do it 'makes a GET request with the resource ID' do stub = stub_request(:get, 'https://api.bundleup.io/v1/test_resources/123') - .with(headers: { 'Authorization' => 'Bearer test_api_key' }) - .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) + .with(headers: { 'Authorization' => 'Bearer test_api_key' }) + .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) instance.retrieve('123') @@ -63,11 +63,11 @@ def resource_name describe '#update' do it 'makes a PATCH request with data' do stub = stub_request(:patch, 'https://api.bundleup.io/v1/test_resources/123') - .with( - headers: { 'Authorization' => 'Bearer test_api_key', 'Content-Type' => 'application/json' }, - body: '{"name":"Updated"}' - ) - .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { 'Authorization' => 'Bearer test_api_key', 'Content-Type' => 'application/json' }, + body: '{"name":"Updated"}' + ) + .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) instance.update('123', name: 'Updated') @@ -78,8 +78,8 @@ def resource_name describe '#delete' do it 'makes a DELETE request' do stub = stub_request(:delete, 'https://api.bundleup.io/v1/test_resources/123') - .with(headers: { 'Authorization' => 'Bearer test_api_key' }) - .to_return(status: 204, body: '', headers: {}) + .with(headers: { 'Authorization' => 'Bearer test_api_key' }) + .to_return(status: 204, body: '', headers: {}) instance.delete('123') diff --git a/spec/bundleup/client_spec.rb b/spec/bundleup/client_spec.rb index 9607872..f4e09a4 100644 --- a/spec/bundleup/client_spec.rb +++ b/spec/bundleup/client_spec.rb @@ -10,11 +10,15 @@ end it 'raises an error when API key is nil' do - expect { described_class.new(nil) }.to raise_error(ArgumentError, 'API key is required to initialize BundleUp SDK.') + expect do + described_class.new(nil) + end.to raise_error(ArgumentError, 'API key is required to initialize BundleUp SDK.') end it 'raises an error when API key is empty' do - expect { described_class.new('') }.to raise_error(ArgumentError, 'API key is required to initialize BundleUp SDK.') + expect do + described_class.new('') + end.to raise_error(ArgumentError, 'API key is required to initialize BundleUp SDK.') end end @@ -64,7 +68,9 @@ end it 'raises an error when connection_id is nil' do - expect { client.proxy(nil) }.to raise_error(ArgumentError, 'Connection ID is required to create a Proxy instance.') + expect do + client.proxy(nil) + end.to raise_error(ArgumentError, 'Connection ID is required to create a Proxy instance.') end it 'raises an error when connection_id is empty' do @@ -88,7 +94,9 @@ end it 'raises an error when connection_id is nil' do - expect { client.unify(nil) }.to raise_error(ArgumentError, 'Connection ID is required to create a Unify instance.') + expect do + client.unify(nil) + end.to raise_error(ArgumentError, 'Connection ID is required to create a Unify instance.') end it 'raises an error when connection_id is empty' do diff --git a/spec/bundleup/proxy_spec.rb b/spec/bundleup/proxy_spec.rb index 84e103c..d867e97 100644 --- a/spec/bundleup/proxy_spec.rb +++ b/spec/bundleup/proxy_spec.rb @@ -15,11 +15,11 @@ describe '#get' do it 'makes a GET request with proper headers' do stub = stub_request(:get, 'https://proxy.bundleup.io/api/users') - .with(headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123' - }) - .to_return(status: 200, body: '{"users":[]}', headers: { 'Content-Type' => 'application/json' }) + .with(headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123' + }) + .to_return(status: 200, body: '{"users":[]}', headers: { 'Content-Type' => 'application/json' }) instance.get('/api/users') @@ -30,15 +30,15 @@ describe '#post' do it 'makes a POST request with body' do stub = stub_request(:post, 'https://proxy.bundleup.io/api/users') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'Content-Type' => 'application/json' - }, - body: '{"name":"Test"}' - ) - .to_return(status: 201, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'Content-Type' => 'application/json' + }, + body: '{"name":"Test"}' + ) + .to_return(status: 201, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) instance.post('/api/users', name: 'Test') @@ -49,15 +49,15 @@ describe '#put' do it 'makes a PUT request' do stub = stub_request(:put, 'https://proxy.bundleup.io/api/users/123') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'Content-Type' => 'application/json' - }, - body: '{"name":"Updated"}' - ) - .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'Content-Type' => 'application/json' + }, + body: '{"name":"Updated"}' + ) + .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) instance.put('/api/users/123', name: 'Updated') @@ -68,15 +68,15 @@ describe '#patch' do it 'makes a PATCH request' do stub = stub_request(:patch, 'https://proxy.bundleup.io/api/users/123') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'Content-Type' => 'application/json' - }, - body: '{"email":"test@example.com"}' - ) - .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'Content-Type' => 'application/json' + }, + body: '{"email":"test@example.com"}' + ) + .to_return(status: 200, body: '{"id":"123"}', headers: { 'Content-Type' => 'application/json' }) instance.patch('/api/users/123', email: 'test@example.com') @@ -87,11 +87,11 @@ describe '#delete' do it 'makes a DELETE request' do stub = stub_request(:delete, 'https://proxy.bundleup.io/api/users/123') - .with(headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123' - }) - .to_return(status: 204, body: '', headers: {}) + .with(headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123' + }) + .to_return(status: 204, body: '', headers: {}) instance.delete('/api/users/123') diff --git a/spec/bundleup/unify_spec.rb b/spec/bundleup/unify_spec.rb index ee0ed55..6a82bdb 100644 --- a/spec/bundleup/unify_spec.rb +++ b/spec/bundleup/unify_spec.rb @@ -8,14 +8,14 @@ describe '#channels' do it 'makes a GET request to channels endpoint' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/chat/channels') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'false' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'false' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.channels @@ -24,14 +24,14 @@ it 'supports include_raw parameter' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/chat/channels') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'true' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'true' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.channels(include_raw: true) @@ -46,14 +46,14 @@ describe '#repos' do it 'makes a GET request to repos endpoint' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/git/repos') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'false' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'false' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.repos @@ -64,14 +64,14 @@ describe '#pulls' do it 'makes a GET request with repo_name' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/git/pulls?repo_name=owner/repo') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'false' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'false' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.pulls('owner/repo') @@ -82,14 +82,14 @@ describe '#tags' do it 'makes a GET request with repo_name' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/git/tags?repo_name=owner/repo') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'false' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'false' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.tags('owner/repo') @@ -100,14 +100,14 @@ describe '#releases' do it 'makes a GET request with repo_name' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/git/releases?repo_name=owner/repo') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'false' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'false' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.releases('owner/repo') @@ -122,14 +122,14 @@ describe '#issues' do it 'makes a GET request to issues endpoint' do stub = stub_request(:get, 'https://unify.bundleup.io/v1/pm/issues') - .with( - headers: { - 'Authorization' => 'Bearer test_api_key', - 'BU-Connection-Id' => 'conn_123', - 'BU-Include-Raw' => 'false' - } - ) - .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) + .with( + headers: { + 'Authorization' => 'Bearer test_api_key', + 'BU-Connection-Id' => 'conn_123', + 'BU-Include-Raw' => 'false' + } + ) + .to_return(status: 200, body: '{"data":[]}', headers: { 'Content-Type' => 'application/json' }) instance.issues