diff --git a/Gemfile.lock b/Gemfile.lock index 36c8d0d..53cf737 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,28 +1,27 @@ PATH remote: . specs: - cirro-ruby-client (1.6.1) + cirro-ruby-client (1.6.2) 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 (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.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 +29,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) + jwt (2.3.0) 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 +84,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 +92,6 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - zeitwerk (2.4.2) 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/base.rb b/lib/cirro_io/client/base.rb index 3ebd07a..1b7e2b1 100644 --- a/lib/cirro_io/client/base.rb +++ b/lib/cirro_io/client/base.rb @@ -28,6 +28,26 @@ def self.custom_connection conn.use JsonApiClient::Middleware::Status, {} end end + + # 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 + 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 + # rubocop:enable all end end end diff --git a/lib/cirro_io/client/version.rb b/lib/cirro_io/client/version.rb index 8316653..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.6.1' + VERSION = '1.6.2' end end # rubocop:enable Style/MutableConstant