class InitSpotifyLogin def self.create_new_login spotify = Spotify.new puts 'Enter email:' email = $stdin.gets.chomp user = User.find_or_create_by!(email: email) puts "\nopen in browser:" puts spotify.auth_redirect_url.to_s puts "\ncopy url from browser and paste: " code_url = $stdin.gets.chomp puts 'parsing...' response = spotify.auth_code_authorize_url(code_url) Login.find_or_create_for_response!(user, response) puts 'login created successful' end end