Created
October 12, 2013 12:41
-
-
Save arturo-c/6949625 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Gemfile b/Gemfile | |
index cecf9d3..51dc2f2 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -12,6 +12,7 @@ gem 'mongoid' | |
gem 'omniauth' | |
gem 'omniauth-twitter' | |
gem 'twitter' | |
+gem 'geocoder' | |
group :development do | |
gem 'better_errors' | |
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx] | |
diff --git a/Gemfile.lock b/Gemfile.lock | |
index f2c4394..2ac1d0e 100644 | |
--- a/Gemfile.lock | |
+++ b/Gemfile.lock | |
@@ -81,6 +81,7 @@ GEM | |
figaro (0.7.0) | |
bundler (~> 1.0) | |
rails (>= 3, < 5) | |
+ geocoder (1.1.8) | |
gherkin (2.12.1) | |
multi_json (~> 1.3) | |
hashie (2.0.5) | |
@@ -217,6 +218,7 @@ DEPENDENCIES | |
email_spec | |
factory_girl_rails | |
figaro | |
+ geocoder | |
jquery-rails | |
launchy | |
mongoid | |
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb | |
index e69de29..5da8a19 100644 | |
--- a/app/controllers/games_controller.rb | |
+++ b/app/controllers/games_controller.rb | |
@@ -0,0 +1,14 @@ | |
+class GamesController < ApplicationController | |
+ def index | |
+ if session[:client] | |
+ client = session[:client] | |
+ timeline = client.home_timeline | |
+ test = Geocoder.coordinates('75243') | |
+ search = client.search("pick-up game", :count => 100, :geocode => test[0].to_s + ',' + test[1].to_s + ',50mi') | |
+ tweet = client.status(388432224955031552) | |
+ user = client.user_timeline(785708023) | |
+ | |
+ client | |
+ end | |
+ end | |
+end | |
\ No newline at end of file | |
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb | |
index 0b767bd..0e16cf6 100644 | |
--- a/app/controllers/sessions_controller.rb | |
+++ b/app/controllers/sessions_controller.rb | |
@@ -9,13 +9,12 @@ class SessionsController < ApplicationController | |
auth = request.env["omniauth.auth"] | |
user = User.where(:provider => auth['provider'], | |
:uid => auth['uid'].to_s).first || User.create_with_omniauth(auth) | |
- client = Twitter::Client.new( | |
- :oauth_token => auth['credentials']['token'], | |
- :oauth_consumer => auth['credentials']['secret'] | |
- ) | |
- timeline = Twitter.home_timeline | |
reset_session | |
session[:user_id] = user.id | |
+ session[:client] = Twitter::Client.new( | |
+ :oauth_token => auth['credentials']['token'], | |
+ :oauth_token_secret => auth['credentials']['secret'] | |
+ ) | |
if user.email.blank? | |
redirect_to edit_user_path(user), :alert => "Please enter your email address." | |
else | |
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb | |
index e69de29..30ee8a2 100644 | |
--- a/app/views/games/index.html.erb | |
+++ b/app/views/games/index.html.erb | |
@@ -0,0 +1,6 @@ | |
+<h3>Home</h3> | |
+<% unless @games.nil? %> | |
+<% @games.each do |game| %> | |
+ <p>Game: <%=link_to game.name, game %></p> | |
+<% end %> | |
+<% end %> | |
diff --git a/config/routes.rb b/config/routes.rb | |
index cde2ce1..28228ad 100644 | |
--- a/config/routes.rb | |
+++ b/config/routes.rb | |
@@ -1,6 +1,7 @@ | |
Pugwarriors::Application.routes.draw do | |
- root :to => "home#index" | |
+ root :to => "games#index" | |
resources :users, :only => [:index, :show, :edit, :update ] | |
+ resources :games | |
match '/auth/:provider/callback' => 'sessions#create' | |
match '/signin' => 'sessions#new', :as => :signin | |
match '/signout' => 'sessions#destroy', :as => :signout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment