next-big-sound-lite 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest ADDED
@@ -0,0 +1,5 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ init.rb
5
+ lib/next-big-sound-lite.rb
data/README.rdoc ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # Rakefile
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require 'echoe'
5
+
6
+ Echoe.new('next-big-sound-lite', '0.1.0') do |p|
7
+ p.description = "Thin wrapper for the Next Big Sound API."
8
+ p.url = "http://github.com/rpbertp13/next-big-sound-lite"
9
+ p.author = "Roberto Thais"
10
+ p.email = "roberto.n.thais@gmail.com"
11
+ p.ignore_pattern = ["tmp/*", "script/*"]
12
+ p.development_dependencies = ["rest-client", "json"]
13
+ end
14
+
15
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # init.rb
2
+ require 'next-big-sound-lite'
@@ -0,0 +1,108 @@
1
+ require 'rest_client'
2
+
3
+ #for version 2.0 of the NBS API
4
+ module NBS
5
+
6
+ KEY = "key"
7
+ BASE = RestClient::Resource.new("http://#{KEY}.api2.nextbigsound.com")
8
+
9
+ class Artist
10
+
11
+ @resource = BASE['artists']
12
+
13
+ def self.view(id)
14
+ res = @resource["view/#{id}.json"].get
15
+ JSON.parse(res)
16
+ end
17
+
18
+ def self.search(q)
19
+ res = @resource["search.json?q=#{CGI.escape(q)}"].get
20
+ JSON.parse(res)
21
+ end
22
+
23
+ def self.ranking(type, ids)
24
+ ids = ids.join('-')
25
+ res = @resource["rank/#{type}/#{ids}.json"].get
26
+ JSON.parse(res)
27
+ end
28
+
29
+ end
30
+
31
+ class Genre
32
+
33
+ @resource = BASE['genres']
34
+
35
+ def self.artist(id)
36
+ res = @resource["artist/#{id}.json"].get
37
+ JSON.parse(res)
38
+ end
39
+ end
40
+
41
+ class Metric
42
+
43
+ @resource = BASE['metrics']
44
+
45
+ def self.profile(id)
46
+ res = @resource["profile/#{id}.json"].get
47
+ JSON.parse(res)
48
+ end
49
+
50
+ def self.artist(id)
51
+ res = @resource["artist/#{id}.json"].get
52
+ JSON.parse(res)
53
+ end
54
+ end
55
+
56
+ class Profile
57
+
58
+ @resource = BASE['profiles']
59
+
60
+ def self.artist(id)
61
+ res = @resource["artist/#{id}.json"].get
62
+ JSON.parse(res)
63
+ end
64
+
65
+ def self.search(url)
66
+ res = @resource["search.json?u=#{CGI.escape(url)}"].get
67
+ JSON.parse(res)
68
+ end
69
+ end
70
+
71
+ class Service
72
+
73
+ @resource = BASE['services']
74
+
75
+ def self.list
76
+ JSON.parse(@resource['.json'].get)
77
+ end
78
+
79
+ end
80
+
81
+ class Track
82
+
83
+ @resource = BASE['tracks']
84
+
85
+ def self.artist(id)
86
+ res = @resource["artist/#{id}.json"].get
87
+ JSON.parse(res)
88
+ end
89
+
90
+ def self.profile(id)
91
+ res = @resource["profile/#{id}.json"].get
92
+ JSON.parse(res)
93
+ end
94
+
95
+ end
96
+
97
+ class Youtube
98
+
99
+ @resource = BASE['youtube']
100
+
101
+ def self.artist(id)
102
+ res = @resource["artist/#{id}.json"].get
103
+ JSON.parse(res)
104
+ end
105
+
106
+ end
107
+
108
+ end
@@ -0,0 +1,36 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{next-big-sound-lite}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Roberto Thais"]
9
+ s.date = %q{2010-06-10}
10
+ s.description = %q{Thin wrapper for the Next Big Sound API.}
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"]
14
+ s.homepage = %q{http://github.com/rpbertp13/next-big-sound-lite}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Next-big-sound-lite", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{next-big-sound-lite}
18
+ s.rubygems_version = %q{1.3.6}
19
+ s.summary = %q{Thin wrapper for the Next Big Sound API.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ s.add_development_dependency(%q<rest-client>, [">= 0"])
27
+ s.add_development_dependency(%q<json>, [">= 0"])
28
+ else
29
+ s.add_dependency(%q<rest-client>, [">= 0"])
30
+ s.add_dependency(%q<json>, [">= 0"])
31
+ end
32
+ else
33
+ s.add_dependency(%q<rest-client>, [">= 0"])
34
+ s.add_dependency(%q<json>, [">= 0"])
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: next-big-sound-lite
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Roberto Thais
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-10 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rest-client
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: json
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :development
43
+ version_requirements: *id002
44
+ description: Thin wrapper for the Next Big Sound API.
45
+ email: roberto.n.thais@gmail.com
46
+ executables: []
47
+
48
+ extensions: []
49
+
50
+ extra_rdoc_files:
51
+ - README.rdoc
52
+ - lib/next-big-sound-lite.rb
53
+ files:
54
+ - Manifest
55
+ - README.rdoc
56
+ - Rakefile
57
+ - init.rb
58
+ - lib/next-big-sound-lite.rb
59
+ - next-big-sound-lite.gemspec
60
+ has_rdoc: true
61
+ homepage: http://github.com/rpbertp13/next-big-sound-lite
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --line-numbers
67
+ - --inline-source
68
+ - --title
69
+ - Next-big-sound-lite
70
+ - --main
71
+ - README.rdoc
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 1
87
+ - 2
88
+ version: "1.2"
89
+ requirements: []
90
+
91
+ rubyforge_project: next-big-sound-lite
92
+ rubygems_version: 1.3.6
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: Thin wrapper for the Next Big Sound API.
96
+ test_files: []
97
+