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

Tunes&Takeout, Val edition! #18

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
32cc186
Got basic setup of project... unsure of how to do Users just yet, so …
digivava May 16, 2016
e6518e9
started Restaurant api wrappy model class thing
digivava May 17, 2016
f8a4172
Started beginning of wrapper for spotify item
digivava May 17, 2016
8a8afdb
set up basic barebones HTML structure for front page
digivava May 17, 2016
7d17487
TunestakeoutWrapper now has ability to find a suggestion pairing from…
digivava May 17, 2016
f2d2ac0
Suggestions index now has searchbar which reloads the same page with …
digivava May 17, 2016
e8999b2
Suggestions index now can connect to the spotify item name.
digivava May 18, 2016
6c3ce61
Set up test_helper and gemfile for use of VCR
digivava May 18, 2016
7738de2
Wrote unit tests for TunesTakeoutWrapper class using VCR. At first I …
digivava May 18, 2016
0c248e2
Added simplecov capabilities
digivava May 18, 2016
7c41d97
Removed playlist requirements code, and updated spotify_item wrapper …
digivava May 18, 2016
05aa4a9
Rearranged components on index page so they make more sense semantica…
digivava May 18, 2016
411272a
Set up tests for spotify items
digivava May 18, 2016
31820b8
Added some more super basic tests for spotify_item_test
digivava May 19, 2016
a2665ab
Set up omniauth for spotify
digivava May 19, 2016
abda1a5
Setting up auth_hash, changed uid column to accept integers instead o…
digivava May 19, 2016
be208f8
Actually the last migration didn't work, fixed it
digivava May 19, 2016
0bd311f
Session controller now has a create method, not sure if working until…
digivava May 19, 2016
bfd5fab
Adjusted greeting box at top of page so that it should respond to log…
digivava May 19, 2016
6063523
Added logout_path and gave sessions#create the name login_path
digivava May 19, 2016
4525d51
Added flash notices for when authentication goes wrong, and added des…
digivava May 19, 2016
0d13701
Added find_or_create_from_omniauth class, largely copypaste from kari…
digivava May 19, 2016
a5ebd1b
Switched column uid back to string type in case that's the problem
digivava May 19, 2016
eb47ae4
Fixed the uid id jumbley madness and created current_user helper meth…
digivava May 19, 2016
b4fd898
The suggestion is now a partial
digivava May 19, 2016
e556223
Schema for user now contains image and profile, so that logged in use…
digivava May 19, 2016
689c6b9
user name and image now links to profile
digivava May 19, 2016
4a471ae
Only logged in users can see searchbar now
digivava May 19, 2016
1a3c33f
Set up yelp wrapper
digivava May 20, 2016
3f06486
Phone number of restaurant now looks like a phone number instead of a…
digivava May 20, 2016
d5738fc
Address formatted with newlines
digivava May 20, 2016
5b1f5af
music suggestion now links to relevant spotify page, I didn't notice …
digivava May 20, 2016
96df446
Index page now shows top 20 suggestions and did some refactoring
digivava May 20, 2016
fdfd510
the tunestakeoutwrapper search now uses the sample method on the sugg…
digivava May 20, 2016
f061b91
Added divs surrounding the different sections of the index, and adjus…
digivava May 20, 2016
a05b34a
Added link for Favorites page to top of every page
digivava May 21, 2016
9e56eb5
Made suggestions routes on routes.rb more clear
digivava May 21, 2016
498a916
suggestions partial now has a fave option
digivava May 21, 2016
e558fb0
FOR THE LOVE OF GOD FINALLY. Clicking fave on a suggestion now change…
digivava May 22, 2016
65fded5
I WANT TO KISS SOMETHING. User favorites page works now. Still a litt…
digivava May 22, 2016
f064394
Made it so favoriting-related items are only visible for logged-in us…
digivava May 22, 2016
d7afb7c
Unfave link now works, yay
digivava May 23, 2016
5129046
Added spotify logo above greeting box for more clarity as to who is b…
digivava May 23, 2016
b1b9fda
Added custom validation methods
digivava May 23, 2016
8927875
Added link back to index at top of page for logged-in users
digivava May 23, 2016
010250b
Oops, forgot the equal sign
digivava May 23, 2016
d2df956
Added some tests for user model
digivava 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.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore planning files
/plan_for_displaying_top_20_faves.md

