Sha256: 1ab3fb1af635d8d96ec768e980b205234b65c511815198c601f5f5c8584706b3

Contents?: true

Size: 607 Bytes

Versions: 3

Compression:

Stored size: 607 Bytes

Contents

# coding: utf-8

$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))

require 'hallon'
require './spec/support/config'

# Utility
def prompt(str)
  print str
  gets.chomp
end

# Hallon
session = Hallon::Session.initialize 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hallon-0.14.0 examples/printing_link_information.rb
hallon-0.13.0 examples/printing_link_information.rb
hallon-0.12.0 examples/printing_link_information.rb