From da9668860adbdbf687ae12c0c30efff55937b41d Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Tue, 29 Mar 2022 11:55:43 +0200 Subject: [PATCH 1/6] Update json_api_client and bump version to 1.7.0 --- Gemfile.lock | 28 ++++++++++++++-------------- cirro-ruby-client.gemspec | 2 +- lib/cirro_io/client/version.rb | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 36c8d0d..74afddc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,25 +4,25 @@ PATH cirro-ruby-client (1.6.1) faraday (< 1.2.0) faraday_middleware - json_api_client (>= 1.10.0, <= 1.18.0) + json_api_client (>= 1.10.0) jwt GEM remote: https://rubygems.org/ specs: - activemodel (6.1.3.2) - activesupport (= 6.1.3.2) - activesupport (6.1.3.2) + activemodel (6.1.5) + activesupport (= 6.1.5) + activesupport (6.1.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ast (2.4.1) coderay (1.1.3) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.10) crack (0.4.4) diff-lcs (1.4.4) faker (2.14.0) @@ -30,21 +30,21 @@ GEM faraday (1.1.0) multipart-post (>= 1.2, < 3) ruby2_keywords - faraday_middleware (1.0.0) + faraday_middleware (1.2.0) faraday (~> 1.0) hashdiff (1.0.1) - i18n (1.8.5) + i18n (1.10.0) concurrent-ruby (~> 1.0) - json_api_client (1.18.0) + json_api_client (1.21.0) activemodel (>= 3.2.0) activesupport (>= 3.2.0) addressable (~> 2.2) - faraday (>= 0.15.2, < 1.2.0) - faraday_middleware (>= 0.9.0, < 1.2.0) + faraday (>= 0.15.2, < 2.0) + faraday_middleware (>= 0.9.0, < 2.0) rack (>= 0.2) jwt (2.2.3) method_source (1.0.0) - minitest (5.14.4) + minitest (5.15.0) multipart-post (2.1.1) parallel (1.19.2) parser (2.7.2.0) @@ -85,7 +85,7 @@ GEM rubocop-rspec (1.43.2) rubocop (~> 0.87) ruby-progressbar (1.10.1) - ruby2_keywords (0.0.4) + ruby2_keywords (0.0.5) tzinfo (2.0.4) concurrent-ruby (~> 1.0) unicode-display_width (1.7.0) @@ -93,7 +93,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - zeitwerk (2.4.2) + zeitwerk (2.5.4) PLATFORMS ruby diff --git a/cirro-ruby-client.gemspec b/cirro-ruby-client.gemspec index 6062fc3..9000ac3 100644 --- a/cirro-ruby-client.gemspec +++ b/cirro-ruby-client.gemspec @@ -28,5 +28,5 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'jwt' spec.add_runtime_dependency 'faraday', '< 1.2.0' spec.add_runtime_dependency 'faraday_middleware' - spec.add_runtime_dependency 'json_api_client', '>= 1.10.0', '<= 1.18.0' # TODO: see https://github.com/test-IO/cirro-ruby-client/issues/19 + spec.add_runtime_dependency 'json_api_client', '>= 1.10.0' end diff --git a/lib/cirro_io/client/version.rb b/lib/cirro_io/client/version.rb index 8316653..9016f46 100644 --- a/lib/cirro_io/client/version.rb +++ b/lib/cirro_io/client/version.rb @@ -1,7 +1,7 @@ # rubocop:disable Style/MutableConstant module CirroIO module Client - VERSION = '1.6.1' + VERSION = '1.7.0' end end # rubocop:enable Style/MutableConstant From 1fdbdce1a392b9be49d812fcd634fc0384cb4bf8 Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Tue, 29 Mar 2022 17:10:17 +0200 Subject: [PATCH 2/6] Fix tests with json_api_client monkey patch --- Gemfile.lock | 2 +- lib/cirro_io/client/base.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 74afddc..bba445c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cirro-ruby-client (1.6.1) + cirro-ruby-client (1.7.0) faraday (< 1.2.0) faraday_middleware json_api_client (>= 1.10.0) diff --git a/lib/cirro_io/client/base.rb b/lib/cirro_io/client/base.rb index 3ebd07a..5c1b254 100644 --- a/lib/cirro_io/client/base.rb +++ b/lib/cirro_io/client/base.rb @@ -28,6 +28,24 @@ def self.custom_connection conn.use JsonApiClient::Middleware::Status, {} end end + + # MonkeyPatch: https://github.com/JsonApiClient/json_api_client/issues/390 + # waiting for json_api_client to release a new version with the fix + # https://github.com/JsonApiClient/json_api_client/pull/398 + def initialize(params = {}) + params = params.with_indifferent_access + @persisted = nil + @destroyed = nil + self.links = self.class.linker.new(params.delete(:links) || {}) + self.relationships = self.class.relationship_linker.new(self.class, params.delete(:relationships) || {}) + self.attributes = self.class.default_attributes.merge params.except(*self.class.prefix_params) + self.forget_change!(:type) + self.__belongs_to_params = params.slice(*self.class.prefix_params) + + setup_default_properties + + self.request_params = self.class.request_params_class.new(self.class) + end end end end From 3573f4bce94e20335898cfd1c9b6a06828c54e12 Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Tue, 29 Mar 2022 17:19:47 +0200 Subject: [PATCH 3/6] Ignore linter --- lib/cirro_io/client/base.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cirro_io/client/base.rb b/lib/cirro_io/client/base.rb index 5c1b254..3c2200c 100644 --- a/lib/cirro_io/client/base.rb +++ b/lib/cirro_io/client/base.rb @@ -32,6 +32,7 @@ def self.custom_connection # MonkeyPatch: https://github.com/JsonApiClient/json_api_client/issues/390 # waiting for json_api_client to release a new version with the fix # https://github.com/JsonApiClient/json_api_client/pull/398 + # rubocop:disable all def initialize(params = {}) params = params.with_indifferent_access @persisted = nil @@ -46,6 +47,7 @@ def initialize(params = {}) self.request_params = self.class.request_params_class.new(self.class) end + # rubocop:enable all end end end From 94ed2304d29acdd2cb1f8a93cbffc481dd5e0548 Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Tue, 29 Mar 2022 17:49:35 +0200 Subject: [PATCH 4/6] Update lib/cirro_io/client/base.rb Co-authored-by: Alexander Senko --- lib/cirro_io/client/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cirro_io/client/base.rb b/lib/cirro_io/client/base.rb index 3c2200c..1b7e2b1 100644 --- a/lib/cirro_io/client/base.rb +++ b/lib/cirro_io/client/base.rb @@ -29,7 +29,7 @@ def self.custom_connection end end - # MonkeyPatch: https://github.com/JsonApiClient/json_api_client/issues/390 + # HACK: https://github.com/JsonApiClient/json_api_client/issues/390 # waiting for json_api_client to release a new version with the fix # https://github.com/JsonApiClient/json_api_client/pull/398 # rubocop:disable all From 8ed533f4f9b088e05d6d86b85a54116ee9654ccc Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Wed, 30 Mar 2022 10:40:02 +0200 Subject: [PATCH 5/6] Update lib/cirro_io/client/version.rb Co-authored-by: Alexander Senko --- lib/cirro_io/client/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cirro_io/client/version.rb b/lib/cirro_io/client/version.rb index 9016f46..1edcab8 100644 --- a/lib/cirro_io/client/version.rb +++ b/lib/cirro_io/client/version.rb @@ -1,7 +1,7 @@ # rubocop:disable Style/MutableConstant module CirroIO module Client - VERSION = '1.7.0' + VERSION = '1.6.2' end end # rubocop:enable Style/MutableConstant From 47e8bdcb327dff4d9b4b59e67e49583ed61974e3 Mon Sep 17 00:00:00 2001 From: Jiayi Zheng Date: Wed, 30 Mar 2022 10:40:58 +0200 Subject: [PATCH 6/6] Update version --- Gemfile.lock | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bba445c..53cf737 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cirro-ruby-client (1.7.0) + cirro-ruby-client (1.6.2) faraday (< 1.2.0) faraday_middleware json_api_client (>= 1.10.0) @@ -10,14 +10,13 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (6.1.5) - activesupport (= 6.1.5) - activesupport (6.1.5) + activemodel (7.0.2.3) + activesupport (= 7.0.2.3) + activesupport (7.0.2.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ast (2.4.1) @@ -42,7 +41,7 @@ GEM faraday (>= 0.15.2, < 2.0) faraday_middleware (>= 0.9.0, < 2.0) rack (>= 0.2) - jwt (2.2.3) + jwt (2.3.0) method_source (1.0.0) minitest (5.15.0) multipart-post (2.1.1) @@ -93,7 +92,6 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - zeitwerk (2.5.4) PLATFORMS ruby