Sha256: f59b486e64549d51683db8ee48652fa2f36de33a26e5348f88e978cebb8ea240

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

module Imuze
  class GetMusic < Struct.new(:token, :mp3_uri)
    include Methadone::CLILogging
    include Methadone::SH
    require 'uri'
    require 'net/http'
    require 'json'

    def self.call(*args)
      new(*args).call
    end

    def call
      sh command do |stdout, stderr|
        puts 'We hope you liked it !'
      end
    end

    private

    def command
      %Q(curl "http:#{mp3_uri}"  -s -H "Content-Type: application/json"  -H "Authorization: #{token}" | mpg123 - 2> /dev/null)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imuzer-0.0.2 lib/imuze/get_music.rb