diff options
| author | mo <mo.khan@gmail.com> | 2018-06-14 09:45:34 -0600 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2018-06-14 09:45:34 -0600 |
| commit | 8f871b2a14b4851503ade5f3af723a544683ba0c (patch) | |
| tree | f7343c7cbcd1dea069fa7aae6fa9e936efb2259d /lib | |
| parent | 886d21e605f563dea9f9e13c142451d03c726250 (diff) | |
start to connect to the soundcloud api.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ghetto/blaster/cli.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ghetto/blaster/cli.rb b/lib/ghetto/blaster/cli.rb index 8cec283..6c0ad84 100644 --- a/lib/ghetto/blaster/cli.rb +++ b/lib/ghetto/blaster/cli.rb @@ -1,12 +1,35 @@ require 'thor' +require 'net/hippie' module Ghetto module Blaster class CLI < Thor + class_option :client_id, default: ENV['CLIENT_ID'] + + desc "play", "play music" + def play + Net::Hippie.logger = Logger.new('/dev/null') + say client.get(build_uri("tracks?client_id=#{client_id}")).body + end + desc "version", "print version" def version say Ghetto::Blaster::VERSION end + + private + + def client + @client ||= Net::Hippie::Client.new + end + + def client_id + options[:client_id] + end + + def build_uri(path) + "https://api.soundcloud.com/#{path}" + end end end end |
