From d6dfc173c852d28d1337a45e3d1877cce78b2d69 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Jul 2026 08:34:06 +0000 Subject: [PATCH 1/2] Rename unify.pm.issues to unify.ticketing.tickets Mirror the Unify API migration from the /pm/issues endpoint to /ticketing/tickets: - Rename lib/bundleup/unify/pm.rb -> ticketing.rb (PM class -> Ticketing, issues -> tickets, path pm/issues -> ticketing/tickets) - Update the require in lib/bundleup.rb and the client in unify.rb - Rename and update the spec, README, and examples Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_014zVgT6VdGxc5a96oMxJU87 --- README.md | 18 ++++++------- examples/README.md | 2 +- examples/unify_api.rb | 8 +++--- lib/bundleup.rb | 2 +- lib/bundleup/unify.rb | 2 +- lib/bundleup/unify/pm.rb | 19 -------------- lib/bundleup/unify/ticketing.rb | 19 ++++++++++++++ .../unify/{pm_spec.rb => ticketing_spec.rb} | 26 +++++++++---------- spec/bundleup/unify_spec.rb | 4 +-- 9 files changed, 50 insertions(+), 50 deletions(-) delete mode 100644 lib/bundleup/unify/pm.rb create mode 100644 lib/bundleup/unify/ticketing.rb rename spec/bundleup/unify/{pm_spec.rb => ticketing_spec.rb} (64%) diff --git a/README.md b/README.md index a4f0d58..ff926f4 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Runnable examples are available in the [`examples/`](./examples) directory: - [`examples/basic_usage.rb`](./examples/basic_usage.rb) - Client setup, connections, integrations, and webhooks - [`examples/proxy_api.rb`](./examples/proxy_api.rb) - Proxy API GET request with a connection -- [`examples/unify_api.rb`](./examples/unify_api.rb) - Unify Chat, Git, and PM endpoint usage +- [`examples/unify_api.rb`](./examples/unify_api.rb) - Unify Chat, Git, and Ticketing endpoint usage - [`examples/README.md`](./examples/README.md) - Setup and execution instructions ## Quick Start @@ -840,20 +840,20 @@ puts "Releases: #{result['data']}" } ``` -#### Project Management API +#### Ticketing API -The PM API provides a unified interface for project management platforms like Jira, Linear, and Asana. +The Ticketing API provides a unified interface for ticketing and project management platforms like Jira, Linear, and Asana. -##### List Issues +##### List Tickets ```ruby -result = unify.pm.issues( +result = unify.ticketing.tickets( limit: 100, after: nil, include_raw: false ) -puts "Issues: #{result['data']}" +puts "Tickets: #{result['data']}" ``` **Response:** @@ -880,8 +880,8 @@ puts "Issues: #{result['data']}" **Filtering and sorting:** ```ruby -open_issues = result['data'].select { |issue| issue['status'] == 'open' } -sorted_by_date = result['data'].sort_by { |issue| Time.parse(issue['created_at']) }.reverse +open_tickets = result['data'].select { |ticket| ticket['status'] == 'open' } +sorted_by_date = result['data'].sort_by { |ticket| Time.parse(ticket['created_at']) }.reverse ``` ## Error Handling @@ -937,7 +937,7 @@ lib/ │ ├── base.rb # Base Unify class │ ├── chat.rb # Chat Unify API │ ├── git.rb # Git Unify API -│ └── pm.rb # PM Unify API +│ └── ticketing.rb # Ticketing Unify API spec/ # Test files ``` diff --git a/examples/README.md b/examples/README.md index a4bf698..98c90ea 100644 --- a/examples/README.md +++ b/examples/README.md @@ -26,4 +26,4 @@ ruby examples/unify_api.rb - `basic_usage.rb` — initialize the SDK and list connections, integrations, and webhooks - `proxy_api.rb` — send a GET request through the Proxy API -- `unify_api.rb` — call Unify Chat, Git, and PM endpoints +- `unify_api.rb` — call Unify Chat, Git, and Ticketing endpoints diff --git a/examples/unify_api.rb b/examples/unify_api.rb index 47e657c..84fbcbd 100644 --- a/examples/unify_api.rb +++ b/examples/unify_api.rb @@ -15,7 +15,7 @@ chat = BundleUp::Unify::Chat.new(api_key, connection_id) git = BundleUp::Unify::Git.new(api_key, connection_id) -pm = BundleUp::Unify::PM.new(api_key, connection_id) +ticketing = BundleUp::Unify::Ticketing.new(api_key, connection_id) puts 'Unify API example' @@ -34,8 +34,8 @@ end begin - issues = pm.issues(limit: 10) - puts "PM issues: #{issues['data']&.length || 0}" + tickets = ticketing.tickets(limit: 10) + puts "Ticketing tickets: #{tickets['data']&.length || 0}" rescue StandardError => e - warn "Failed to fetch PM issues: #{e.message}" + warn "Failed to fetch tickets: #{e.message}" end diff --git a/lib/bundleup.rb b/lib/bundleup.rb index 45638d7..069857e 100644 --- a/lib/bundleup.rb +++ b/lib/bundleup.rb @@ -17,7 +17,7 @@ require_relative 'bundleup/unify/base' require_relative 'bundleup/unify/chat' require_relative 'bundleup/unify/git' -require_relative 'bundleup/unify/pm' +require_relative 'bundleup/unify/ticketing' # Main module for the BundleUp SDK. module BundleUp diff --git a/lib/bundleup/unify.rb b/lib/bundleup/unify.rb index 2e2e94b..8637790 100644 --- a/lib/bundleup/unify.rb +++ b/lib/bundleup/unify.rb @@ -7,7 +7,7 @@ class Client attr_reader :api_key, :connection_id def initialize(api_key, connection_id) - @pm = BundleUp::Unify::PM.new(api_key, connection_id) + @ticketing = BundleUp::Unify::Ticketing.new(api_key, connection_id) @chat = BundleUp::Unify::Chat.new(api_key, connection_id) @git = BundleUp::Unify::Git.new(api_key, connection_id) end diff --git a/lib/bundleup/unify/pm.rb b/lib/bundleup/unify/pm.rb deleted file mode 100644 index 39f1497..0000000 --- a/lib/bundleup/unify/pm.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module BundleUp - module Unify - # Client for project management Unify endpoints. - class PM < Base - # Fetches issues from the connected project management tool. - def issues(params = {}) - response = connection.get('pm/issues') do |req| - req.params = params - end - - raise "Failed to fetch pm/issues: #{response.status}" unless response.success? - - response.body - end - end - end -end diff --git a/lib/bundleup/unify/ticketing.rb b/lib/bundleup/unify/ticketing.rb new file mode 100644 index 0000000..9a0d59b --- /dev/null +++ b/lib/bundleup/unify/ticketing.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module BundleUp + module Unify + # Client for ticketing Unify endpoints. + class Ticketing < Base + # Fetches tickets from the connected ticketing tool. + def tickets(params = {}) + response = connection.get('ticketing/tickets') do |req| + req.params = params + end + + raise "Failed to fetch ticketing/tickets: #{response.status}" unless response.success? + + response.body + end + end + end +end diff --git a/spec/bundleup/unify/pm_spec.rb b/spec/bundleup/unify/ticketing_spec.rb similarity index 64% rename from spec/bundleup/unify/pm_spec.rb rename to spec/bundleup/unify/ticketing_spec.rb index 16c1cdf..889ac8c 100644 --- a/spec/bundleup/unify/pm_spec.rb +++ b/spec/bundleup/unify/ticketing_spec.rb @@ -2,15 +2,15 @@ require 'spec_helper' -RSpec.describe BundleUp::Unify::PM do +RSpec.describe BundleUp::Unify::Ticketing do let(:api_key) { 'test_api_key' } let(:connection_id) { 'conn_123' } let(:instance) { described_class.new(api_key, connection_id) } let(:base_url) { 'https://unify.bundleup.io/v1' } - describe '#issues' do - it 'makes a GET request to issues endpoint' do - stub = stub_request(:get, "#{base_url}/pm/issues") + describe '#tickets' do + it 'makes a GET request to tickets endpoint' do + stub = stub_request(:get, "#{base_url}/ticketing/tickets") .with( headers: { 'Authorization' => "Bearer #{api_key}", @@ -20,17 +20,17 @@ ) .to_return( status: 200, - body: '{"data":[{"id":"issue_1","title":"Bug fix"}]}', + body: '{"data":[{"id":"ticket_1","title":"Bug fix"}]}', headers: { 'Content-Type' => 'application/json' } ) - result = instance.issues - expect(result).to eq({ 'data' => [{ 'id' => 'issue_1', 'title' => 'Bug fix' }] }) + result = instance.tickets + expect(result).to eq({ 'data' => [{ 'id' => 'ticket_1', 'title' => 'Bug fix' }] }) expect(stub).to have_been_requested end it 'supports additional query parameters' do - stub = stub_request(:get, "#{base_url}/pm/issues?status=open&assignee=john") + stub = stub_request(:get, "#{base_url}/ticketing/tickets?status=open&assignee=john") .with( headers: { 'Authorization' => "Bearer #{api_key}", @@ -44,22 +44,22 @@ headers: { 'Content-Type' => 'application/json' } ) - instance.issues(status: 'open', assignee: 'john') + instance.tickets(status: 'open', assignee: 'john') expect(stub).to have_been_requested end it 'raises error on 401' do - stub_request(:get, "#{base_url}/pm/issues") + stub_request(:get, "#{base_url}/ticketing/tickets") .to_return(status: 401, body: '{"error":"Unauthorized"}') - expect { instance.issues }.to raise_error(Faraday::UnauthorizedError) + expect { instance.tickets }.to raise_error(Faraday::UnauthorizedError) end it 'raises error on 429 rate limit' do - stub_request(:get, "#{base_url}/pm/issues") + stub_request(:get, "#{base_url}/ticketing/tickets") .to_return(status: 429, body: '{"error":"Rate limit exceeded"}') - expect { instance.issues }.to raise_error(Faraday::TooManyRequestsError) + expect { instance.tickets }.to raise_error(Faraday::TooManyRequestsError) end end end diff --git a/spec/bundleup/unify_spec.rb b/spec/bundleup/unify_spec.rb index 5006536..88ecca4 100644 --- a/spec/bundleup/unify_spec.rb +++ b/spec/bundleup/unify_spec.rb @@ -12,8 +12,8 @@ expect(client).to be_a(described_class) end - it 'initializes pm, chat, and git instances' do - expect(client.instance_variable_get(:@pm)).to be_a(BundleUp::Unify::PM) + it 'initializes ticketing, chat, and git instances' do + expect(client.instance_variable_get(:@ticketing)).to be_a(BundleUp::Unify::Ticketing) expect(client.instance_variable_get(:@chat)).to be_a(BundleUp::Unify::Chat) expect(client.instance_variable_get(:@git)).to be_a(BundleUp::Unify::Git) end From 954ff94ecf40a62de393c6592cb142d32ef82cbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Jul 2026 10:13:19 +0000 Subject: [PATCH 2/2] Fix lint job by pinning rubocop-capybara compatibility --- bundleup-sdk.gemspec | 1 + examples/basic_usage.rb | 6 ++---- examples/proxy_api.rb | 12 ++++-------- examples/unify_api.rb | 12 ++++-------- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/bundleup-sdk.gemspec b/bundleup-sdk.gemspec index 0b03788..ff96e43 100644 --- a/bundleup-sdk.gemspec +++ b/bundleup-sdk.gemspec @@ -29,6 +29,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.12' spec.add_development_dependency 'rubocop', '~> 1.50' + spec.add_development_dependency 'rubocop-capybara', '< 2.23' spec.add_development_dependency 'rubocop-rake', '~> 0.6' spec.add_development_dependency 'rubocop-rspec', '~> 2.20', '< 2.26' spec.add_development_dependency 'vcr', '~> 6.1' diff --git a/examples/basic_usage.rb b/examples/basic_usage.rb index be9fea5..5fa0262 100644 --- a/examples/basic_usage.rb +++ b/examples/basic_usage.rb @@ -2,11 +2,9 @@ require 'bundleup' -api_key = ENV['BUNDLEUP_API_KEY'] +api_key = ENV.fetch('BUNDLEUP_API_KEY', nil) -if api_key.nil? || api_key.empty? - abort 'BUNDLEUP_API_KEY is required' -end +abort 'BUNDLEUP_API_KEY is required' if api_key.nil? || api_key.empty? client = BundleUp::Client.new(api_key) diff --git a/examples/proxy_api.rb b/examples/proxy_api.rb index 7d46904..2899346 100644 --- a/examples/proxy_api.rb +++ b/examples/proxy_api.rb @@ -2,17 +2,13 @@ require 'bundleup' -api_key = ENV['BUNDLEUP_API_KEY'] -connection_id = ENV['BUNDLEUP_CONNECTION_ID'] +api_key = ENV.fetch('BUNDLEUP_API_KEY', nil) +connection_id = ENV.fetch('BUNDLEUP_CONNECTION_ID', nil) path = ENV.fetch('BUNDLEUP_PROXY_PATH', '/users') -if api_key.nil? || api_key.empty? - abort 'BUNDLEUP_API_KEY is required' -end +abort 'BUNDLEUP_API_KEY is required' if api_key.nil? || api_key.empty? -if connection_id.nil? || connection_id.empty? - abort 'BUNDLEUP_CONNECTION_ID is required for proxy example' -end +abort 'BUNDLEUP_CONNECTION_ID is required for proxy example' if connection_id.nil? || connection_id.empty? client = BundleUp::Client.new(api_key) proxy = client.proxy(connection_id) diff --git a/examples/unify_api.rb b/examples/unify_api.rb index 84fbcbd..67610fb 100644 --- a/examples/unify_api.rb +++ b/examples/unify_api.rb @@ -2,16 +2,12 @@ require 'bundleup' -api_key = ENV['BUNDLEUP_API_KEY'] -connection_id = ENV['BUNDLEUP_CONNECTION_ID'] +api_key = ENV.fetch('BUNDLEUP_API_KEY', nil) +connection_id = ENV.fetch('BUNDLEUP_CONNECTION_ID', nil) -if api_key.nil? || api_key.empty? - abort 'BUNDLEUP_API_KEY is required' -end +abort 'BUNDLEUP_API_KEY is required' if api_key.nil? || api_key.empty? -if connection_id.nil? || connection_id.empty? - abort 'BUNDLEUP_CONNECTION_ID is required for unify example' -end +abort 'BUNDLEUP_CONNECTION_ID is required for unify example' if connection_id.nil? || connection_id.empty? chat = BundleUp::Unify::Chat.new(api_key, connection_id) git = BundleUp::Unify::Git.new(api_key, connection_id)