From 246dab6a226d14d7b2c8e798f76340c8ff74434b Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 15:37:55 -0700 Subject: [PATCH 01/46] Gems and ignoring secrets.yml --- .gitignore | 3 +++ Gemfile | 4 ++++ Gemfile.lock | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 03f3ce7..bcf855f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ # Ignore bundler config. /.bundle +# ignore secrets.yml +./config/secrets.yml + # Ignore all logfiles and tempfiles. /log/* !/log/.keep diff --git a/Gemfile b/Gemfile index 288bb87..443e729 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,9 @@ gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby +gem 'rspotify' +gem 'yelp' +gem 'httparty' # Use jquery as the JavaScript library gem 'jquery-rails' @@ -33,6 +36,7 @@ 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 'pry' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 6ff0f39..dc6c4fd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,6 +41,7 @@ GEM 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) @@ -52,8 +53,16 @@ GEM debug_inspector (0.0.2) 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) + 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) @@ -63,19 +72,40 @@ 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) minitest (5.8.4) 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.4.0) + 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) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -106,6 +136,11 @@ 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) sass (3.4.22) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) @@ -116,6 +151,8 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + simple_oauth (0.3.1) + slop (3.6.0) spring (1.7.1) sprockets (3.6.0) concurrent-ruby (~> 1.0) @@ -136,6 +173,10 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) + yelp (2.1.2) + faraday (~> 0.8, >= 0.8.0) + faraday_middleware (~> 0.8, >= 0.8.0) + simple_oauth (~> 0.3.1) PLATFORMS ruby @@ -143,15 +184,22 @@ PLATFORMS DEPENDENCIES byebug coffee-rails (~> 4.1.0) + httparty jbuilder (~> 2.0) jquery-rails pg (~> 0.15) + pry rails (= 4.2.6) + rspotify sass-rails (~> 5.0) sdoc (~> 0.4.0) spring uglifier (>= 1.3.0) web-console (~> 2.0) + yelp + +RUBY VERSION + ruby 2.3.1p112 BUNDLED WITH - 1.12.3 + 1.12.4 From b0cfb01ce5130f38212b2fd85fda24e80da22068 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 15:42:01 -0700 Subject: [PATCH 02/46] testing out to make sure secrets.yml is for reals not getting pushed to github because paranoia --- app/assets/javascripts/sessions.coffee | 3 +++ app/assets/javascripts/suggestions.coffee | 3 +++ app/assets/stylesheets/sessions.scss | 3 +++ app/assets/stylesheets/suggestions.scss | 3 +++ app/controllers/sessions_controller.rb | 2 ++ app/controllers/suggestions_controller.rb | 2 ++ app/helpers/sessions_helper.rb | 2 ++ app/helpers/suggestions_helper.rb | 2 ++ config/initializers/omniauth.rb | 0 test/controllers/sessions_controller_test.rb | 7 +++++++ test/controllers/suggestions_controller_test.rb | 7 +++++++ 11 files changed, 34 insertions(+) create mode 100644 app/assets/javascripts/sessions.coffee create mode 100644 app/assets/javascripts/suggestions.coffee create mode 100644 app/assets/stylesheets/sessions.scss create mode 100644 app/assets/stylesheets/suggestions.scss create mode 100644 app/controllers/sessions_controller.rb create mode 100644 app/controllers/suggestions_controller.rb create mode 100644 app/helpers/sessions_helper.rb create mode 100644 app/helpers/suggestions_helper.rb create mode 100644 config/initializers/omniauth.rb create mode 100644 test/controllers/sessions_controller_test.rb create mode 100644 test/controllers/suggestions_controller_test.rb diff --git a/app/assets/javascripts/sessions.coffee b/app/assets/javascripts/sessions.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/sessions.coffee @@ -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/ diff --git a/app/assets/javascripts/suggestions.coffee b/app/assets/javascripts/suggestions.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/suggestions.coffee @@ -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/ diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss new file mode 100644 index 0000000..7bef9cf --- /dev/null +++ b/app/assets/stylesheets/sessions.scss @@ -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/ diff --git a/app/assets/stylesheets/suggestions.scss b/app/assets/stylesheets/suggestions.scss new file mode 100644 index 0000000..c0d3b8d --- /dev/null +++ b/app/assets/stylesheets/suggestions.scss @@ -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/ diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..16d11b5 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,2 @@ +class SessionsController < ApplicationController +end diff --git a/app/controllers/suggestions_controller.rb b/app/controllers/suggestions_controller.rb new file mode 100644 index 0000000..d5b0599 --- /dev/null +++ b/app/controllers/suggestions_controller.rb @@ -0,0 +1,2 @@ +class SuggestionsController < ApplicationController +end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb new file mode 100644 index 0000000..309f8b2 --- /dev/null +++ b/app/helpers/sessions_helper.rb @@ -0,0 +1,2 @@ +module SessionsHelper +end diff --git a/app/helpers/suggestions_helper.rb b/app/helpers/suggestions_helper.rb new file mode 100644 index 0000000..0e358dd --- /dev/null +++ b/app/helpers/suggestions_helper.rb @@ -0,0 +1,2 @@ +module SuggestionsHelper +end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb new file mode 100644 index 0000000..e69de29 diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb new file mode 100644 index 0000000..d30ebc3 --- /dev/null +++ b/test/controllers/sessions_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SessionsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/suggestions_controller_test.rb b/test/controllers/suggestions_controller_test.rb new file mode 100644 index 0000000..f4587a5 --- /dev/null +++ b/test/controllers/suggestions_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SuggestionsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From 13756ceca296737f92ed94b180d4ff0ca0dea9ff Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 16:16:50 -0700 Subject: [PATCH 03/46] Delete secrets.yml --- config/secrets.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 config/secrets.yml diff --git a/config/secrets.yml b/config/secrets.yml deleted file mode 100644 index be83593..0000000 --- a/config/secrets.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key is used for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! - -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -# You can use `rake secret` to generate a secure secret key. - -# Make sure the secrets in this file are kept private -# if you're sharing your code publicly. - -development: - secret_key_base: 553149b03d6ba63414be540733245f323d241c1c9a37f3266d1216d93effd901fefb43f0782e4d2b739d61a3de1488c681a90435b22318114f638d9fc6e0f8c1 - -test: - secret_key_base: 0c9e2ff02abb06b715fccfbd8a7fb390a12595cf1c4d8b58cae707903a17a4a58ea0762f4a2125da40cf59b211620b81e702e13d58c4a50e4591f48dcbf1cbaa - -# Do not keep production secrets in the repository, -# instead read values from the environment. -production: - secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From 1aba372a3a1ac3b50257fa663877da869cbd0980 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 16:29:27 -0700 Subject: [PATCH 04/46] doof --- config/secrets.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 config/secrets.yml diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..d2c55fe --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,20 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: db7e6840cccde3debf77d5f3248bb203374da39baca1a887d4dbed47db740a3f860f9b3dce0069d28890962eaa3d64a2e412bede772dd20dc5a519acd405d38a +test: + secret_key_base: b060a8937c44c51655498ac8d5434c9e8421e73fdbf5e39981a0faaf2a0b42a5199607e6fe7adf1deeeb7ebdb5f6db9a61a9bd6ebfdf2e7591b44a2ee0538e15 +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From ebf8711c862b880aa2069d798d5a0fbbae05bec7 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 16:31:27 -0700 Subject: [PATCH 05/46] Too many secrets --- .gitignore | 2 +- config/secrets.yml | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 config/secrets.yml diff --git a/.gitignore b/.gitignore index bcf855f..46bc326 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ /.bundle # ignore secrets.yml -./config/secrets.yml +/config/secrets.yml # Ignore all logfiles and tempfiles. /log/* diff --git a/config/secrets.yml b/config/secrets.yml deleted file mode 100644 index d2c55fe..0000000 --- a/config/secrets.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key is used for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! - -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -# You can use `rake secret` to generate a secure secret key. - -# Make sure the secrets in this file are kept private -# if you're sharing your code publicly. - -development: - secret_key_base: db7e6840cccde3debf77d5f3248bb203374da39baca1a887d4dbed47db740a3f860f9b3dce0069d28890962eaa3d64a2e412bede772dd20dc5a519acd405d38a -test: - secret_key_base: b060a8937c44c51655498ac8d5434c9e8421e73fdbf5e39981a0faaf2a0b42a5199607e6fe7adf1deeeb7ebdb5f6db9a61a9bd6ebfdf2e7591b44a2ee0538e15 -# Do not keep production secrets in the repository, -# instead read values from the environment. -production: - secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From 195e550662a2429db77e1b583219301b0c9855da Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 16:50:53 -0700 Subject: [PATCH 06/46] Working with Charles, yay --- .gitignore | 6 +++--- Gemfile | 1 + Gemfile.lock | 5 +++++ config/secrets.yml | 20 ++++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 config/secrets.yml diff --git a/.gitignore b/.gitignore index 46bc326..5ba19c7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,8 @@ # Ignore bundler config. /.bundle -# ignore secrets.yml -/config/secrets.yml + + # Ignore all logfiles and tempfiles. /log/* @@ -29,7 +29,7 @@ /tmp/ # Used by dotenv library to load environment variables. -# .env + .env ## Specific to RubyMotion: .dat* diff --git a/Gemfile b/Gemfile index 443e729..fc77dca 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,7 @@ group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' gem 'pry' + gem 'dotenv-rails' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index dc6c4fd..e41d563 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,6 +51,10 @@ GEM coffee-script-source (1.10.0) concurrent-ruby (1.0.2) debug_inspector (0.0.2) + 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) @@ -184,6 +188,7 @@ PLATFORMS DEPENDENCIES byebug coffee-rails (~> 4.1.0) + dotenv-rails httparty jbuilder (~> 2.0) jquery-rails diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..d2c55fe --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,20 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: db7e6840cccde3debf77d5f3248bb203374da39baca1a887d4dbed47db740a3f860f9b3dce0069d28890962eaa3d64a2e412bede772dd20dc5a519acd405d38a +test: + secret_key_base: b060a8937c44c51655498ac8d5434c9e8421e73fdbf5e39981a0faaf2a0b42a5199607e6fe7adf1deeeb7ebdb5f6db9a61a9bd6ebfdf2e7591b44a2ee0538e15 +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From 428f25d237fc7e203b82a2e88a76827cf6d4b00c Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Mon, 16 May 2016 16:52:18 -0700 Subject: [PATCH 07/46] modified gitignore file --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5ba19c7..30e1656 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ /tmp/ # Used by dotenv library to load environment variables. - .env +.env ## Specific to RubyMotion: .dat* From 99a85118f0038058cb293955d5bd51e64b819f99 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Tue, 17 May 2016 08:59:23 -0700 Subject: [PATCH 08/46] Completed the env and oauth pieces --- config/application.rb | 1 + config/initializers/omniauth.rb | 5 +++++ config/initializers/yelp.rb | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 config/initializers/yelp.rb diff --git a/config/application.rb b/config/application.rb index 9b37a86..6d5260b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,7 @@ module TunesTakeout class Application < Rails::Application + RSpotify::authenticate(ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"]) # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index e69de29..543b7a0 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -0,0 +1,5 @@ +require 'rspotify/oauth' + +Rails.application.config.middleware.use OmniAuth::Builder do + provider :spotify, "", "", scope: 'user-read-email playlist-modify-public user-library-read user-library-modify' +end \ No newline at end of file diff --git a/config/initializers/yelp.rb b/config/initializers/yelp.rb new file mode 100644 index 0000000..5173cac --- /dev/null +++ b/config/initializers/yelp.rb @@ -0,0 +1,8 @@ +require 'yelp' + +Yelp.client.configure do |config| + config.consumer_key = YELP_CONSUMER_KEY + config.consumer_secret = YELP_CONSUMER_SECRET + config.token = YELP_TOKEN + config.token_secret = YELP_TOKEN_SECRET +end From 90354a8d2eb001d6a070cfc85435444421d9722a Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Tue, 17 May 2016 11:32:42 -0700 Subject: [PATCH 09/46] Generated models and made a root route for the site. --- Gemfile | 2 +- Gemfile.lock | 4 ++- app/controllers/suggestions_controller.rb | 3 ++ app/models/food.rb | 2 ++ app/models/music.rb | 2 ++ app/models/user.rb | 3 ++ app/views/suggestions/index.html.erb | 1 + config/application.rb | 1 - config/initializers/omniauth.rb | 2 +- config/initializers/spotify.rb | 3 ++ config/initializers/yelp.rb | 8 ++--- config/routes.rb | 3 ++ db/migrate/20160517173932_create_users.rb | 8 +++++ db/migrate/20160517180300_create_foods.rb | 8 +++++ db/migrate/20160517180306_create_musics.rb | 8 +++++ db/schema.rb | 34 ++++++++++++++++++++++ test/fixtures/foods.yml | 11 +++++++ test/fixtures/musics.yml | 11 +++++++ test/fixtures/users.yml | 11 +++++++ test/models/food_test.rb | 7 +++++ test/models/music_test.rb | 7 +++++ test/models/user_test.rb | 7 +++++ 22 files changed, 138 insertions(+), 8 deletions(-) create mode 100644 app/models/food.rb create mode 100644 app/models/music.rb create mode 100644 app/models/user.rb create mode 100644 app/views/suggestions/index.html.erb create mode 100644 config/initializers/spotify.rb create mode 100644 db/migrate/20160517173932_create_users.rb create mode 100644 db/migrate/20160517180300_create_foods.rb create mode 100644 db/migrate/20160517180306_create_musics.rb create mode 100644 db/schema.rb create mode 100644 test/fixtures/foods.yml create mode 100644 test/fixtures/musics.yml create mode 100644 test/fixtures/users.yml create mode 100644 test/models/food_test.rb create mode 100644 test/models/music_test.rb create mode 100644 test/models/user_test.rb diff --git a/Gemfile b/Gemfile index fc77dca..2ac0799 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ 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 'pry' + gem 'pry-rails' gem 'dotenv-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index e41d563..6169c05 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -110,6 +110,8 @@ GEM 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) @@ -193,7 +195,7 @@ DEPENDENCIES jbuilder (~> 2.0) jquery-rails pg (~> 0.15) - pry + pry-rails rails (= 4.2.6) rspotify sass-rails (~> 5.0) diff --git a/app/controllers/suggestions_controller.rb b/app/controllers/suggestions_controller.rb index d5b0599..496491e 100644 --- a/app/controllers/suggestions_controller.rb +++ b/app/controllers/suggestions_controller.rb @@ -1,2 +1,5 @@ class SuggestionsController < ApplicationController + + def index + end end diff --git a/app/models/food.rb b/app/models/food.rb new file mode 100644 index 0000000..3f58467 --- /dev/null +++ b/app/models/food.rb @@ -0,0 +1,2 @@ +class Food < ActiveRecord::Base +end diff --git a/app/models/music.rb b/app/models/music.rb new file mode 100644 index 0000000..427c9c2 --- /dev/null +++ b/app/models/music.rb @@ -0,0 +1,2 @@ +class Music < ActiveRecord::Base +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..50c4d3a --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,3 @@ +class User < ActiveRecord::Base + +end diff --git a/app/views/suggestions/index.html.erb b/app/views/suggestions/index.html.erb new file mode 100644 index 0000000..32a7245 --- /dev/null +++ b/app/views/suggestions/index.html.erb @@ -0,0 +1 @@ +

