From 2803db71009bbe8ae7858dbfeb6a6803bac80d9e Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Tue, 17 Feb 2026 15:23:41 -0500 Subject: [PATCH 1/7] 884: Ruby upgrade for tokyo_api --- .ruby-gemset | 2 +- .ruby-version | 2 +- CHANGELOG.md | 14 +++++ Gemfile | 16 ++---- Rakefile | 45 +--------------- VERSION | 2 +- lib/tokyo_api.rb | 1 + lib/tokyo_api/client.rb | 20 ++++---- tokyo_api.gemspec | 111 ++++++++++++---------------------------- 9 files changed, 64 insertions(+), 149 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.ruby-gemset b/.ruby-gemset index 26855bf..4dcdb08 100644 --- a/.ruby-gemset +++ b/.ruby-gemset @@ -1 +1 @@ -tokyo_api +-global \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index 4f5e697..1454f6e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.4.5 +4.0.1 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2384698 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +## [1.11.0] - 2026-02-11 + +### Added +- Added `faraday ~> 2.0` as explicit runtime dependency +- Added `faraday-mashify ~> 1.0` as explicit runtime dependency +- Added `rake ~> 13.0` as development dependency +- Added `require 'faraday/mashify'` to main library file + +### Updates +- Upgraded from Ruby 3.4.5 to Ruby 4.0.1 +- Updated vertebrae dependency to >= 1.0.5 for Faraday 2.x compatibility +- Modernized gemspec file with proper dependency declarations diff --git a/Gemfile b/Gemfile index b665e77..e191eff 100644 --- a/Gemfile +++ b/Gemfile @@ -1,16 +1,6 @@ # frozen_string_literal: true -source 'http://rubygems.org' +source 'https://rubygems.org' -gem 'vertebrae', '< 1' - -# Add dependencies to develop your gem here. -# Include everything needed to run rake, tests, features, etc. -group :development do - gem 'bundler' - gem 'byebug' - gem 'juwelier', git: 'https://github.com/flajann2/juwelier.git' - gem 'rspec' - gem 'rubocop' - gem 'webmock' -end +# Specify your gem's dependencies in tokyo_api.gemspec +gemspec diff --git a/Rakefile b/Rakefile index 6971d76..82bb534 100644 --- a/Rakefile +++ b/Rakefile @@ -1,49 +1,8 @@ # frozen_string_literal: true -require 'rubygems' -require 'bundler' -begin - Bundler.setup(:default, :development) -rescue Bundler::BundlerError => e - warn e.message - warn 'Run `bundle install` to install missing gems' - exit e.status_code -end -require 'rake' - -require 'juwelier' -Juwelier::Tasks.new do |gem| - # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options - gem.name = 'tokyo_api' - gem.homepage = 'http://github.com/controlshift/tokyo_api' - gem.license = 'MIT' - gem.summary = 'Ruby API Wrapper for Tokyo CRM service' - gem.description = 'Tokyo is a CRM middleware, this gem helps apps talk to it.' - gem.email = 'nathan@controlshiftlabs.com' - gem.authors = ['Nathan Woodhull'] - # dependencies defined in Gemfile -end -Juwelier::RubygemsDotOrgTasks.new - -require 'rspec/core' +require 'bundler/gem_tasks' require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) do |spec| - spec.pattern = FileList['spec/**/*_spec.rb'] -end -RSpec::Core::RakeTask.new(:rcov) do |spec| - spec.pattern = 'spec/**/*_spec.rb' - spec.rcov = true -end +RSpec::Core::RakeTask.new(:spec) task default: :spec - -require 'rdoc/task' -Rake::RDocTask.new do |rdoc| - version = File.exist?('VERSION') ? File.read('VERSION') : '' - - rdoc.rdoc_dir = 'rdoc' - rdoc.title = "tokyo_api #{version}" - rdoc.rdoc_files.include('README*') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/VERSION b/VERSION index ed21137..169f19b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.0 \ No newline at end of file +1.11.0 \ No newline at end of file diff --git a/lib/tokyo_api.rb b/lib/tokyo_api.rb index 966f28b..8f9bf3a 100644 --- a/lib/tokyo_api.rb +++ b/lib/tokyo_api.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'vertebrae' +require 'faraday/mashify' require 'tokyo_api/base' require 'tokyo_api/actionkit' require 'tokyo_api/campact' diff --git a/lib/tokyo_api/client.rb b/lib/tokyo_api/client.rb index 6bceec3..2589741 100644 --- a/lib/tokyo_api/client.rb +++ b/lib/tokyo_api/client.rb @@ -57,21 +57,19 @@ def request(method, path, params, options) # :nodoc: end def setup - connection.stack do |builder| - builder.use Faraday::Request::Multipart - builder.use Faraday::Request::UrlEncoded + connection.faraday_connection = Faraday.new(connection.configuration.faraday_options) do |f| + f.request :multipart + f.request :url_encoded if connection.configuration.authenticated? - builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, - connection.configuration.password + f.request :authorization, :basic, connection.configuration.username, connection.configuration.password end - builder.use Faraday::Response::Logger if ENV['DEBUG'] + f.response :logger if ENV['DEBUG'] + f.response :mashify + f.response :json - builder.use FaradayMiddleware::Mashify - builder.use FaradayMiddleware::ParseJson - - builder.use Vertebrae::Response::RaiseError - builder.adapter connection.configuration.adapter + f.use Vertebrae::Response::RaiseError + f.adapter connection.configuration.adapter end end end diff --git a/tokyo_api.gemspec b/tokyo_api.gemspec index 90cda7b..533dceb 100644 --- a/tokyo_api.gemspec +++ b/tokyo_api.gemspec @@ -1,85 +1,38 @@ -# Generated by juwelier -# DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec' -# -*- encoding: utf-8 -*- -# stub: tokyo_api 1.9.0 ruby lib +# frozen_string_literal: true -Gem::Specification.new do |s| - s.name = "tokyo_api".freeze - s.version = "1.9.0" +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) - s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= - s.require_paths = ["lib".freeze] - s.authors = ["Nathan Woodhull".freeze] - s.date = "2023-09-28" - s.description = "Tokyo is a CRM middleware, this gem helps apps talk to it.".freeze - s.email = "nathan@controlshiftlabs.com".freeze - s.extra_rdoc_files = [ - "LICENSE.txt", - "README.md" - ] - s.files = [ - ".document", - ".github/workflows/ci.yml", - ".rspec", - ".ruby-gemset", - ".ruby-version", - "Gemfile", - "LICENSE.txt", - "README.md", - "Rakefile", - "VERSION", - "example.rb", - "lib/tokyo_api.rb", - "lib/tokyo_api/actionkit.rb", - "lib/tokyo_api/base.rb", - "lib/tokyo_api/campact.rb", - "lib/tokyo_api/client.rb", - "lib/tokyo_api/expire.rb", - "lib/tokyo_api/external_image.rb", - "lib/tokyo_api/identity.rb", - "spec/actionkit_spec.rb", - "spec/campact_spec.rb", - "spec/client_spec.rb", - "spec/expire_spec.rb", - "spec/external_image_spec.rb", - "spec/fixtures/expire/success", - "spec/fixtures/responses/actionkit/full_user_success", - "spec/fixtures/responses/campact/full_user_success", - "spec/fixtures/responses/full_user_error", - "spec/fixtures/responses/full_user_success", - "spec/fixtures/responses/identity/full_user_success", - "spec/fixtures/responses/krautbuster/full_user_success", - "spec/identity_spec.rb", - "spec/spec_helper.rb", - "spec/tokyo_api_spec.rb", - "tokyo_api.gemspec" - ] - s.homepage = "http://github.com/controlshift/tokyo_api".freeze - s.licenses = ["MIT".freeze] - s.rubygems_version = "3.3.19".freeze - s.summary = "Ruby API Wrapper for Tokyo CRM service".freeze +Gem::Specification.new do |spec| + spec.name = 'tokyo_api' + spec.version = File.read(File.expand_path('VERSION', __dir__)).strip + spec.authors = ['Nathan Woodhull'] + spec.email = ['nathan@controlshiftlabs.com'] - if s.respond_to? :specification_version then - s.specification_version = 4 - end + spec.summary = 'Ruby API Wrapper for Tokyo CRM service' + spec.description = 'Tokyo is a CRM middleware, this gem helps apps talk to it.' + spec.homepage = 'https://github.com/controlshift/tokyo_api' + spec.license = 'MIT' - if s.respond_to? :add_runtime_dependency then - s.add_runtime_dependency(%q.freeze, ["< 1"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - s.add_development_dependency(%q.freeze, [">= 0"]) - else - s.add_dependency(%q.freeze, ["< 1"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) - s.add_dependency(%q.freeze, [">= 0"]) + spec.files = Dir.chdir(File.expand_path(__dir__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } end -end + spec.require_paths = ['lib'] + + spec.required_ruby_version = '>= 3.0.0' + # Runtime dependencies + spec.add_runtime_dependency 'vertebrae', '>= 1.0.5' + spec.add_runtime_dependency 'faraday', '~> 2.0' + spec.add_runtime_dependency 'faraday-mashify', '~> 1.0' + + # Development dependencies + spec.add_development_dependency 'bundler', '>= 2.0' + spec.add_development_dependency 'byebug' + spec.add_development_dependency 'rake', '~> 13.0' + spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'rubocop' + spec.add_development_dependency 'webmock' + + spec.metadata['rubygems_mfa_required'] = 'true' +end From 2dfbf0db973a1debd0f6151982507317f7d29c5c Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Thu, 19 Feb 2026 17:29:45 -0500 Subject: [PATCH 2/7] 884: Address PR comments --- .github/workflows/ci.yml | 17 ++++++++++++++--- CHANGELOG.md | 13 +++---------- README.md | 5 +++++ tokyo_api.gemspec | 12 ++++++------ 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21794a4..01b7919 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,11 +4,22 @@ on: [push] jobs: test: runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.3', '3.4', '4.0'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.4 + ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - run: bundle install - run: bundle exec rspec + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '4.0' + bundler-cache: true + - run: bundle exec rubocop diff --git a/CHANGELOG.md b/CHANGELOG.md index 2384698..f54dbf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,6 @@ ## [1.11.0] - 2026-02-11 -### Added -- Added `faraday ~> 2.0` as explicit runtime dependency -- Added `faraday-mashify ~> 1.0` as explicit runtime dependency -- Added `rake ~> 13.0` as development dependency -- Added `require 'faraday/mashify'` to main library file - -### Updates -- Upgraded from Ruby 3.4.5 to Ruby 4.0.1 -- Updated vertebrae dependency to >= 1.0.5 for Faraday 2.x compatibility -- Modernized gemspec file with proper dependency declarations +### Breaking Changes +- Now requires Faraday 2.x (previously supported Faraday 1.x) +- Dropped support for Ruby versions older than 3.3. Officially supported versions are Ruby 3.3, 3.4, and 4.0. diff --git a/README.md b/README.md index e5bd527..d2610cc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ A ruby gem for communicating with ControlShift's Tokyo API. +## Requirements + +- Ruby 3.3, 3.4, or 4.0 +- Faraday ~> 2.0 + [![CI Status](https://github.com/controlshift/tokyo_api/actions/workflows/ci.yml/badge.svg)](https://github.com/controlshift/tokyo_api/actions/workflows/ci.yml) ## Usage diff --git a/tokyo_api.gemspec b/tokyo_api.gemspec index 533dceb..5fe93ef 100644 --- a/tokyo_api.gemspec +++ b/tokyo_api.gemspec @@ -19,20 +19,20 @@ Gem::Specification.new do |spec| end spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 3.0.0' + spec.required_ruby_version = ['>= 3.3', '< 5.0'] # Runtime dependencies - spec.add_runtime_dependency 'vertebrae', '>= 1.0.5' + spec.add_runtime_dependency 'vertebrae', '~> 1.0' spec.add_runtime_dependency 'faraday', '~> 2.0' spec.add_runtime_dependency 'faraday-mashify', '~> 1.0' # Development dependencies - spec.add_development_dependency 'bundler', '>= 2.0' - spec.add_development_dependency 'byebug' + spec.add_development_dependency 'bundler', '~> 4.0' + spec.add_development_dependency 'byebug', '~> 13.0' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.0' - spec.add_development_dependency 'rubocop' - spec.add_development_dependency 'webmock' + spec.add_development_dependency 'rubocop', '~> 1.0' + spec.add_development_dependency 'webmock', '~> 3.0' spec.metadata['rubygems_mfa_required'] = 'true' end From 71311f705155c49877a091a770d2d58cdb2ba7a5 Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Thu, 19 Feb 2026 17:45:01 -0500 Subject: [PATCH 3/7] 884: Bound bundler version --- tokyo_api.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokyo_api.gemspec b/tokyo_api.gemspec index 5fe93ef..6487c8d 100644 --- a/tokyo_api.gemspec +++ b/tokyo_api.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'faraday-mashify', '~> 1.0' # Development dependencies - spec.add_development_dependency 'bundler', '~> 4.0' + spec.add_development_dependency 'bundler', '>= 2.0', '< 5.0' spec.add_development_dependency 'byebug', '~> 13.0' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.0' From 119b3fc5c0a812d84fa22df912b2c7682cc388f4 Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Thu, 19 Feb 2026 17:59:01 -0500 Subject: [PATCH 4/7] 884: fix rubocop --- .rubocop.yml | 26 ++++++++++++++++++++++++++ example.rb | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..a3280e4 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,26 @@ +AllCops: + DisabledByDefault: true + +Security: + Enabled: true + +Bundler/DuplicatedGem: + Enabled: true +Bundler/InsecureProtocolSource: + Enabled: true +Layout/IndentationStyle: + Enabled: true +Layout/SpaceInsideRangeLiteral: + Enabled: true +Lint: + Enabled: true +Lint/RaiseException: + Enabled: true +Naming/AsciiIdentifiers: + Enabled: true +Naming/ClassAndModuleCamelCase: + Enabled: true +Naming/ConstantName: + Enabled: true +Naming/FileName: + Enabled: true diff --git a/example.rb b/example.rb index a551559..0f2c994 100644 --- a/example.rb +++ b/example.rb @@ -7,4 +7,4 @@ ta = TokyoApi.new(host: 'localhost:9000', username: 'tokyo', password: 'Passw0rd!', scheme: 'http') require 'pry-debugger' -binding.pry +binding.pry # rubocop:disable Lint/Debugger From ec1b8a98552bfcdd28200a8ccc23fddef4a10e45 Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Thu, 19 Feb 2026 18:01:34 -0500 Subject: [PATCH 5/7] 884: fix gemspec authors and email --- tokyo_api.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokyo_api.gemspec b/tokyo_api.gemspec index 6487c8d..74fddec 100644 --- a/tokyo_api.gemspec +++ b/tokyo_api.gemspec @@ -6,8 +6,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = 'tokyo_api' spec.version = File.read(File.expand_path('VERSION', __dir__)).strip - spec.authors = ['Nathan Woodhull'] - spec.email = ['nathan@controlshiftlabs.com'] + spec.authors = ['Nathan Woodhull', 'Owens Ehimen', 'Grey Moore', 'Diego Marcet'] + spec.email = ['talk@controlshiftlabs.com'] spec.summary = 'Ruby API Wrapper for Tokyo CRM service' spec.description = 'Tokyo is a CRM middleware, this gem helps apps talk to it.' From bdd1011254dd262b28b60fc49597fa8d698c1cb9 Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Fri, 20 Feb 2026 09:56:16 -0500 Subject: [PATCH 6/7] 884: fix gemset --- .ruby-gemset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-gemset b/.ruby-gemset index 4dcdb08..0983d62 100644 --- a/.ruby-gemset +++ b/.ruby-gemset @@ -1 +1 @@ --global \ No newline at end of file +tokyo_api \ No newline at end of file From fa682bad105ac9828e1bf5471d9de7c55ebfee44 Mon Sep 17 00:00:00 2001 From: Owens Ehimen Date: Fri, 20 Feb 2026 12:35:48 -0500 Subject: [PATCH 7/7] 884: PR comments --- .rubocop.yml | 2 -- .ruby-gemset | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a3280e4..b6bf2ac 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,8 +14,6 @@ Layout/SpaceInsideRangeLiteral: Enabled: true Lint: Enabled: true -Lint/RaiseException: - Enabled: true Naming/AsciiIdentifiers: Enabled: true Naming/ClassAndModuleCamelCase: diff --git a/.ruby-gemset b/.ruby-gemset index 0983d62..26855bf 100644 --- a/.ruby-gemset +++ b/.ruby-gemset @@ -1 +1 @@ -tokyo_api \ No newline at end of file +tokyo_api