Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Authorization, ERB::Util
Defined in:
app/controllers/application_controller.rb

Overview

All clients consuming this api must supply an HTTP header ‘X-HES-Supported-Client’ with a valid supported client type. Requests that fail to do so, will result in 400 Bad Request.

Currently the API only supports JSON, requesting any other format will result in 400 Bad Request.

Unless otherwise noted in the documentation, assume all request require HTTP Basic Authentication via user_id and api key. Likewise, the AuthorizationRule constants define the level of access for users.

Direct Known Subclasses

ActivitiesController, DestinationsController, DevicesController, EntriesController, EntryActivitiesController, RecipesController, TeamsController, TipsController, UsersController

Constant Summary

SupportedClients =

Hash of supported client types

{
  # Mobile clients
  :android => 'android',
  :ios => 'ios'
}

Instance Method Summary (collapse)

Methods included from Authorization

included, ri?, #role_included?, #set_promotion_for_public_request

Instance Method Details

- (Object) absolutize_path(path, ssl = false)

Helper method to make relative paths absolute when necessary



50
51
52
53
# File 'app/controllers/application_controller.rb', line 50

def absolutize_path(path, ssl=false)
  host = (RAILS_ENV == "development") ? "www.getfitonroute66.com" : request.host_with_port.sub('api.',"#{@promotion.subdomain}.")
  "#{ssl ? 'https' : 'http'}://#{host}#{path}"
end

- (Object) clean_summary(s)



55
56
57
# File 'app/controllers/application_controller.rb', line 55

def clean_summary(s)
  s.to_s.gsub("<p>","").gsub("</p>","") unless s.nil?
end