class Fedora::Repository

def fetch_custom(object, method, extra_params = { :format => 'xml' })

-
This method returns raw xml response from the server
== Returns

extra_params:: any other extra parameters to pass to fedora
method:: the method to fetch such as :export, :history, :versions, etc
object:: a fedora uri, pid, FedoraObject instance
== Parameters
such as profile, versions, etc...
Fetch the given object using custom method. This is used to fetch other aspects of a fedora object,
def fetch_custom(object, method, extra_params = { :format => 'xml' })
  path = case method
    when :profile then ""
    else "/#{method}"
  end
  
  extra_params.delete(:format) if method == :export
  connection.raw_get("#{url_for(object)}#{path}?#{extra_params.to_fedora_query}").body
end