Class: BaseController

Inherits:
ActionController::Base
  • Object
show all
Includes:
UserActionLogger
Defined in:
app/controllers/base_controller.rb

Constant Summary collapse

API_VERSION =
1.3
SUPPORTED_API_VERSIONS =
[1.0,1.1,1.2, 1.3]

Instance Method Summary collapse

Methods included from UserActionLogger

#get_action_logger, #log_action

Instance Method Details

#showObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/controllers/base_controller.rb', line 26

def show
  blacklisted_words = OpenShift::ApplicationContainerProxy.get_blacklisted
  unless nolinks
    links = {
      "API" => Link.new("API entry point", "GET", URI::join(get_url, "api")),
      "GET_ENVIRONMENT" => Link.new("Get environment information", "GET", URI::join(get_url, "environment")),
      "GET_USER" => Link.new("Get user information", "GET", URI::join(get_url, "user")),      
      "LIST_DOMAINS" => Link.new("List domains", "GET", URI::join(get_url, "domains")),
      "ADD_DOMAIN" => Link.new("Create new domain", "POST", URI::join(get_url, "domains"), [
        Param.new("id", "string", "Name of the domain",nil,blacklisted_words)
      ]),
      "LIST_CARTRIDGES" => Link.new("List cartridges", "GET", URI::join(get_url, "cartridges")),
      "LIST_TEMPLATES" => Link.new("List application templates", "GET", URI::join(get_url, "application_templates")),
      "LIST_ESTIMATES" => Link.new("List available estimates", "GET" , URI::join(get_url, "estimates"))
    }
    links.merge!(if base_url = Rails.application.config.openshift[:community_quickstarts_url]
      base_url = URI.join(get_url, base_url).to_s
      {
        "LIST_QUICKSTARTS"   => Link.new("List quickstarts", "GET", URI::join(base_url, "v1/quickstarts/promoted.json")),
        "SHOW_QUICKSTART"    => Link.new("Retrieve quickstart with :id", "GET", URI::join(base_url, "v1/quickstarts/:id"), [
          Param.new(":id", "string", "Unique identifier of the quickstart", nil, [])
        ]),
        "SEARCH_QUICKSTARTS" => Link.new("Search quickstarts", "GET", URI::join(base_url, "v1/quickstarts.json"), [
          Param.new("search", "string", "The search term to use for the quickstart", nil, [])
        ]),
      }
    else
      {
        "LIST_QUICKSTARTS"   => Link.new("List quickstarts", "GET", URI::join(get_url, "quickstarts")),
        "SHOW_QUICKSTART"    => Link.new("Retrieve quickstart with :id", "GET", URI::join(get_url, "quickstarts/:id"), [
          Param.new(":id", "string", "Unique identifier of the quickstart", nil, [])
        ]),
      }
    end)
  end
  
  @reply = RestReply.new(:ok, "links", links)
  respond_with @reply, :status => @reply.status
end