def generate_rest_url(action, object_type, object_id = nil)
      url = custom_url_for(object_type, action)

      method = if action == :list || action == :show
        :get
      elsif action == :create
        :post
      elsif action == :update
        :put
      end

      if url
        url.request_method ||= method
        if object_id
          url.path.sub!(':id', object_id.to_s)
        end
        return url if url
      end

      path = ''
      path += @contexts.collect { |name, value|
        "#{name}/#{value}"
      }.join('/')
      path += '/'
      if action == :list || action == :create
        path += object_type.to_s.pluralize
      elsif action == :show || action == :update
        path += "#{object_type.to_s.pluralize}/#{object_id.to_s}"
      end
      url = generate_url(path)

      ServiceUrl.new(url, method)
    end
def generate_rest_url(action, object_type, object_id = nil)
      url = custom_url_for(object_type, action)

      method = if action == :list || action == :show
        :get
      elsif action == :create
        :post
      elsif action == :update
        :put
      end

      if url
        url.request_method ||= method
        if object_id
          url.path.sub!(':id', object_id.to_s)
        end
        return url if url
      end

      path = ''
      path += @contexts.collect { |name, value|
        "#{name}/#{value}"
      }.join('/')
      path += '/'
      if action == :list || action == :create
        path += object_type.to_s.pluralize
      elsif action == :show || action == :update
        path += "#{object_type.to_s.pluralize}/#{object_id.to_s}"
      end
      url = generate_url(path)

      ServiceUrl.new(url, method)
    end
Generating URLs

 Generates url for REST service
 @param [Symbol] Action: show, list, update or destroy
 @param [Symbol] Object type
 @param [Integer] Object ID
 @return [Service::ServiceUrl] Generated URL