lib/api-client/class_methods.rb in api-client-2.7.0 vs lib/api-client/class_methods.rb in api-client-3.0.0

- old
+ new

@@ -21,11 +21,11 @@ # @param [Hash] header hash with the header options. # @return [Base] the object initialized. def post(attributes, header = {}) return new(attributes) if ApiClient.config.mock url = "#{ApiClient.config.path[path]}#{self.resource_path}" - response = ApiClient::Dispatcher.post(url, attributes, header) + response = ApiClient::Dispatcher.post(url, { self.root_node.to_sym => attributes }, header) build(response, url) end alias_method :create, :post @@ -35,11 +35,11 @@ # @param [Hash] header hash with the header options. # @return [Base] the object initialized. def put(id, attributes, header = {}) return new(attributes) if ApiClient.config.mock url = "#{ApiClient.config.path[path]}#{self.resource_path}/#{id}" - response = ApiClient::Dispatcher.put(url, attributes, header) + response = ApiClient::Dispatcher.put(url, { self.root_node.to_sym => attributes }, header) build(response, url) end alias_method :update_attributes, :put @@ -49,10 +49,10 @@ # @param [Hash] header hash with the header options. # @return [Base] the object initialized. def patch(id, attributes, header = {}) return new(attributes) if ApiClient.config.mock url = "#{ApiClient.config.path[path]}#{self.resource_path}/#{id}" - response = ApiClient::Dispatcher.patch(url, attributes, header) + response = ApiClient::Dispatcher.patch(url, { self.root_node.to_sym => attributes }, header) build(response, url) end # Make a delete requisition and initialize an object with the response. # \ No newline at end of file