pias 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/pias +4 -0
  2. data/lib/pias.rb +27 -0
  3. metadata +64 -0
data/bin/pias ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pias'
4
+ TinySong.new.play_song
data/lib/pias.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'HTTParty'
2
+
3
+ class TinySong
4
+ include HTTParty
5
+
6
+ API_KEY="a7a9aeb495388ed7bcd8086fa414a775"
7
+
8
+ def initialize
9
+ end
10
+
11
+ def play_song
12
+ return 'Please enter a song' if ARGV.count == 0
13
+
14
+ song = ARGV.join "+"
15
+
16
+ params= {:query => {:format => "json", :key => API_KEY}}
17
+ response=self.class.get("https://tinysong.com/a/#{song}", params)
18
+ url=response.parsed_response.delete("\\")
19
+
20
+ if url =~ /tinysong\.com/
21
+ puts "Play it again Sam #{url}"
22
+ `open #{url}`
23
+ else
24
+ puts "Error accessing API, try again later."
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pias
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Uri Gorelik
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Play a song using tinysong.com API
31
+ email: uri.gore@gmail.com
32
+ executables:
33
+ - pias
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/pias.rb
38
+ - bin/pias
39
+ homepage: https://github.com/ugorelik/pias
40
+ licenses: []
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements:
58
+ - httparty
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.24
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Play a song using tinysong.com API
64
+ test_files: []