From 7f9fedcffef0e0e45fcba59197128436fe93ed7d Mon Sep 17 00:00:00 2001 From: Olivier Brisse Date: Wed, 8 Nov 2017 16:19:17 +1100 Subject: [PATCH] Remove obsolete json_api_client monkey patch The chingor13/json_api_client#263 PR has been merged and released in 1.5.2 which is the minimum version required --- core/config/initializers/json_api_client.rb | 2 -- .../resource_extension.rb | 23 ------------------- 2 files changed, 25 deletions(-) delete mode 100644 core/config/initializers/json_api_client.rb delete mode 100644 core/lib/json_api_client_extension/resource_extension.rb diff --git a/core/config/initializers/json_api_client.rb b/core/config/initializers/json_api_client.rb deleted file mode 100644 index dfb22a526..000000000 --- a/core/config/initializers/json_api_client.rb +++ /dev/null @@ -1,2 +0,0 @@ -# MonkeyPatching json_api_client, see: https://github.com/chingor13/json_api_client/pull/263 -JsonApiClient::Resource.include JsonApiClientExtension::ResourceExtension diff --git a/core/lib/json_api_client_extension/resource_extension.rb b/core/lib/json_api_client_extension/resource_extension.rb deleted file mode 100644 index c1e8c7bdd..000000000 --- a/core/lib/json_api_client_extension/resource_extension.rb +++ /dev/null @@ -1,23 +0,0 @@ -# MonkeyPatching json_api_client, see: https://github.com/chingor13/json_api_client/pull/263 -module JsonApiClientExtension::ResourceExtension - extend ActiveSupport::Concern - - included do - def initialize(params = {}) - @persisted = nil - self.links = self.class.linker.new(params.delete("links") || {}) - self.relationships = self.class.relationship_linker.new(self.class, params.delete("relationships") || {}) - self.attributes = params.merge(self.class.default_attributes) - - self.class.schema.each_property do |property| - attributes[property.name] = property.default unless attributes.has_key?(property.name) || property.default.nil? - end - - self.class.associations.each do |association| - if params.has_key?(association.attr_name.to_s) - set_attribute(association.attr_name, params[association.attr_name.to_s]) - end - end - end - end -end