Example Test App for The City
Ruby JavaScript CSS CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db
doc
lib
public
script
test
vendor
.gitignore
.ruby-gemset
.ruby-version
Gemfile
Gemfile.lock
Procfile
README.md
README.rdoc
Rakefile
config.ru

README.md

The City Example Internal Plugin

Example Test App for The City

This is a Rails app that can be used as a plugin to The City. It does the basic data decrypt and displays the information in various formats. It makes an API call to the authentication service to retrieve additional user data. It also makes a second API call to The City "me" api using TheCity gem (https://github.com/thecity/thecity).

In order to get this sample to run, you will need to configure a couple of environment variables:

THECITY_APP_ID=XXXXXXXXXXXXX
THECITY_APP_SECRET=XXXXXXXXXXXXX
THECITY_AUTH_URL=https://authentication.onthecity.org/authorization

Alternately, you can specify a YAML file located at: /config/thecity.yml, that has the following format:

production:
  THECITY_APP_ID: XXXXXXXXXXXXXXXXXXXX
  THECITY_APP_SECRET: XXXXXXXXXXXXXXXXXXXX
  THECITY_AUTH_URL: https://authentication.onthecity.org/authorization
                                                                         \

Safari and Cookies

There is an issue with the Safari browser and plugins in iFrames. Safari does not allow Third Party Cookies by default, so any attempt to set a cookie (like for cookie based sessions) will fail. This example plugin includes a work around for this, which takes a Safari user through this flow:

  1. Safari user opens plugin in iFrame
  2. User is presented with message that asks them to "Click Here"
  3. User clicks, a NEW tab is opened
  4. A permanent cookie is set by new window
  5. New window closes itself and refreshes iFrame
  6. Cookies can now be set, and normal output displayed

In order to enable this scenario in the plugin, pass a parameter of

cookies=true

to the end of URL string you are using to call the plugin. Otherwise, it doesn't attempt to set any cookies. Since the cookie is permanent, the user will not have to do this again, even if they close and reopen their browser. They will if they completely clear their cookies.