butts butts butts

\ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 6d5260b..9b37a86 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,7 +8,6 @@ module TunesTakeout class Application < Rails::Application - RSpotify::authenticate(ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"]) # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 543b7a0..b526b23 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,5 +1,5 @@ require 'rspotify/oauth' Rails.application.config.middleware.use OmniAuth::Builder do - provider :spotify, "", "", scope: 'user-read-email playlist-modify-public user-library-read user-library-modify' + provider :spotify, "SPOTIFY_CLIENT_ID", "SPOTIFY_CLIENT_SECRET", scope: 'user-read-email playlist-modify-public user-library-read user-library-modify' end \ No newline at end of file diff --git a/config/initializers/spotify.rb b/config/initializers/spotify.rb new file mode 100644 index 0000000..f3c5fc0 --- /dev/null +++ b/config/initializers/spotify.rb @@ -0,0 +1,3 @@ +require 'rspotify' + +RSpotify::authenticate(ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"]) \ No newline at end of file diff --git a/config/initializers/yelp.rb b/config/initializers/yelp.rb index 5173cac..e1bb5ad 100644 --- a/config/initializers/yelp.rb +++ b/config/initializers/yelp.rb @@ -1,8 +1,8 @@ require 'yelp' Yelp.client.configure do |config| - config.consumer_key = YELP_CONSUMER_KEY - config.consumer_secret = YELP_CONSUMER_SECRET - config.token = YELP_TOKEN - config.token_secret = YELP_TOKEN_SECRET + config.consumer_key = ENV["YELP_CONSUMER_KEY"] + config.consumer_secret = ENV["YELP_CONSUMER_SECRET"] + config.token = ENV["YELP_TOKEN"] + config.token_secret = ENV["YELP_TOKEN_SECRET"] end diff --git a/config/routes.rb b/config/routes.rb index 3f66539..2f99070 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,7 @@ Rails.application.routes.draw do + + root 'suggestions#index' + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/db/migrate/20160517173932_create_users.rb b/db/migrate/20160517173932_create_users.rb new file mode 100644 index 0000000..e6f0ee5 --- /dev/null +++ b/db/migrate/20160517173932_create_users.rb @@ -0,0 +1,8 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160517180300_create_foods.rb b/db/migrate/20160517180300_create_foods.rb new file mode 100644 index 0000000..5d62fcd --- /dev/null +++ b/db/migrate/20160517180300_create_foods.rb @@ -0,0 +1,8 @@ +class CreateFoods < ActiveRecord::Migration + def change + create_table :foods do |t| + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160517180306_create_musics.rb b/db/migrate/20160517180306_create_musics.rb new file mode 100644 index 0000000..2cc03f3 --- /dev/null +++ b/db/migrate/20160517180306_create_musics.rb @@ -0,0 +1,8 @@ +class CreateMusics < ActiveRecord::Migration + def change + create_table :musics do |t| + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..2966b7e --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,34 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20160517180306) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "foods", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "musics", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "users", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/test/fixtures/foods.yml b/test/fixtures/foods.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/foods.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/musics.yml b/test/fixtures/musics.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/musics.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/food_test.rb b/test/models/food_test.rb new file mode 100644 index 0000000..8ad7dff --- /dev/null +++ b/test/models/food_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class FoodTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/music_test.rb b/test/models/music_test.rb new file mode 100644 index 0000000..c5c6737 --- /dev/null +++ b/test/models/music_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MusicTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 0ce7b8709e9a4d0b9ab996c85856a02a04fed1fe Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:33:48 -0700 Subject: [PATCH 10/46] new gems, fixed issues with oauth --- Gemfile | 22 ++++++++++------------ Gemfile.lock | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 2ac0799..cb2013e 100644 --- a/Gemfile +++ b/Gemfile @@ -3,11 +3,8 @@ ruby '2.3.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.6' -# Use postgresql as the database for Active Record -gem 'pg', '~> 0.15' -# Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets +gem 'pg', '~> 0.15' gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' @@ -16,6 +13,7 @@ gem 'coffee-rails', '~> 4.1.0' gem 'rspotify' gem 'yelp' gem 'httparty' +gem 'omniauth-oauth2', '~> 1.3.1' # Use jquery as the JavaScript library gem 'jquery-rails' @@ -24,27 +22,27 @@ gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Unicorn as the app server -# gem 'unicorn' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development +gem 'turbolinks' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' gem 'pry-rails' gem 'dotenv-rails' + gem 'simplecov' end group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' + gem "better_errors" + gem "binding_of_caller" # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' + + group :production do + gem 'rails_12factor' + end end diff --git a/Gemfile.lock b/Gemfile.lock index 6169c05..4d9ecf4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,6 +37,10 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) 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) @@ -102,7 +106,7 @@ GEM omniauth (1.3.1) hashie (>= 1.2, < 4) rack (>= 1.0, < 3) - omniauth-oauth2 (1.4.0) + omniauth-oauth2 (1.3.1) oauth2 (~> 1.0) omniauth (~> 1.2) pg (0.18.4) @@ -134,6 +138,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) @@ -170,6 +179,8 @@ GEM thor (0.19.1) thread_safe (0.3.5) tilt (2.0.2) + turbolinks (2.5.3) + coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (3.0.0) @@ -188,19 +199,24 @@ PLATFORMS ruby DEPENDENCIES + better_errors + binding_of_caller byebug coffee-rails (~> 4.1.0) dotenv-rails httparty jbuilder (~> 2.0) jquery-rails + 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 + turbolinks uglifier (>= 1.3.0) web-console (~> 2.0) yelp From 0aae5b03ccd464e663d289aa3772bf957ac267fd Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:34:34 -0700 Subject: [PATCH 11/46] added controllers and login functionality --- app/controllers/application_controller.rb | 15 +++++++++++++++ app/controllers/sessions_controller.rb | 1 + app/controllers/suggestions_controller.rb | 7 +++++++ app/controllers/users_controller.rb | 23 +++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 app/controllers/users_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e..4d442e5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,19 @@ 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 + + # before_action :require_login + + def current_user + @user ||= User.find_by(id: session[:user_id]) + end + + def require_login + if current_user.nil? + flash[:error] = "You must be logged in to view this section" + redirect_to root_path + end + end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 16d11b5..b0435f5 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,2 +1,3 @@ class SessionsController < ApplicationController + end diff --git a/app/controllers/suggestions_controller.rb b/app/controllers/suggestions_controller.rb index 496491e..f53b5de 100644 --- a/app/controllers/suggestions_controller.rb +++ b/app/controllers/suggestions_controller.rb @@ -1,5 +1,12 @@ class SuggestionsController < ApplicationController + skip_before_action :require_login, only: :index def index + + end + + def new + @suggestions = Food.new end + end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..caa49c3 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,23 @@ +class UsersController < ApplicationController + def create + auth_hash = request.env['omniauth.auth'] + + if auth_hash["info"]["id"] + @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, notice: "Failed to save the user" + end + else + redirect_to root_path, notice: "Failed to authenticate" + end + end + + + def destroy + session.delete :user_id + redirect_to root_path + end +end From 56d8b347e205695a3ca81a33f2c301154c079775 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:35:22 -0700 Subject: [PATCH 12/46] added music and user models --- app/models/music.rb | 7 +++++++ app/models/user.rb | 25 ++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/models/music.rb b/app/models/music.rb index 427c9c2..3395bad 100644 --- a/app/models/music.rb +++ b/app/models/music.rb @@ -1,2 +1,9 @@ +require_relative '../../lib/TunesTakeoutWrapper.rb' + class Music < ActiveRecord::Base + def results + + end + end + diff --git a/app/models/user.rb b/app/models/user.rb index 50c4d3a..5f7246c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,26 @@ +# require-relative '../../lib/TunesTakeoutWrapper.rb' + class User < ActiveRecord::Base - + validates :display_name, :uid, :provider, presence: true + + def self.find_or_create_from_omniauth(auth_hash) + # Find or create a user + user = self.find_by(id: auth_hash["info"]["id"], provider: auth_hash["provider"]) + + if !user.nil? + return user + else + user = User.new + user.uid = auth_hash["info"]["id"] + user.display_name = auth_hash["info"]["display_name"] + user.email = auth_hash["info"]["email"] + user.provider = auth_hash["provider"] + + if user.save + return user + else + return nil + end + end + end end From 6493aac1bfc5a67666e971bbef188d28181ba2d1 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:35:53 -0700 Subject: [PATCH 13/46] added tunes and takeout wrapper to lib --- lib/tunes_takeout_wrapper.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/tunes_takeout_wrapper.rb diff --git a/lib/tunes_takeout_wrapper.rb b/lib/tunes_takeout_wrapper.rb new file mode 100644 index 0000000..2ec0a2c --- /dev/null +++ b/lib/tunes_takeout_wrapper.rb @@ -0,0 +1,18 @@ +require 'httparty' + +module TunesTakeoutWrapper + BASE_URL = "https://tunes-takeout-api.herokuapp.com/v1/" + + def initialize(data) + @id = data["id"] + @food_id = data["food_id"] + @music_id = data["music_id"] + @music_type = data["music_type"] + end + + # limit, seed as params? + def self.find(suggestion) + data = HTTParty.get(BASE_URL + "suggestions/search?#{suggestion}").parsed_response + self.new(data) + end +end \ No newline at end of file From 3c09ccdbde11c50b563b4b8a7d3c912bf8281cb8 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:36:14 -0700 Subject: [PATCH 14/46] added views to application --- app/views/layouts/application.html.erb | 19 +++++++++++++++---- app/views/sessions/index.html.erb | 0 app/views/sessions/new.html.erb | 0 app/views/suggestions/index.html.erb | 3 ++- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 app/views/sessions/index.html.erb create mode 100644 app/views/sessions/new.html.erb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 509d1a2..3f0dde2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,25 @@ - TunesTakeout - <%= stylesheet_link_tag 'application', media: 'all' %> - <%= javascript_include_tag 'application' %> + Tunes and Takeout + + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> -<%= yield %> +
+ <%= "Hi #{ current_user.display_name }!" if current_user %> + + <%= yield %> +
diff --git a/app/views/sessions/index.html.erb b/app/views/sessions/index.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/suggestions/index.html.erb b/app/views/suggestions/index.html.erb index 32a7245..543b907 100644 --- a/app/views/suggestions/index.html.erb +++ b/app/views/suggestions/index.html.erb @@ -1 +1,2 @@ -

