lib/api-client/class_methods.rb in api-client-2.3.0 vs lib/api-client/class_methods.rb in api-client-2.4.0
- old
+ new
@@ -16,11 +16,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}"
+ url = "#{ApiClient.config.path[path]}#{self.resource_path}/#{id}"
response = ApiClient::Dispatcher.get(url, header)
params = ApiClient::Parser.response(response, url)
build(params)
end
@@ -31,43 +31,41 @@
# @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}"
+ url = "#{ApiClient.config.path[path]}#{self.resource_path}"
response = ApiClient::Dispatcher.post(url, attributes, header)
params = ApiClient::Parser.response(response, url)
build(params)
end
alias_method :create, :post
# Make a put requisition and initialize an object with the response.
#
- # @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}"
+ url = "#{ApiClient.config.path[path]}#{self.resource_path}"
response = ApiClient::Dispatcher.put(url, attributes, header)
params = ApiClient::Parser.response(response, url)
build(params)
end
alias_method :update_attributes, :put
# Make a patch requisition and initialize an object with the response.
#
- # @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}"
+ url = "#{ApiClient.config.path[path]}#{self.resource_path}"
response = ApiClient::Dispatcher.patch(url, attributes, header)
params = ApiClient::Parser.response(response, url)
build(params)
end
@@ -76,10 +74,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}"
+ url = "#{ApiClient.config.path[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