# coding: utf-8 require 'hallon' require './spec/support/config' # Utility def prompt(str) print str gets.chomp end # Hallon session = Hallon::Session.instance IO.read(ENV['HALLON_APPKEY']) do on(:log_message) do |message| $stderr.puts "[LOG] #{message}" end end while url = prompt("Enter a Spotify URI: ") begin p (link = Hallon::Link.new(url)) puts "\tHTTP URL: #{link.to_url}" puts "\tSpotify URI: #{link.to_str}" puts "\tLink type: #{link.type}" rescue ArgumentError => e puts e end end