next-big-sound-lite 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -3,3 +3,11 @@ README.rdoc
3
3
  Rakefile
4
4
  init.rb
5
5
  lib/next-big-sound-lite.rb
6
+ lib/next-big-sound-lite/artist.rb
7
+ lib/next-big-sound-lite/genre.rb
8
+ lib/next-big-sound-lite/metric.rb
9
+ lib/next-big-sound-lite/profile.rb
10
+ lib/next-big-sound-lite/resource.rb
11
+ lib/next-big-sound-lite/service.rb
12
+ lib/next-big-sound-lite/track.rb
13
+ lib/next-big-sound-lite/youtube.rb
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('next-big-sound-lite', '0.1.7') do |p|
6
+ Echoe.new('next-big-sound-lite', '0.2.0') do |p|
7
7
  p.description = "Thin wrapper for the Next Big Sound API."
8
8
  p.url = "http://github.com/rpbertp13/next-big-sound-lite"
9
9
  p.author = "Roberto Thais"
@@ -1,116 +1,30 @@
1
+ #For version 2.0 of the Next Big Sound API
2
+
1
3
  require 'rest_client'
2
4
  require 'json'
5
+ require 'cgi'
6
+
7
+ require 'next-big-sound-lite/resource'
8
+ require 'next-big-sound-lite/artist'
9
+ require 'next-big-sound-lite/genre'
10
+ require 'next-big-sound-lite/metric'
11
+ require 'next-big-sound-lite/profile'
12
+ require 'next-big-sound-lite/service'
13
+ require 'next-big-sound-lite/track'
14
+ require 'next-big-sound-lite/youtube'
3
15
 
4
- #for version 2.0 of the NBS API
5
16
  module NBS
6
17
 
18
+ class << self
19
+ attr_reader :base
20
+ attr_accessor :private_key
21
+ end
22
+
7
23
  def self.api_key=(key)
8
24
  @base = RestClient::Resource.new("http://#{key}.api2.nextbigsound.com")
9
25
  end
10
-
11
- def self.base
12
- @base
13
- end
14
-
15
- self.api_key = 'key'
16
-
17
- class Artist
18
-
19
- @resource = NBS.base['artists']
20
-
21
- def self.view(id)
22
- res = @resource["view/#{id}.json"].get
23
- JSON.parse(res)
24
- end
25
-
26
- def self.search(q)
27
- res = @resource["search.json?q=#{CGI.escape(q)}"].get
28
- JSON.parse(res)
29
- end
30
-
31
- def self.ranking(type, ids)
32
- ids = ids.join('-')
33
- res = @resource["rank/#{type}/#{ids}.json"].get
34
- JSON.parse(res)
35
- end
36
-
37
- end
38
-
39
- class Genre
40
-
41
- @resource = NBS.base['genres']
42
-
43
- def self.artist(id)
44
- res = @resource["artist/#{id}.json"].get
45
- JSON.parse(res)
46
- end
47
- end
48
-
49
- class Metric
50
-
51
- @resource = NBS.base['metrics']
52
-
53
- def self.profile(id)
54
- res = @resource["profile/#{id}.json"].get
55
- JSON.parse(res)
56
- end
57
-
58
- def self.artist(id)
59
- res = @resource["artist/#{id}.json"].get
60
- JSON.parse(res)
61
- end
62
- end
63
-
64
- class Profile
65
-
66
- @resource = NBS.base['profiles']
67
-
68
- def self.artist(id)
69
- res = @resource["artist/#{id}.json"].get
70
- JSON.parse(res)
71
- end
72
-
73
- def self.search(url)
74
- res = @resource["search.json?u=#{CGI.escape(url)}"].get
75
- JSON.parse(res)
76
- end
77
- end
78
-
79
- class Service
80
-
81
- @resource = NBS.base['services']
82
-
83
- def self.list
84
- JSON.parse(@resource['.json'].get)
85
- end
86
-
87
- end
88
-
89
- class Track
90
-
91
- @resource = NBS.base['tracks']
92
26
 
