Skip to content

Commit

Permalink
Twitter API integration added, user's can now log in with their Twitt…
Browse files Browse the repository at this point in the history
…er account!
  • Loading branch information
KelseyDH committed May 7, 2014
1 parent 028eae6 commit d225d0b
Show file tree
Hide file tree
Showing 23 changed files with 675 additions and 339 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# Added for paperclip images, prevents pushing the images you upload to paperclip to Git!
/public/system

#files in my system to ignore:
erd.dot
irb.log

# Ignore the default SQLite database.
/db/*.sqlite3
Expand All @@ -22,3 +25,5 @@
# Ignore Email Variables for security reasons
/config/initializers/email_vars.rb
/config/initializers/s3_vars.rb #hides AWS access keys
/config/initializers/api_keys_for_twitter.rb
/TWITTERGEMPLAY.rb
13 changes: 8 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ gem 'haml'
gem 'html2haml'

gem 'devise'
gem 'omniauth-twitter'
gem 'twitter'

# Use jquery as the JavaScript library
# Note order placement of jquery must follow this:
Expand All @@ -32,7 +34,7 @@ gem 'kaminari'

gem 'cancan'

#shows percentage of text coverage
#shows percentage of test coverage
gem 'simplecov', require: false, group: :test

gem 'simple_form', git: "https://github.com/plataformatec/simple_form"
Expand All @@ -43,8 +45,8 @@ gem "aws-sdk", '~> 1.5.7' #sets up paperclip in AWS

#more robust and popular gem for many uploads
# gem "carrierwave"
#gem "rmagick", require: "RMagick" #helps resizing
# gem "fog"
gem "rmagick", require: "RMagick" #helps resizing
# gem "fog" #gem for cloud hosting configuration

group :development, :test do
gem 'rspec-rails'
Expand All @@ -54,6 +56,7 @@ group :development, :test do
# gem "capybara-webkit"
gem 'selenium-webdriver', '~> 2.41.0'
gem "database_cleaner"
gem "rails-erd" #use rake erd to create a .dot file you can view current ERD with graphviz
end
# # DEPRECRATED Use sqlite3 as the database for Active Record
# gem 'sqlite3'
Expand All @@ -65,8 +68,8 @@ group :development do
gem "hirb"
gem "interactive_editor"
gem "awesome_print"
gem 'better_errors' #debugging gem
gem 'binding_of_caller' #debugging gem
# gem 'better_errors' #debugging gem
# gem 'binding_of_caller' #debugging gem
gem "letter_opener"

end
Expand Down
67 changes: 52 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/gregbell/active_admin.git
revision: 65aae6b68e78aad3071b2f85242b19fd3fccf426
revision: 85726865440b5cb190e6b53ce5350d8553538761
specs:
activeadmin (1.0.0.pre)
arbre (~> 1.0)
Expand All @@ -12,13 +12,13 @@ GIT
jquery-rails
jquery-ui-rails
kaminari (~> 0.15)
rails (>= 3.2, <= 4.1)
rails (>= 3.2, < 4.2)
ransack (~> 1.0)
sass-rails

GIT
remote: https://github.com/plataformatec/simple_form
revision: d7306558665d38fe3a0c277ce263e99f635958de
revision: 609e1578179f0c64873510731cddb3716c557e53
specs:
simple_form (3.1.0.rc1)
actionpack (~> 4.0)
Expand Down Expand Up @@ -62,16 +62,12 @@ GEM
nokogiri (>= 1.4.4)
uuidtools (~> 2.1)
bcrypt (3.1.7-x86-mingw32)
better_errors (1.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.1.1.1)
sass (~> 3.2)
bourbon (3.2.1)
sass (~> 3.2)
thor
buftok (0.2.0)
builder (3.1.4)
cancan (1.6.10)
capybara (2.2.1)
Expand All @@ -82,11 +78,11 @@ GEM
xpath (~> 2.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
choice (0.1.6)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.4)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
Expand All @@ -96,13 +92,12 @@ GEM
coffee-script-source (1.7.0)
daemons (1.1.9)
database_cleaner (1.2.0)
debug_inspector (0.0.2)
delayed_job (4.0.1)
activesupport (>= 3.0, < 4.2)
delayed_job_active_record (4.0.1)
activerecord (>= 3.0, < 4.2)
delayed_job (>= 3.0, < 4.1)
delayed_job_web (1.2.8)
delayed_job_web (1.2.9)
activerecord (> 3.0.0)
delayed_job (> 2.0.3)
sinatra (>= 1.4.4)
Expand All @@ -114,6 +109,7 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.3)
equalizer (0.0.9)
erubis (2.7.0)
eventmachine (1.0.3-x86-mingw32)
execjs (2.0.2)
Expand All @@ -124,6 +120,8 @@ GEM
railties (>= 3.0.0)
faker (1.3.0)
i18n (~> 0.5)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.3-x86-mingw32)
formtastic (2.3.0.rc3)
actionpack (>= 3.0)
Expand All @@ -132,6 +130,7 @@ GEM
has_scope (0.6.0.rc)
actionpack (>= 3.2, < 5)
activesupport (>= 3.2, < 5)
hashie (2.1.1)
hike (1.2.3)
hirb (0.7.1)
hpricot (0.8.6)
Expand All @@ -140,6 +139,9 @@ GEM
haml (>= 4.0.0.rc.1)
hpricot (~> 0.8.6)
ruby_parser (~> 3.1.1)
http (0.5.0)
http_parser.rb
http_parser.rb (0.6.0)
httparty (0.13.1)
json (~> 1.8)
multi_xml (>= 0.5.2)
Expand Down Expand Up @@ -168,13 +170,27 @@ GEM
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
mime-types (1.25.1)
mini_portile (0.5.3)
minitest (4.7.5)
multi_json (1.9.2)
multi_json (1.10.0)
multi_xml (0.5.5)
multipart-post (2.0.0)
naught (1.0.0)
nokogiri (1.6.1-x86-mingw32)
mini_portile (~> 0.5.0)
oauth (0.4.7)
omniauth (1.2.1)
hashie (>= 1.2, < 3)
rack (~> 1.0)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-twitter (1.0.1)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
orm_adapter (0.5.0)
paperclip (4.1.1)
activemodel (>= 3.0.0)
Expand All @@ -200,13 +216,18 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
rails-erd (1.1.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
choice (~> 0.1.6)
ruby-graphviz (~> 1.0.4)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.1)
ransack (1.2.2)
ransack (1.2.3)
actionpack (>= 3.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
Expand All @@ -216,6 +237,7 @@ GEM
json (~> 1.4)
responders (1.0.0)
railties (>= 3.2, < 5)
rmagick (2.13.2)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
Expand All @@ -228,6 +250,7 @@ GEM
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-graphviz (1.0.9)
ruby_parser (3.1.3)
sexp_processor (~> 4.1)
rubyzip (1.1.3)
Expand All @@ -246,6 +269,7 @@ GEM
rubyzip (~> 1.0)
websocket (~> 1.0.4)
sexp_processor (4.4.3)
simple_oauth (0.2.0)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
Expand Down Expand Up @@ -278,6 +302,17 @@ GEM
polyglot (>= 0.3.1)
turbolinks (2.2.2)
coffee-rails
twitter (5.8.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
equalizer (~> 0.0.9)
faraday (~> 0.9.0)
http (~> 0.5.0)
http_parser.rb (~> 0.6.0)
json (~> 1.8)
memoizable (~> 0.4.0)
naught (~> 1.0)
simple_oauth (~> 0.2.0)
tzinfo (0.3.39)
uglifier (2.5.0)
execjs (>= 0.3.0)
Expand All @@ -296,8 +331,6 @@ DEPENDENCIES
activeadmin!
awesome_print
aws-sdk (~> 1.5.7)
better_errors
binding_of_caller
bootstrap-sass (~> 3.1.1)
cancan
capybara
Expand All @@ -316,10 +349,13 @@ DEPENDENCIES
jquery-ui-rails
kaminari
letter_opener
omniauth-twitter
paperclip (~> 4.1)
pg
quiet_assets
rails (= 4.0.2)
rails-erd
rmagick
rspec-rails
sass-rails (~> 4.0.0)
sdoc
Expand All @@ -328,4 +364,5 @@ DEPENDENCIES
simplecov
thin
turbolinks
twitter
uglifier (>= 1.3.0)
34 changes: 17 additions & 17 deletions app/admin/dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
end

# Here is an example of a simple dashboard with columns and panels.
#
# columns do
# column do
# panel "Recent Posts" do
# ul do
# Post.recent(5).map do |post|
# li link_to(post.title, admin_post_path(post))
# end
# end
# end
# end

columns do
column do
panel "Recent Posts" do
ul do
#Post.recent(5).map do |post|
#li link_to(post.title, admin_post_path(post))
#end
end
end
end

# column do
# panel "Info" do
# para "Welcome to ActiveAdmin."
# end
# end
# end
column do
panel "Info" do
para "Welcome to ActiveAdmin."
end
end
end
end # content
end
3 changes: 3 additions & 0 deletions app/assets/javascripts/answers.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require turbolinks
//= require jquery
//= require jquery.ui.datepicker
//= require jquery_ujs
//= require turbolinks
//= stub active_admin
//= require_tree .
3 changes: 3 additions & 0 deletions app/assets/javascripts/help.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/questions.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/users/omniauth_callbacks.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/users/omniauth_callbacks.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the users/omniauth_callbacks controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
2 changes: 2 additions & 0 deletions app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def show
end

def edit
#CanCan/ActiveAdmin used here:
redirect_to root_path, alert: "Access Denied" unless can? :edit, @question

end

Expand Down
15 changes: 15 additions & 0 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController

def twitter
oauth_data = request.env["omniauth.auth"].to_hash

user = User.find_or_create_from_twitter(oauth_data)

sign_in user

#redirect_to questions_path

render json: request.env["omniauth.auth"].to_json
end

end
2 changes: 2 additions & 0 deletions app/helpers/users/omniauth_callbacks_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Users::OmniauthCallbacksHelper
end
Loading

0 comments on commit d225d0b

Please sign in to comment.