butts butts butts

\ No newline at end of file +

Here's a list of suggestions

+ From 6be7bde083d67dbcefca4aa85ac2dfdf1fc66673 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:36:56 -0700 Subject: [PATCH 15/46] added configuration for omniauth as well as routing to log into spotify --- config/application.rb | 1 + config/initializers/omniauth.rb | 2 +- config/routes.rb | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index 9b37a86..5316b1a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,7 @@ module TunesTakeout class Application < Rails::Application + # RSpotify::authenticate(ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"]) # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index b526b23..1232b3c 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,5 +1,5 @@ require 'rspotify/oauth' Rails.application.config.middleware.use OmniAuth::Builder do - provider :spotify, "SPOTIFY_CLIENT_ID", "SPOTIFY_CLIENT_SECRET", scope: 'user-read-email playlist-modify-public user-library-read user-library-modify' + provider :spotify, ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"], scope: 'user-read-email playlist-modify-public user-library-read user-library-modify' end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2f99070..0eab4c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,10 @@ Rails.application.routes.draw do root 'suggestions#index' - + get '/auth/:provider/callback' => 'users#create' + delete "/logout" => "users#destroy", as: :logout + + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From e1770220dfe87ceec0276edc738ef0579ed14cdd Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 05:37:28 -0700 Subject: [PATCH 16/46] migrations to modify the user schema --- app/assets/javascripts/users.coffee | 3 +++ app/assets/stylesheets/users.scss | 3 +++ app/helpers/users_helper.rb | 2 ++ db/migrate/20160517173932_create_users.rb | 5 +++-- ...60518000618_update_users_table_with_spotify_info.rb | 7 +++++++ .../20160518001155_adding_all_things_to_users.rb | 8 ++++++++ db/schema.rb | 10 +++++++--- test/controllers/users_controller_test.rb | 7 +++++++ 8 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 app/assets/javascripts/users.coffee create mode 100644 app/assets/stylesheets/users.scss create mode 100644 app/helpers/users_helper.rb create mode 100644 db/migrate/20160518000618_update_users_table_with_spotify_info.rb create mode 100644 db/migrate/20160518001155_adding_all_things_to_users.rb create mode 100644 test/controllers/users_controller_test.rb diff --git a/app/assets/javascripts/users.coffee b/app/assets/javascripts/users.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/users.coffee @@ -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/ diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss new file mode 100644 index 0000000..1efc835 --- /dev/null +++ b/app/assets/stylesheets/users.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the users controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/db/migrate/20160517173932_create_users.rb b/db/migrate/20160517173932_create_users.rb index e6f0ee5..ef829da 100644 --- a/db/migrate/20160517173932_create_users.rb +++ b/db/migrate/20160517173932_create_users.rb @@ -1,8 +1,9 @@ class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| - + t.string :id, null: false + t.string :display_name, null: false + t.string :email, null: false t.timestamps null: false - end end end diff --git a/db/migrate/20160518000618_update_users_table_with_spotify_info.rb b/db/migrate/20160518000618_update_users_table_with_spotify_info.rb new file mode 100644 index 0000000..daa069d --- /dev/null +++ b/db/migrate/20160518000618_update_users_table_with_spotify_info.rb @@ -0,0 +1,7 @@ +class UpdateUsersTableWithSpotifyInfo < ActiveRecord::Migration + def change + add_column :users, :id, :string, null: false + add_column :users, :display_name, :string, null: true + add_column :users, :email, :string, null: true + end +end diff --git a/db/migrate/20160518001155_adding_all_things_to_users.rb b/db/migrate/20160518001155_adding_all_things_to_users.rb new file mode 100644 index 0000000..c3d0b07 --- /dev/null +++ b/db/migrate/20160518001155_adding_all_things_to_users.rb @@ -0,0 +1,8 @@ +class AddingAllThingsToUsers < ActiveRecord::Migration + def change + add_column :users, :uid, :string, null: false + add_column :users, :display_name, :string, null: false + add_column :users, :email, :string + add_column :users, :provider, :string, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 2966b7e..8c3c8bd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160517180306) do +ActiveRecord::Schema.define(version: 20160518001155) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -27,8 +27,12 @@ end create_table "users", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "uid", null: false + t.string "display_name", null: false + t.string "email" + t.string "provider", null: false end end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 0000000..d23f182 --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From 89eb499d18a60b93dc1463cd9f564e309cae362a Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:10:24 -0700 Subject: [PATCH 17/46] Figured out how to get lib to be 'seen' by app by altering the config in application.rb --- Gemfile.lock | 7 +++++ config/application.rb | 16 ++-------- config/routes.rb | 69 ++++++------------------------------------- 3 files changed, 18 insertions(+), 74 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4d9ecf4..47ef3c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -55,6 +55,7 @@ GEM coffee-script-source (1.10.0) concurrent-ruby (1.0.2) debug_inspector (0.0.2) + docile (1.1.5) dotenv (2.1.1) dotenv-rails (2.1.1) dotenv (= 2.1.1) @@ -167,6 +168,11 @@ GEM json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) 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) spring (1.7.1) sprockets (3.6.0) @@ -215,6 +221,7 @@ DEPENDENCIES rspotify sass-rails (~> 5.0) sdoc (~> 0.4.0) + simplecov spring turbolinks uglifier (>= 1.3.0) diff --git a/config/application.rb b/config/application.rb index 5316b1a..ff18fa1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,20 +8,8 @@ module TunesTakeout class Application < Rails::Application - # RSpotify::authenticate(ENV["SPOTIFY_CLIENT_ID"], ENV["SPOTIFY_CLIENT_SECRET"]) - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true + config.autoload_paths += %W(#{config.root}/lib) + config.autoload_paths += %W(#{config.root}/extras) end end diff --git a/config/routes.rb b/config/routes.rb index 0eab4c9..a7971b9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,62 +1,11 @@ Rails.application.routes.draw do - - root 'suggestions#index' - get '/auth/:provider/callback' => 'users#create' - delete "/logout" => "users#destroy", as: :logout - - - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # You can have the root of your site routed with "root" - # root 'welcome#index' - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + root 'home#index' + get '/sign-in' => 'sessions#new', as: :signin + delete '/logout' => 'sessions#destroy', as: :logout + get '/auth/:provider/callback' => 'sessions#create' + get '/suggestions' => 'suggestions#index' + post '/suggestions' => 'suggestions#create' + get '/favorites' => 'suggestions#favorites', as: :favorites + post '/favorite' => 'suggestions#favorite' + post '/unfavorite' => 'suggestions#unfavorite' end From 0fafced23bc88fce8910373fe224402d7a094ea9 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:12:06 -0700 Subject: [PATCH 18/46] added a home controller to keep routing straight between suggestions and index. Was having routing derps and this solved it. --- app/assets/javascripts/home.coffee | 3 +++ app/assets/stylesheets/home.scss | 3 +++ app/controllers/home_controller.rb | 6 ++++++ app/helpers/home_helper.rb | 2 ++ test/controllers/home_controller_test.rb | 7 +++++++ 5 files changed, 21 insertions(+) create mode 100644 app/assets/javascripts/home.coffee create mode 100644 app/assets/stylesheets/home.scss create mode 100644 app/controllers/home_controller.rb create mode 100644 app/helpers/home_helper.rb create mode 100644 test/controllers/home_controller_test.rb diff --git a/app/assets/javascripts/home.coffee b/app/assets/javascripts/home.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/home.coffee @@ -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/ diff --git a/app/assets/stylesheets/home.scss b/app/assets/stylesheets/home.scss new file mode 100644 index 0000000..f0ddc68 --- /dev/null +++ b/app/assets/stylesheets/home.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the home controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..1212ca6 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,6 @@ +class HomeController < ApplicationController + def index + @user = current_user + end +end + diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/test/controllers/home_controller_test.rb b/test/controllers/home_controller_test.rb new file mode 100644 index 0000000..730478d --- /dev/null +++ b/test/controllers/home_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class HomeControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From d023a94689c627c89b78c00d5663a91ec4305105 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:12:52 -0700 Subject: [PATCH 19/46] Spotify and Yelp api calls now work through the tunes takeout api. --- app/models/food.rb | 27 +++++++++++++++++++++++++++ app/models/music.rb | 41 ++++++++++++++++++++++++++++++++++++----- app/models/user.rb | 8 +++++--- 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/app/models/food.rb b/app/models/food.rb index 3f58467..3f5d55d 100644 --- a/app/models/food.rb +++ b/app/models/food.rb @@ -1,2 +1,29 @@ class Food < ActiveRecord::Base + attr_reader :id, :name, :link, :phone, :address, :image, :rating + + def initialize(yelp_object) + @id = yelp_object.id + @name = yelp_object.name + @link = yelp_object.url + @image = yelp_object.image_url + @rating = { + stars: yelp_object.rating, + stars_image: yelp_object.rating_img_url + } + end + + + def self.suggested_food(tunes_takeout_suggestion) + tunes_takeout_suggestion.collect { |suggestion| + self.search(suggestion["food_id"]) + } + end + + + def self.search(food_id) + # parameterize fixes accented business names + @food = Yelp.client.business(food_id.parameterize).business + self.new(@food) + end + end diff --git a/app/models/music.rb b/app/models/music.rb index 3395bad..7dda3dd 100644 --- a/app/models/music.rb +++ b/app/models/music.rb @@ -1,9 +1,40 @@ -require_relative '../../lib/TunesTakeoutWrapper.rb' - class Music < ActiveRecord::Base - def results - - end + attr_reader :id, :name, :type, :link, :image + + def initialize(spotify_object) + @id = spotify_object.id + @name = spotify_object.name + @link = spotify_object.external_urls["spotify"] + @type = spotify_object.type + # track + # @image = spotify_object.images[0]["url"] + # album + # @image = spotify_object.album.images[0]["url"] + # artist + # @image = spotify_object.artist.images[0]["url"] + end + + + def self.suggested_music(tunes_takeout_suggestion) + tunes_takeout_suggestion.collect { |suggestion| + self.search(suggestion["music_id"], + suggestion["music_type"]) + } + end + + def self.search(music_id, music_type) + case music_type + when "artist" + @music = RSpotify::Artist.find(music_id) + when "album" + @music = RSpotify::Album.find(music_id) + when "track" + @music = RSpotify::Track.find(music_id) + else + @music = nil + end + self.new(@music) + end end diff --git a/app/models/user.rb b/app/models/user.rb index 5f7246c..53599fb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,16 +1,17 @@ -# require-relative '../../lib/TunesTakeoutWrapper.rb' +# require_relative '../../lib/tunes_takeout_wrapper.rb' class User < ActiveRecord::Base validates :display_name, :uid, :provider, presence: true def self.find_or_create_from_omniauth(auth_hash) - # Find or create a user + # Find a user user = self.find_by(id: auth_hash["info"]["id"], provider: auth_hash["provider"]) if !user.nil? return user else - user = User.new + # create a user + user = User.new user.uid = auth_hash["info"]["id"] user.display_name = auth_hash["info"]["display_name"] user.email = auth_hash["info"]["email"] @@ -23,4 +24,5 @@ def self.find_or_create_from_omniauth(auth_hash) end end end + end From f77255651fd5fd7a4b0f296bd6497848fd4f283e Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:14:28 -0700 Subject: [PATCH 20/46] added a partial to suggestions. Need to remove extra testing views (results/search). Moved login/logout to nav on application view. --- app/views/home/index.html.erb | 8 +++++ app/views/sessions/new.html.erb | 2 ++ app/views/suggestions/_suggestion.html.erb | 37 ++++++++++++++++++++++ app/views/suggestions/index.html.erb | 5 ++- app/views/suggestions/results.html.erb | 3 ++ app/views/suggestions/search.html.erb | 0 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/views/home/index.html.erb create mode 100644 app/views/suggestions/_suggestion.html.erb create mode 100644 app/views/suggestions/results.html.erb create mode 100644 app/views/suggestions/search.html.erb diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..a5a69b3 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,8 @@ +