93
- def self.artist(id)
94
- res = @resource["artist/#{id}.json"].get
95
- JSON.parse(res)
96
- end
97
-
98
- def self.profile(id)
99
- res = @resource["profile/#{id}.json"].get
100
- JSON.parse(res)
101
- end
102
-
103
- end
104
-
105
- class Youtube
106
-
107
- @resource = NBS.base['youtube']
108
-
109
- def self.artist(id)
110
- res = @resource["artist/#{id}.json"].get
111
- JSON.parse(res)
112
- end
113
-
114
- end
115
-
116
- end
27
+ self.api_key = 'key'
28
+
29
+ end
30
+
@@ -0,0 +1,31 @@
1
+ module NBS
2
+
3
+ class Artist < Resource
4
+
5
+ def self.resource
6
+ super 'artists'
7
+ end
8
+
9
+ def self.view(id)
10
+ res = resource["view/#{id}.json"].get
11
+ JSON.parse(res)
12
+ end
13
+
14
+ def self.search(q)
15
+ res = resource["search.json?q=#{CGI.escape(q)}"].get
16
+ JSON.parse(res)
17
+ end
18
+
19
+ def self.ranking(type, ids)
20
+ ids = ids.join('-')
21
+ res = resource["rank/#{type}/#{ids}.json"].get
22
+ JSON.parse(res)
23
+ end
24
+
25
+ def self.add(name)
26
+ res = resource["add.json?n=#{CGI.escape(name)}&k=#{NBS.private_key}"].get
27
+ JSON.parse(res)
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,15 @@
1
+ module NBS
2
+
3
+ class Genre < Resource
4
+
5
+ def self.resource
6
+ super 'genres'
7
+ end
8
+
9
+ def self.artist(id)
10
+ res = resource["artist/#{id}.json"].get
11
+ JSON.parse(res)
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,20 @@
1
+ module NBS
2
+
3
+ class Metric < Resource
4
+
5
+ def self.resource
6
+ super 'metrics'
7
+ end
8
+
9
+ def self.profile(id)
10
+ res = resource["profile/#{id}.json"].get
11
+ JSON.parse(res)
12
+ end
13
+
14
+ def self.artist(id)
15
+ res = resource["artist/#{id}.json"].get
16
+ JSON.parse(res)
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,26 @@
1
+ module NBS
2
+
3
+ class Profile < Resource
4
+
5
+ def self.resource
6
+ super 'profiles'
7
+ end
8
+
9
+ def self.artist(id)
10
+ res = resource["artist/#{id}.json"].get
11
+ JSON.parse(res)
12
+ end
13
+
14
+ def self.search(url)
15
+ res = resource["search.json?u=#{CGI.escape(url)}"].get
16
+ JSON.parse(res)
17
+ end
18
+
19
+ def self.add(artist_id, url)
20
+ res = resource["add/#{artist_id}.json?u=#{CGI::escape(url)}&k=#{NBS.private_key}"].get
21
+ JSON.parse(res)
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,10 @@
1
+ module NBS
2
+
3
+ class Resource
4
+ def self.resource(name)
5
+ NBS.base[name]
6
+ end
7
+ end
8
+
9
+ end
10
+
@@ -0,0 +1,15 @@
1
+ module NBS
2
+
3
+ class Service < Resource
4
+
5
+ def self.resource
6
+ super 'services'
7
+ end
8
+
9
+ def self.list
10
+ JSON.parse(resource['.json'].get)
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,20 @@
1
+ module NBS
2
+
3
+ class Track < Resource
4
+
5
+ def self.resource
6
+ super 'tracks'
7
+ end
8
+
9
+ def self.artist(id)
10
+ res = resource["artist/#{id}.json"].get
11
+ JSON.parse(res)
12
+ end
13
+
14
+ def self.profile(id)
15
+ res = resource["profile/#{id}.json"].get
16
+ JSON.parse(res)
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,16 @@
1
+ module NBS
2
+
3
+ class Youtube < Resource
4
+
5
+ def self.resource
6
+ super 'youtube'
7
+ end
8
+
9
+ def self.artist(id)
10
+ res = resource["artist/#{id}.json"].get
11
+ JSON.parse(res)
12
+ end
13
+
14
+ end
15
+
16
+ end
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{next-big-sound-lite}
5
- s.version = "0.1.7"
5
+ s.version = "0.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Roberto Thais"]
9
- s.date = %q{2010-06-10}
9
+ s.date = %q{2010-06-11}
10
10
  s.description = %q{Thin wrapper for the Next Big Sound API.}
11
11
  s.email = %q{roberto.n.thais@gmail.com}
12
- s.extra_rdoc_files = ["README.rdoc", "lib/next-big-sound-lite.rb"]
13
- s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/next-big-sound-lite.rb", "next-big-sound-lite.gemspec"]
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/next-big-sound-lite.rb", "lib/next-big-sound-lite/artist.rb", "lib/next-big-sound-lite/genre.rb", "lib/next-big-sound-lite/metric.rb", "lib/next-big-sound-lite/profile.rb", "lib/next-big-sound-lite/resource.rb", "lib/next-big-sound-lite/service.rb", "lib/next-big-sound-lite/track.rb", "lib/next-big-sound-lite/youtube.rb"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/next-big-sound-lite.rb", "lib/next-big-sound-lite/artist.rb", "lib/next-big-sound-lite/genre.rb", "lib/next-big-sound-lite/metric.rb", "lib/next-big-sound-lite/profile.rb", "lib/next-big-sound-lite/resource.rb", "lib/next-big-sound-lite/service.rb", "lib/next-big-sound-lite/track.rb", "lib/next-big-sound-lite/youtube.rb", "next-big-sound-lite.gemspec"]
14
14
  s.homepage = %q{http://github.com/rpbertp13/next-big-sound-lite}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Next-big-sound-lite", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 7
9
- version: 0.1.7
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Roberto Thais
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-10 00:00:00 -04:00
17
+ date: 2010-06-11 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -50,12 +50,28 @@ extensions: []
50
50
  extra_rdoc_files:
51
51
  - README.rdoc
52
52
  - lib/next-big-sound-lite.rb
53
+ - lib/next-big-sound-lite/artist.rb
54
+ - lib/next-big-sound-lite/genre.rb
55
+ - lib/next-big-sound-lite/metric.rb
56
+ - lib/next-big-sound-lite/profile.rb
57
+ - lib/next-big-sound-lite/resource.rb
58
+ - lib/next-big-sound-lite/service.rb
59
+ - lib/next-big-sound-lite/track.rb
60
+ - lib/next-big-sound-lite/youtube.rb
53
61
  files:
54
62
  - Manifest
55
63
  - README.rdoc
56
64
  - Rakefile
57
65
  - init.rb
58
66
  - lib/next-big-sound-lite.rb
67
+ - lib/next-big-sound-lite/artist.rb
68
+ - lib/next-big-sound-lite/genre.rb
69
+ - lib/next-big-sound-lite/metric.rb
70
+ - lib/next-big-sound-lite/profile.rb
71
+ - lib/next-big-sound-lite/resource.rb
72
+ - lib/next-big-sound-lite/service.rb
73
+ - lib/next-big-sound-lite/track.rb
74
+ - lib/next-big-sound-lite/youtube.rb
59
75
  - next-big-sound-lite.gemspec
60
76
  has_rdoc: true
61
77
  homepage: http://github.com/rpbertp13/next-big-sound-lite