Class: Ghetto::Blaster::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ghetto/blaster/cli.rb

Instance Method Summary collapse

Instance Method Details

#play(username) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/ghetto/blaster/cli.rb', line 10

def play(username)
  tracks_for(username).each do |track|
    stream_url = "#{track[:stream_url]}s/?client_id=#{client_id}"
    json = JSON.parse(client.get(stream_url).body, symbolize_names: true)
    say json[json.keys.first]
  end
end

#tracks(username) ⇒ Object



24
25
26
# File 'lib/ghetto/blaster/cli.rb', line 24

def tracks(username)
  say tracks_for(username, parse: false)
end

#user(username) ⇒ Object



19
20
21
# File 'lib/ghetto/blaster/cli.rb', line 19

def user(username)
  say client.get(resolve(username)[:location]).body
end

#versionObject



29
30
31
# File 'lib/ghetto/blaster/cli.rb', line 29

def version
  say Ghetto::Blaster::VERSION
end