Welcome to Tunes and Takeout!

+<% if current_user %> + <%= form_tag :suggestions, {controller: 'suggestions', action: 'create'} do |f| %> + <%= label_tag :query %> + <%= text_field_tag :query %> + <%= submit_tag("Search") %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index e69de29..97fb51d 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/app/views/suggestions/_suggestion.html.erb b/app/views/suggestions/_suggestion.html.erb new file mode 100644 index 0000000..6bf4b47 --- /dev/null +++ b/app/views/suggestions/_suggestion.html.erb @@ -0,0 +1,37 @@ +

+ Music +

+

+ Food +

+<% @music_suggestions.each do |suggestion| %> +
  • + <%= suggestion.name %> + <%= suggestion.link %> + <%= suggestion.type %> +
  • +<% end %> + +<% @food_suggestions.each do |suggestion| %> +
  • + <%= suggestion.name %> + <%= suggestion.image %> + <%= suggestion.link %> + <%= suggestion.rating[:stars] %> +
  • +<% end %> + \ No newline at end of file diff --git a/app/views/suggestions/index.html.erb b/app/views/suggestions/index.html.erb index 543b907..4148b06 100644 --- a/app/views/suggestions/index.html.erb +++ b/app/views/suggestions/index.html.erb @@ -1,2 +1,5 @@ -

    Here's a list of suggestions

    +

    + Here's a list of suggestions! +

    +<%= render partial: "suggestion" %> \ No newline at end of file diff --git a/app/views/suggestions/results.html.erb b/app/views/suggestions/results.html.erb new file mode 100644 index 0000000..86f6626 --- /dev/null +++ b/app/views/suggestions/results.html.erb @@ -0,0 +1,3 @@ +<% @suggestions.each do |suggestion| %> + <%= render partial: 'suggestion', object: suggestion %> +<% end %> \ No newline at end of file diff --git a/app/views/suggestions/search.html.erb b/app/views/suggestions/search.html.erb new file mode 100644 index 0000000..e69de29 From 425bb1fb6300702b4fec9e8ed3cb9ea5461c4816 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:15:17 -0700 Subject: [PATCH 21/46] clarified code in the models, finished writing the food model to query yelp api --- app/controllers/sessions_controller.rb | 19 +++++++++ app/controllers/suggestions_controller.rb | 28 +++++++++++-- app/controllers/users_controller.rb | 50 +++++++++++++++-------- 3 files changed, 75 insertions(+), 22 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b0435f5..c516419 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,3 +1,22 @@ class SessionsController < ApplicationController + 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 + redirect_to root_path, notice: "Failed to save" + end + end + + def destroy + session.delete :user_id + redirect_to root_path + end end diff --git a/app/controllers/suggestions_controller.rb b/app/controllers/suggestions_controller.rb index f53b5de..0a7f481 100644 --- a/app/controllers/suggestions_controller.rb +++ b/app/controllers/suggestions_controller.rb @@ -2,11 +2,31 @@ class SuggestionsController < ApplicationController skip_before_action :require_login, only: :index def index + if @suggestions.nil? + redirect_to root_path, notice: "No matches for #{params["query"]}!" + else + render :index + end + end - end + def create + @tunes_takeout = TunesTakeoutWrapper.search(params["query"]) + @suggestions = @tunes_takeout.suggestions + @music_suggestions = Music.suggested_music(@suggestions) + @food_suggestions = Food.suggested_food(@suggestions) + render :index + end + + + def show + # individual restaurants / music + # don't forget a route + end - def new - @suggestions = Food.new + def favorite end - + + def unfavorite + end + end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index caa49c3..6bacebc 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,23 +1,37 @@ class UsersController < ApplicationController - def create - auth_hash = request.env['omniauth.auth'] - - if auth_hash["info"]["id"] - @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, notice: "Failed to save the user" - end - else - redirect_to root_path, notice: "Failed to authenticate" - end - end + def spotify + spotify_user = RSpotify::User.new(request.env['omniauth.auth']) + # Now you can access user's private data, create playlists and much more + + # Access private data + spotify_user.country #=> "US" + spotify_user.email #=> "example@email.com" + + # Add tracks to a playlist in user's Spotify account + tracks = RSpotify::Track.search('Know') + playlist.add_tracks!(tracks) + playlist.tracks.first.name #=> "Somebody That I Used To Know" + + # Access and modify user's music library + spotify_user.save_tracks!(tracks) + spotify_user.saved_tracks.size #=> 20 + spotify_user.remove_tracks!(tracks) + + albums = RSpotify::Album.search('launeddas') + spotify_user.save_albums!(albums) + spotify_user.saved_albums.size #=> 10 + spotify_user.remove_albums!(albums) + + # Use Spotify Follow features + spotify_user.follow(playlist) + spotify_user.follows?(artists) + spotify_user.unfollow(users) + + # Get user's top played artists and tracks + spotify_user.top_artists #=> (Artist array) + spotify_user.top_tracks(time_range: 'short_term') #=> (Track array) - def destroy - session.delete :user_id - redirect_to root_path + # Check doc for more end end From abec55fde895dcd292d7e25bfe88af44601674f3 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:16:14 -0700 Subject: [PATCH 22/46] limited search to 10 results, modified the file name so rails would stop saying TunesTakeoutWrapper.rb was invalid. --- lib/tunes_takeout_wrapper.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/tunes_takeout_wrapper.rb b/lib/tunes_takeout_wrapper.rb index 2ec0a2c..7e96a46 100644 --- a/lib/tunes_takeout_wrapper.rb +++ b/lib/tunes_takeout_wrapper.rb @@ -1,18 +1,16 @@ require 'httparty' -module TunesTakeoutWrapper - BASE_URL = "https://tunes-takeout-api.herokuapp.com/v1/" +class TunesTakeoutWrapper + BASE_URL = "https://tunes-takeout-api.herokuapp.com/" + attr_reader :suggestions, :href def initialize(data) - @id = data["id"] - @food_id = data["food_id"] - @music_id = data["music_id"] - @music_type = data["music_type"] - end + @href = data["href"] + @suggestions = data["suggestions"] + end - # limit, seed as params? - def self.find(suggestion) - data = HTTParty.get(BASE_URL + "suggestions/search?#{suggestion}").parsed_response + def self.search(query, limit=10, seed=nil) + data = HTTParty.get(BASE_URL + "/v1/suggestions/search?query=#{query}").parsed_response self.new(data) end -end \ No newline at end of file +end From d007670fad1d6a256003e7edee6fa30799268257 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:22:45 -0700 Subject: [PATCH 23/46] re-organized views to accomidate favorting suggestions --- app/views/home/index.html.erb | 11 +++++++++-- app/views/suggestions/_suggestion.html.erb | 6 +++--- app/views/suggestions/index.html.erb | 10 ++++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index a5a69b3..f6da197 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,8 +1,15 @@ -

    Welcome to Tunes and Takeout!

    +

    + Welcome to Tunes and Takeout! +

    <% if current_user %> <%= form_tag :suggestions, {controller: 'suggestions', action: 'create'} do |f| %> <%= label_tag :query %> <%= text_field_tag :query %> <%= submit_tag("Search") %> <% end %> -<% end %> \ No newline at end of file +<% end %> + +

    + Top Favorites Suggestions List! +

    + \ No newline at end of file diff --git a/app/views/suggestions/_suggestion.html.erb b/app/views/suggestions/_suggestion.html.erb index 6bf4b47..9365a7a 100644 --- a/app/views/suggestions/_suggestion.html.erb +++ b/app/views/suggestions/_suggestion.html.erb @@ -1,9 +1,6 @@

    Music

    -

    - Food -

    <% @music_suggestions.each do |suggestion| %>
  • <%= suggestion.name %> @@ -12,6 +9,9 @@
  • <% end %> +

    + Food +

    <% @food_suggestions.each do |suggestion| %>
  • <%= suggestion.name %> diff --git a/app/views/suggestions/index.html.erb b/app/views/suggestions/index.html.erb index 4148b06..e600d10 100644 --- a/app/views/suggestions/index.html.erb +++ b/app/views/suggestions/index.html.erb @@ -1,5 +1,7 @@ -

    - Here's a list of suggestions! -

    +<% if current_user %> +

    + Here's a list of suggestions! +

    -<%= render partial: "suggestion" %> \ No newline at end of file + <%= render partial: "suggestion" %> +<% end %> \ No newline at end of file From 4335e57f461887920342ee89e1c9d2c0043a20e2 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:44:21 -0700 Subject: [PATCH 24/46] Generated a migration to add in user images from spotify when logged in --- db/migrate/20160519064009_add_photo_url_to_users.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160519064009_add_photo_url_to_users.rb diff --git a/db/migrate/20160519064009_add_photo_url_to_users.rb b/db/migrate/20160519064009_add_photo_url_to_users.rb new file mode 100644 index 0000000..007ea70 --- /dev/null +++ b/db/migrate/20160519064009_add_photo_url_to_users.rb @@ -0,0 +1,5 @@ +class AddPhotoUrlToUsers < ActiveRecord::Migration + def change + add_column :users, :photo_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 8c3c8bd..6dc305e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160518001155) do +ActiveRecord::Schema.define(version: 20160519064009) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -33,6 +33,7 @@ t.string "display_name", null: false t.string "email" t.string "provider", null: false + t.string "photo_url" end end From 577717c026753097ba892cf2a9e5db69b4b317e7 Mon Sep 17 00:00:00 2001 From: Jade Vance Date: Wed, 18 May 2016 23:44:53 -0700 Subject: [PATCH 25/46] added css and the spotify icon to application.html.erb --- app/assets/images/Spotify_Icon_RGB_Green.png | Bin 0 -> 16410 bytes app/assets/stylesheets/application.css | 3 +++ app/models/user.rb | 3 +-- app/views/layouts/application.html.erb | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/Spotify_Icon_RGB_Green.png diff --git a/app/assets/images/Spotify_Icon_RGB_Green.png b/app/assets/images/Spotify_Icon_RGB_Green.png new file mode 100644 index 0000000000000000000000000000000000000000..26410e2fe2ec1e88d81aad43aebdb40691e4db3b GIT binary patch literal 16410 zcmb8WcRyU;_da|^?xx6_-lL^rrvdhp2-Cx z0)Qx60ARpC0E7@3fPQrLodIxNSsPuy(e`lr;^5$A*abGMo~r*|XlPophkIC~N#Hmj zyC3;e5X~4ny-p0NJ72`1T423aN7{-NJe1@3WR)J?kgac^UbIcrZ>U4^zKZTnYe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U)!E9(0NP>a9o=(Z(kENV3pgW^%*YpuN z(Y}Yry-vXG(-hq9S0u+(*`J&sq!FRn}}ju$bNepIsfbh~rE$IGpHG zgw@l7Dri9!@D;QoZAlMYwxsilMjK_<+5>lWCXMUQGX}?Jy@*!qo0pFUNw&it&Z&tS zRToke_;yRk$&FY$vj^&7&@ILc*MZaHH{%oWi%2=auK?a!kcO)*l?iQ)gqmYm^Q^nSFRfmbqQ&{zGC zUs4{sRi)3z*{h{ELHlrYy**b>P=4B7zD93Jwm|_>X%iH9c~(F|@;4LnG&PWT48ozf zY5Fvn8|4qKkNVFF^hF>3cju=ySY1cgw~Rg?c`=;I&>|K+m&OMHtr$$nF8M0bN6`Tq zoS=MzXO_Az@Kv$dAIdhmNxmym_4E56q}x2o{ub-zVjURGwF4~KuYuZ5*$$VMVAys^U+PG5^m1tItWiTLP+3L` zej$Lf=w&TovBKQZnD4Y!ofbdkxcX7SETN!KUTeF#a#_@)ccte|Vy#qdpzh(%!`Tn_ zT^Qe{RvTxHF4g^PZEyY>J4_Ag;inlM9Z_Mq#m@JId-iO+d2Ay)(7&JQ=SXsY_}`|3 z4N(qr0PN;Vw&9go5oyH!Kc;-qSUAXwx&n`Zqx^s5d06cwt2NM*bQxz6o>~O*`T;Es L-Tx}otRwzE3yc;) literal 0 HcmV?d00001 diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f9cd5b3..b3d5434 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,6 @@ *= require_tree . *= require_self */ + .spot-logo img{ + width: 40px; + } \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 53599fb..ddc148f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,3 @@ -# require_relative '../../lib/tunes_takeout_wrapper.rb' - class User < ActiveRecord::Base validates :display_name, :uid, :provider, presence: true @@ -12,6 +10,7 @@ def self.find_or_create_from_omniauth(auth_hash) else # create a user user = User.new + user.photo_url = auth_hash["info"]['images'][0]['url'] user.uid = auth_hash["info"]["id"] user.display_name = auth_hash["info"]["display_name"] user.email = auth_hash["info"]["email"] diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3f0dde2..94c6e5b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,8 +11,15 @@
    <%= "Hi #{ current_user.display_name }!" if current_user %> + <%= image_tag current_user.photo_url if current_user %>