lib/api-client/class_methods.rb in api-client-2.2.0 vs lib/api-client/class_methods.rb in api-client-2.3.0

- old
+ new

@@ -15,10 +15,11 @@ # # @param [Integer] id id of the object. # @param [Hash] header hash with the header options. # @return [Base] the object initialized. def get(id, header = {}) + return build(:id => id) if ApiClient.config.mock url = "#{ApiClient.config.path}#{self.resource_path}/#{id}" response = ApiClient::Dispatcher.get(url, header) params = ApiClient::Parser.response(response, url) build(params) end @@ -29,10 +30,11 @@ # # @param [Hash] attributes hash with the attributes to send. # @param [Hash] header hash with the header options. # @return [Base] the object initialized. def post(attributes, header = {}) + return build(attributes) if ApiClient.config.mock url = "#{ApiClient.config.path}#{self.resource_path}" response = ApiClient::Dispatcher.post(url, attributes, header) params = ApiClient::Parser.response(response, url) build(params) end @@ -44,10 +46,11 @@ # @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(attributes, header = {}) + return build(attributes) if ApiClient.config.mock url = "#{ApiClient.config.path}#{self.resource_path}" response = ApiClient::Dispatcher.put(url, attributes, header) params = ApiClient::Parser.response(response, url) build(params) end @@ -59,10 +62,11 @@ # @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(attributes, header = {}) + return build(attributes) if ApiClient.config.mock 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 +75,10 @@ # # @param [Integer] id id of the object. # @param [Hash] header hash with the header options. # @return [Base] the object initialized. def delete(id, header = {}) + return build(:id => id) if ApiClient.config.mock url = "#{ApiClient.config.path}#{self.resource_path}/#{id}" response = ApiClient::Dispatcher.delete(url, header) params = ApiClient::Parser.response(response, url) build(params) end \ No newline at end of file