lib/api-client/class_methods.rb in api-client-2.0.2 vs lib/api-client/class_methods.rb in api-client-2.0.3

- old
+ new

@@ -39,12 +39,12 @@ # # @param [Integer] id id of the object. # @param [Hash] attributes hash with the attributes to send. # @param [Hash] header hash with the header options. # @return [Base] the object initialized. - def put(id, attributes, header = {}) - url = "#{ApiClient.config.path}#{self.resource_path}/#{id}" + def put(attributes, header = {}) + url = "#{ApiClient.config.path}#{self.resource_path}" response = ApiClient::Dispatcher.put(url, attributes, header) params = ApiClient::Parser.response(response, url) build(params) end @@ -52,12 +52,12 @@ # # @param [Integer] id id of the object. # @param [Hash] attributes hash with the attributes to send. # @param [Hash] header hash with the header options. # @return [Base] the object initialized. - def patch(id, attributes, header = {}) - url = "#{ApiClient.config.path}#{self.resource_path}/#{id}" + def patch(attributes, header = {}) + url = "#{ApiClient.config.path}#{self.resource_path}" response = ApiClient::Dispatcher.patch(url, attributes, header) params = ApiClient::Parser.response(response, url) build(params) end @@ -71,9 +71,13 @@ response = ApiClient::Dispatcher.delete(url, header) params = ApiClient::Parser.response(response, url) build(params) end + # Removes the root node attribute if found. + # + # @param [Hash] attributes the hash with attributes. + # @return [Hash] the hash with attributes without the root node. def remove_root(attributes = {}) attributes = attributes[self.root_node.to_sym] if attributes.key?(self.root_node.to_sym) attributes = attributes[self.root_node.to_s] if attributes.key?(self.root_node.to_s) attributes end \ No newline at end of file