* VRFS-468 - hiding any pages not needed for production appropriately

This commit is contained in:
Seth Call 2014-02-22 07:46:41 +00:00
parent db6dfe38b9
commit a42d750b30
3 changed files with 56 additions and 50 deletions

View File

@ -0,0 +1,35 @@
class GmailController < ApplicationController
def gmail_contacts
if current_user.nil?
render :nothing => true, :status => 404
return
end
authorization = current_user.user_authorizations.where(:provider => 'google_login')
if authorization.empty?
render :nothing => true, :status => 404
return
end
token = authorization.first.token
uri = URI.parse("https://www.google.com/m8/feeds/contacts/default/full?oauth_token=#{token}&max-results=50000&alt=json")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
contacts = ActiveSupport::JSON.decode(response.body)
ret_contacts = []
contacts['feed']['entry'].each_with_index do |contact,index|
name = contact['title']['$t']
contact['gd$email'].to_a.each do |email|
email_address = email['address']
ret_contacts.push(email_address)
end
end
render :json => ret_contacts
end
end

View File

@ -1,41 +1,14 @@
###############################################################
### A spike is something that you build to prove something. ###
### It's not meant to be used in the actual product. ###
###############################################################
class SpikesController < ApplicationController
def facebook_invite
end
def gmail_contacts
if current_user.nil?
render :nothing => true, :status => 404
return
end
authorization = current_user.user_authorizations.where(:provider => 'google_login')
if authorization.empty?
render :nothing => true, :status => 404
return
end
token = authorization.first.token
uri = URI.parse("https://www.google.com/m8/feeds/contacts/default/full?oauth_token=#{token}&max-results=50000&alt=json")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
contacts = ActiveSupport::JSON.decode(response.body)
ret_contacts = []
contacts['feed']['entry'].each_with_index do |contact,index|
name = contact['title']['$t']
contact['gd$email'].to_a.each do |email|
email_address = email['address']
ret_contacts.push(email_address)
end
end
render :json => ret_contacts
end
def listen_in
#as_musician = false is the critical search criteria for sessions to list correctly

View File

@ -8,14 +8,8 @@ SampleApp::Application.routes.draw do
resources :users
resources :sessions, only: [:new, :create, :destroy]
#root to: 'static_pages#home'
#root to: 'clients#index'
root to: 'users#welcome'
#match '/welcome', to: 'users#welcome'
# This page is still here, and is under test. Keep a route to it.
match '/oldhome', to: 'static_pages#home'
# signup, and signup completed, related pages
match '/signup', to: 'users#new', :via => 'get'
match '/signup', to: 'users#create', :via => 'post'
@ -38,17 +32,10 @@ SampleApp::Application.routes.draw do
match '/isp/ping.jar', :to => redirect('/ping.jar')
match '/isp/ping:isp', :to => 'users#jnlp', :constraints => {:format => :jnlp}, :as => 'isp_ping'
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/faders', to: 'static_pages#faders'
match '/client', to: 'clients#index'
match '/confirm/:signup_token', to: 'users#signup_confirm', as: 'signup_confirm'
match '/test_connection', to: 'sessions#connection_state', :as => :connection_state
match '/client/authed/:authed/:data', to: 'clients#auth_action', :as => :auth_action
# ping test
@ -59,11 +46,6 @@ SampleApp::Application.routes.draw do
match '/ping/pingtw.jnlp', to: 'ping#tw'
match '/ping/pingvz.jnlp', to: 'ping#vz'
# spikes
match '/facebook_invite', to: 'spikes#facebook_invite'
match '/gmail_contacts', to: 'spikes#gmail_contacts'
match '/listen_in', to: 'spikes#listen_in'
# share tokens
match '/s/:id', to: 'share_tokens#shareable_resolver', :as => 'share_token'
@ -76,12 +58,28 @@ SampleApp::Application.routes.draw do
# email update
match '/confirm_email' => 'users#finalize_update_email', :as => 'confirm_email' # NOTE: if you change this, you break outstanding email changes because links in user inboxes are broken
match '/gmail_contacts', to: 'gmail#gmail_contacts'
# embed resque-web if this is development mode
if Rails.env == "development"
require 'resque/server'
require 'resque-retry'
require 'resque-retry/server'
mount Resque::Server.new, :at => "/resque" if Rails.env == "development"
# route to spike controller (proof-of-concepts)
match '/facebook_invite', to: 'spikes#facebook_invite'
match '/listen_in', to: 'spikes#listen_in'
# junk pages
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/faders', to: 'static_pages#faders'
end
if Rails.env == "test"
match '/test_connection', to: 'sessions#connection_state', :as => :connection_state
end
scope '/corp' do