Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submission #7

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5363b9f
installed api gems for yelp and spotify. created models for user, foo…
annamm77 May 16, 2016
e22d07b
burned down all the models
annamm77 May 16, 2016
9668baf
music model in progress, still need to filter by music type
annamm77 May 16, 2016
7cea6a4
session and suggestions controllers created. added notes for spotifyi…
annamm77 May 17, 2016
88c9b13
TunesTakeoutWrapper created, might be working
annamm77 May 17, 2016
6e1691c
TunesTakeoutWrapper returns instance of suggestion with readable attr…
annamm77 May 17, 2016
6836c3d
root path view displays
annamm77 May 17, 2016
9019e34
trying to get the tunestakeout wrapper to display on suggestions#inde…
annamm77 May 17, 2016
41a9dbf
search term will produce music item on index yaaaay
annamm77 May 18, 2016
a3268ae
can access yelp client with secret keys
annamm77 May 18, 2016
cc410d1
it seems to display the food and music item when searched
annamm77 May 18, 2016
1e155ea
added better_errors and fixed spotify music_id bug
annamm77 May 19, 2016
ad552f9
added gems
annamm77 May 19, 2016
4331e9c
views now link with application layout
annamm77 May 19, 2016
15f11d2
general CSS and _suggestion partial styling
annamm77 May 19, 2016
5defe44
battling with spotifyitem @imageurl if no images are present... not s…
annamm77 May 19, 2016
53429c1
top 20 displays omg yus
annamm77 May 19, 2016
b06081a
top 20 and seach functional, bug with artist and album pics persists
annamm77 May 19, 2016
2a93ca3
minor formatting on suggestions#index, spacing
annamm77 May 19, 2016
6881533
log in link goes to correct page and path. sessions controller and vi…
annamm77 May 19, 2016
625adea
added omniauth initilizer, need to link keys
annamm77 May 19, 2016
d1758f2
gems installed
annamm77 May 19, 2016
532a810
added .env secret keys to omniauth initalizer
annamm77 May 19, 2016
30c94ee
log in with spotify takes you to spotify auth page
annamm77 May 19, 2016
c8399e3
you can log in? maybe. still need to check callback
annamm77 May 19, 2016
98e2c4b
index displays user name when logged in. Need to figure out how to lo…
annamm77 May 19, 2016
4864998
you can log in and out using spotify omggg
annamm77 May 20, 2016
d39d24b
added json gem, working on wrapper favorite post request
annamm77 May 20, 2016
44c884d
favorite will pick up user_id and suggestion_id
annamm77 May 20, 2016
9d0676b
favoriting feature works, will redirect to index with error message i…
annamm77 May 20, 2016
678aebf
delted sign in page view, made it just one link on index
annamm77 May 20, 2016
2b3614f
error message displays and then goes away when refreshed or new request
annamm77 May 20, 2016
ff4ee28
my favorites link on index. session log in does not persists oopsises
annamm77 May 20, 2016
d829542
nvm it was just a view variable problem. the log in does persist
annamm77 May 20, 2016
ab9a56c
bug with favoriting, it now passes the uid instead of the id. working…
annamm77 May 20, 2016
56ecb5d
will display user's favorites... yay yay yay
annamm77 May 20, 2016
3721d47
added unfavorite link and path
annamm77 May 20, 2016
774dc48
moved error message to applicaiton layout
annamm77 May 20, 2016
225062a
unfavorting redirects to favorites index
annamm77 May 20, 2016
79250ae
search and top 20 nav link for users
annamm77 May 20, 2016
493bc8b
guest cannot favorite or use search bar
annamm77 May 20, 2016
a979d40
username now links to spotify profile
annamm77 May 20, 2016
bc3ba7b
user now has img column and stores img data from oauth
annamm77 May 20, 2016
3c69017
spotify profile pic shows up
annamm77 May 20, 2016
4a764d2
greeting tweak
annamm77 May 20, 2016
86a8f25
error message when search doesnt produce results
annamm77 May 21, 2016
7de8c08
guest view displays greeting and default logo
annamm77 May 21, 2016
8ffbb8e
user favorites are now stored in session[:favorites]
annamm77 May 22, 2016
53dc338
shows unfavorite or favorite link depending on users current favorite…
annamm77 May 22, 2016
2c39e95
moved sessions[:favorites] declaration from session initlizer to appl…
annamm77 May 22, 2016
8bcfcb8
user model validation for spotify provider
annamm77 May 22, 2016
1613f22
images for artist and album now work, placeholder img for missing imgs
annamm77 May 22, 2016
f6476e2
added font awesome
annamm77 May 22, 2016
de3ab83
CSS styling
annamm77 May 22, 2016
7113f61
css styling suggestio partial background
annamm77 May 22, 2016
6a25819
installed testing gems
annamm77 May 22, 2016
96e777d
simplecov is working
annamm77 May 22, 2016
781c6d4
gems for vcr
annamm77 May 23, 2016
59a1c9f
updated test_helper, trying to configure vcr
annamm77 May 23, 2016
29b4b08
more gems. all the gems. for testing
annamm77 May 23, 2016
9de18f3
added omniauth to test_helper
annamm77 May 23, 2016
67fb9a5
added known_user fixture
annamm77 May 23, 2016
c0a899a
burned down test_helper and rebuilt anew
annamm77 May 23, 2016
0d74d4a
not sure what is up with vcr and my wrapper tests.. it doesn't seem t…
annamm77 May 23, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/tmp/