# Ignore bundler config.
/.bundle

Expand All @@ -26,7 +29,7 @@
/tmp/

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

## Specific to RubyMotion:
.dat*
Expand Down
19 changes: 18 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'yelp', require: 'yelp'
gem 'rspotify'

gem 'omniauth-oauth2', '1.3.1'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
Expand All @@ -24,6 +29,8 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

gem 'httparty'

# Use Unicorn as the app server
# gem 'unicorn'

Expand All @@ -33,13 +40,23 @@ gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'better_errors'
gem 'simplecov'
gem 'pry-rails'
gem 'minitest-vcr'
gem 'minitest-reporters'
gem 'webmock'
gem 'dotenv-rails'
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

group :production do
gem 'rails_12factor'
end
104 changes: 101 additions & 3 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,53 @@ 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)
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.0)
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)
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 All @@ -98,6 +155,11 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
Expand All @@ -106,6 +168,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 +185,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 +206,50 @@ GEM
thread_safe (~> 0.1)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
vcr (3.0.1)
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.2)
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
byebug
coffee-rails (~> 4.1.0)
dotenv-rails
httparty
jbuilder (~> 2.0)
jquery-rails
minitest-reporters
minitest-vcr
omniauth-oauth2 (= 1.3.1)
pg (~> 0.15)
pry-rails
rails (= 4.2.6)
rails_12factor
rspotify
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
simplecov
uglifier (>= 1.3.0)
web-console (~> 2.0)
webmock
yelp

RUBY VERSION
ruby 2.3.1p112

BUNDLED WITH
1.12.3
1.12.4
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/assets/.DS_Store
Binary file not shown.
Binary file added app/assets/images/.DS_Store
Binary file not shown.
Binary file added app/assets/images/defaultspotifylogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/fullspotifylogo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/no_picture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/upload-empty.png
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/
3 changes: 3 additions & 0 deletions app/assets/javascripts/suggestions.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/
74 changes: 74 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,77 @@
/*** GLOBAL ***/

html {
font-size: 16px;
}

img.spotify-logo {
width: 10%;
float: right;
}

.greeting {
border: 0.25rem solid black;
width: 10%;
display: flex;
float: right;
clear: right;
margin: 0 1rem;
}

.greeting img {
height: 5rem;
width: 5rem;
justify-content: flex-end;
}

.search {
margin: 2rem;
padding: 1rem;
border: 0.25rem solid black;
clear: right;
width: 30%;
display: inline-block;
float: left;
}

.top-suggestions{
margin: 2rem;
padding: 1rem;
border: 0.25rem solid black;
clear: right;
width: 60%;
display: inline-block;
float: left;
}

footer {
text-align: center;
clear: both;
}

/*** INDEX ***/

.pairing img {
display: block;
height: 10rem;
width: 10rem;
}

/*** SUGGESTIONS ***/
.pairing {
display: block;
clear: both;
}

.restaurant, .music {
display: inline-block;
float: left;
margin: 3rem;
}




/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/sessions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the sessions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/suggestions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the suggestions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ 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
helper_method :current_user

def current_user
@user ||= User.find_by(id: session[:user_id])
end
end
25 changes: 25 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class SessionsController < ApplicationController

def new

end
Copy link

@dezshino dezshino May 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty controller methods like this can be re-written in one line like: def new; end


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job adding an error handling case

end
end

def destroy
session.delete(:user_id)
@user = nil
redirect_to root_path
end

end
Loading