SeetheCity Server
SeetheCity Server is a Ruby on Rails backend for the demo SeetheCity iOS tour guide app. It uses Twitter's public APIs to calculate tweet volumes to determine popular city attractions. The GNIP Audience API is used to analyze an attraction's Twitter followers to determine a set of audience interests.
Getting Started
-
Create a Twitter App
-
Clone the repository:
git clone [email protected]:twitterdev/seethecity-server.git -
Install Rails
gem install rails -
Download and run PostgreSQL from http://postgresapp.com/ or http://www.postgresql.org/download/macosx/
-
Run the self-setup script:
cd seethecity-server ./bin/setup -
Run
rake secretand add the secret to.env -
Add your Twitter API credentials to
.env -
Start the server
rails s -
Verify that the app is up and running.
API Endpoints
GET /api/cities
Returns a list of supported cities.
Parameters
None
Response
| Field | Type | Description |
|---|---|---|
| id | String | City ID |
| name | String | City Name |
GET /api/cities/:city_id/ranked_attractions
Returns a list of the top 10 city attractions, ranked by attraction tweet mentions volume over the past 7 days.
Parameters
| Field | Type | Description |
|---|---|---|
| city_id | String | City ID |
Response
| Field | Type | Description |
|---|---|---|
| id | string | Attraction ID |
| name | string | Attraction name |
| handle | string | Attraction handle |
| centroid_lat | number | Attraction centroid latitude coordinate |
| centroid_long | number | Attraction centroid longitude coordinate |
| tweets_count | number | Number of tweets mentioning the attraction over the past 7 days |
GET /api/attractions/:attraction_id/daily_tweet_count
Returns the number of attraction tweet mentions for each day of the week.
Parameters
| Field | Type | Description |
|---|---|---|
| attraction_id | String | Attraction ID |
Response
| Field | Type | Description |
|---|---|---|
| tweets_count | string | Number of tweets mentioning the attraction on each day of the week |
| day_of_week | string | Day of the week |
GET /api/attractions/:attraction_id/top_interests
Returns the top audience interests for an attraction.
Parameters
| Field | Type | Description |
|---|---|---|
| attraction_id | String | Attraction ID |
Response
| Field | Type | Description |
|---|---|---|
| percentage | number | Percentage of the audience with the interest |
| interest | string | Interest name |
License
Copyright 2016 Twitter, Inc.
Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0