# Used by dotenv library to load environment variables.
# .env
.env

## Specific to RubyMotion:
.dat*
Expand Down
22 changes: 20 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'json'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

Expand All @@ -29,17 +30,34 @@ gem 'sdoc', '~> 0.4.0', group: :doc

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'rspotify'
gem 'yelp', require: 'yelp'
gem 'httparty'
gem 'omniauth-spotify'
gem 'omniauth'
gem 'omniauth-oauth2', '~> 1.3.1'


group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'dotenv-rails'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry-rails'
gem 'minitest-vcr'
gem 'minitest-reporters'
gem "minispec-metadata"
gem 'webmock'
gem 'simplecov', require: false
gem 'vcr'
end


group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
# gem 'spring'
end

108 changes: 104 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
ansi (1.5.0)
arel (6.0.3)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.2)
byebug (8.2.5)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
Expand All @@ -49,11 +56,27 @@ GEM
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
debug_inspector (0.0.2)
docile (1.1.5)
dotenv (2.1.1)
dotenv-rails (2.1.1)
dotenv (= 2.1.1)
railties (>= 4.0, < 5.1)
erubis (2.7.0)
execjs (2.6.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.10.0)
faraday (>= 0.7.4, < 0.10)
globalid (0.3.6)
activesupport (>= 4.1.0)
hashdiff (0.3.0)
hashie (3.4.4)
httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.7.0)
jbuilder (2.4.1)
activesupport (>= 3.0.0, < 5.1)
Expand All @@ -63,19 +86,55 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
jwt (1.5.1)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.0)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0221)
mini_portile2 (2.0.0)
minispec-metadata (2.0.0)
minitest
minitest (5.8.4)
multi_json (1.12.0)
minitest-reporters (1.1.9)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
minitest-vcr (1.4.0)
minispec-metadata (~> 2.0)
minitest (>= 4.7.5)
vcr (>= 2.9)
multi_json (1.12.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
netrc (0.7.9)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
oauth2 (1.1.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0, < 1.5.2)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.3.1)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
omniauth-oauth2 (1.3.1)
oauth2 (~> 1.0)
omniauth (~> 1.2)
omniauth-spotify (0.0.9)
omniauth-oauth2 (~> 1.1)
pg (0.18.4)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.4)
pry (>= 0.9.10)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -106,6 +165,13 @@ GEM
rake (11.1.2)
rdoc (4.2.2)
json (~> 1.4)
rest_client (1.8.3)
netrc (~> 0.7.7)
rspotify (1.10.0)
omniauth-oauth2 (~> 1.1)
rest_client (~> 1.8)
ruby-progressbar (1.8.1)
safe_yaml (1.0.4)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
Expand All @@ -116,7 +182,13 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
spring (1.7.1)
simple_oauth (0.3.1)
simplecov (0.11.2)
docile (~> 1.1.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
sprockets (3.6.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -131,27 +203,55 @@ GEM
thread_safe (~> 0.1)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
vcr (3.0.3)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (2.0.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
yelp (2.1.2)
faraday (~> 0.8, >= 0.8.0)
faraday_middleware (~> 0.8, >= 0.8.0)
simple_oauth (~> 0.3.1)

PLATFORMS
ruby

DEPENDENCIES
better_errors
binding_of_caller
byebug
coffee-rails (~> 4.1.0)
dotenv-rails
httparty
jbuilder (~> 2.0)
jquery-rails
json
minispec-metadata
minitest-reporters
minitest-vcr
omniauth
omniauth-oauth2 (~> 1.3.1)
omniauth-spotify
pg (~> 0.15)
pry-rails
rails (= 4.2.6)
rspotify
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
simplecov
uglifier (>= 1.3.0)
vcr
web-console (~> 2.0)
webmock
yelp

RUBY VERSION
ruby 2.3.1p112

BUNDLED WITH
1.12.3
1.12.4
Binary file added app/assets/images/spotify_logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/javascripts/sessions.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/
105 changes: 91 additions & 14 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,92 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
General Formatting
*/
body {
background-color: #000066;
color: white;
font-family: 'Source Sans Pro', sans-serif;
}

h1, h2 {
font-family: 'Comfortaa', cursive;
}

h1 {
font-size: 4rem;
margin-bottom: 2rem;
}

a {
color: #EBD600;
text-decoration: underline;
}

/*
Header Formatting
*/
#greeting {
text-align: right;
}

#navlinks {
text-align: center;
background-color: #000084;
}

#navlink {
padding: 6rem;
font-size: 1.25rem;
}

