def call(resource, args = {})
      unless parent.respond_to?(:uri)
        raise "You can't call a method that's not attached to a resource! (You may have dereferenced a method when you shouldn't have)"
      end

      resource ||= parent
      method = dereference

      uri = method.request ? method.request.uri(resource, args) : resource.uri(args)

      headers = uri.headers.dup
      headers['Accept'] = expect_representation.mediaType if args[:expect_representation]

      method.response.build(HTTPRequest.execute(
        uri, name, args[:send_representation], headers))
    end
def call(resource, args = {})
      unless parent.respond_to?(:uri)
        raise "You can't call a method that's not attached to a resource! (You may have dereferenced a method when you shouldn't have)"
      end

      resource ||= parent
      method = dereference

      uri = method.request ? method.request.uri(resource, args) : resource.uri(args)

      headers = uri.headers.dup
      headers['Accept'] = expect_representation.mediaType if args[:expect_representation]

      method.response.build(HTTPRequest.execute(
        uri, name, args[:send_representation], headers))
    end
Args:
  :path - Values for path parameters
  :query - Values for query parameters
  :headers - Values for header parameters
  :send_representation
  :expect_representation