def build_request(method, resource = nil, id = nil, body =nil, query = {})

      url =  self.endpoint 
      url += "/" + resource unless resource.nil?
      url += "/" + id.to_s unless id.nil?
      query[:key] = self.api_key unless self.api_key.nil?

      case method
      when "get"
        self.connection.get(url, :params => query)
      when "post"
        self.connection.post(url, :body => body, :params => query)
      when "put"
        self.connection.put(url, :body => body, :params => query)
      when "delete"
        begin
          self.connection.delete(url, :params => query)
        rescue TypeError
          # Not putting the error to stdout
        end
      end

    end
def build_request(method, resource = nil, id = nil, body =nil, query = {})

      url =  self.endpoint 
      url += "/" + resource unless resource.nil?
      url += "/" + id.to_s unless id.nil?
      query[:key] = self.api_key unless self.api_key.nil?

      case method
      when "get"
        self.connection.get(url, :params => query)
      when "post"
        self.connection.post(url, :body => body, :params => query)
      when "put"
        self.connection.put(url, :body => body, :params => query)
      when "delete"
        begin
          self.connection.delete(url, :params => query)
        rescue TypeError
          # Not putting the error to stdout
        end
      end

    end
Helper method to build an API request

 @param method [String] The type of REST request to make: "get", "post",
   "put", or "delete".
 @param resource [String] The type of resource to request from the Omeka
   site, e.g., "items" or "site".
 @param id [Integer] The id of the resource to request from the Omeka
   site.
 @param body [] The body of a request in a PUT or POST request.
 @param query [Hash] Additional query parameters for the request.

 @return [NetHttpPersistentResponseWrapper] A wrapper around the API's
 response, containing the HTTP code and the response body.

 @since 1.0.0