/*
Yield Formatting
*/
article {
text-align: center;
}

/*
suggestion partial
*/
#suggestion-wrapper {
border: .25rem solid white;
background-color: #000045;
width: 50%;
overflow: hidden;
margin-bottom: 1.5rem;
margin-left: auto;
margin-right: auto;
}

#food-suggestion {
text-align: center;
width: 49%;
float: left;
}

#music-suggestion {
text-align: center;
width: 49%;
float: left;
}

#favorite {
text-align: center;
width: 100%;
float: left;
}

img.suggestion {
padding-top: 1rem;
padding-bottom: .5rem;
}

/*
error message
*/
#message {
text-align: center;
background-color: #BD6C00;
font-size: 1.5rem;
margin-top: .75rem;
}
15 changes: 13 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
require 'TunesTakeoutWrapper'

class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

before_filter :find_favorites
before_action :find_favorites

def find_favorites
if session[:user_id].present?
@user = User.find(session[:user_id])
session[:favorites] = TunesTakeoutWrapper.check_for_favorites(@user.uid)
end
end

end
24 changes: 24 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class SessionsController < ApplicationController


def create
auth_hash = request.env['omniauth.auth']
if auth_hash["uid"]
@user = User.find_or_create_from_omniauth(auth_hash)
if @user
session[:user_id] = @user.id
redirect_to root_path
else
redirect_to root_path, session[:message] = "Failed to save the user"
end
else
redirect_to root_path, session[:message] = "Failed to authenticate"
end
end

def destroy
session.delete(:user_id)
redirect_to root_path
end

end
Loading