lib/gotransverse-tract-api.rb in gotransverse-tract-api-0.5.1 vs lib/gotransverse-tract-api.rb in gotransverse-tract-api-0.5.2
- old
+ new
@@ -186,10 +186,22 @@
api_url = GoTransverseTractApi.get_api_url_for(klass)
self.call(klass, api_url, api_params, :put, request_body.to_xml)
end
#
+ # self.delete_request_for
+ #
+ # @param {Class} klass
+ # @param {Hash} api_params (optional)
+ # @param {Hash} request_body
+ #
+ def self.delete_request_for(klass, api_params={}, request_body)
+ api_url = GoTransverseTractApi.get_api_url_for(klass)
+ self.call(klass, api_url, api_params, :delete, request_body)
+ end
+
+ #
# Generate XML for request body
#
# @param {hash} data
# @param (String} root element
#
@@ -250,9 +262,11 @@
response = http_client.get(api_url, api_params)
when :post
response = http_client.post(api_url, request_body, {'Content-Type' => 'application/xml', 'Accept' => 'application/xml'})
when :put
response = http_client.put(api_url, request_body, api_params)
+ when :delete
+ response = http_client.delete(api_url, request_body, api_params)
end
xml_response = Nokogiri::XML(response.body.to_s)
klass = klass.to_s.split("::").last