next-big-sound-lite 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +20 -0
- data/Rakefile +7 -13
- data/lib/next-big-sound-lite.rb +1 -30
- data/lib/next_big_sound_lite.rb +27 -0
- data/lib/next_big_sound_lite/resource.rb +59 -0
- data/lib/next_big_sound_lite/resources/artist.rb +35 -0
- data/lib/{next-big-sound-lite → next_big_sound_lite/resources}/genre.rb +4 -3
- data/lib/next_big_sound_lite/resources/metric.rb +49 -0
- data/lib/next_big_sound_lite/resources/profile.rb +29 -0
- data/lib/next_big_sound_lite/resources/service.rb +19 -0
- data/lib/next_big_sound_lite/version.rb +3 -0
- data/next_big_sound_lite.gemspec +25 -0
- metadata +44 -55
- data/Manifest +0 -13
- data/README.rdoc +0 -27
- data/init.rb +0 -2
- data/lib/next-big-sound-lite/artist.rb +0 -31
- data/lib/next-big-sound-lite/metric.rb +0 -20
- data/lib/next-big-sound-lite/profile.rb +0 -26
- data/lib/next-big-sound-lite/resource.rb +0 -10
- data/lib/next-big-sound-lite/service.rb +0 -15
- data/lib/next-big-sound-lite/track.rb +0 -20
- data/lib/next-big-sound-lite/youtube.rb +0 -16
- data/next-big-sound-lite.gemspec +0 -36
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Next Big Sound Lite
|
2
|
+
--
|
3
|
+
|
4
|
+
This gem wraps the Next Big Sound JSON API. Read the API docs {here}[http://api3.nextbigsound.com].
|
5
|
+
|
6
|
+
Done? Then you can use this API.
|
7
|
+
|
8
|
+
First setup the gem to use your API key:
|
9
|
+
|
10
|
+
NextBigSoundLite.api_key = 'my_key'
|
11
|
+
|
12
|
+
If you have a private key (for writing):
|
13
|
+
|
14
|
+
NextBigSoundLite.private_key = 'my_private_key'
|
15
|
+
|
16
|
+
The methods of this wrapper are organized in the same way as the subsections of the API docs. For example to call the endpoint 'profile' on Metrics you should call:
|
17
|
+
|
18
|
+
NextBigSoundLite::Metric.profile(200, :start => 2.months.ago)
|
19
|
+
|
20
|
+
Notice that the receiver has a singular name (ala Rails Models)
|
data/Rakefile
CHANGED
@@ -1,15 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'echoe'
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
5
3
|
|
6
|
-
|
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
|
4
|
+
require 'spec/rake/spectask'
|
14
5
|
|
15
|
-
|
6
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
7
|
+
t.spec_files = Dir.glob('spec/**/*_spec.rb')
|
8
|
+
t.spec_opts << '--format specdoc'
|
9
|
+
end
|
data/lib/next-big-sound-lite.rb
CHANGED
@@ -1,30 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rest_client'
|
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'
|
15
|
-
|
16
|
-
module NBS
|
17
|
-
|
18
|
-
class << self
|
19
|
-
attr_reader :base
|
20
|
-
attr_accessor :private_key
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.api_key=(key)
|
24
|
-
@base = RestClient::Resource.new("http://#{key}.api2.nextbigsound.com")
|
25
|
-
end
|
26
|
-
|
27
|
-
self.api_key = 'key'
|
28
|
-
|
29
|
-
end
|
30
|
-
|
1
|
+
require 'next_big_sound_lite'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#For version 3.0 of the Next Big Sound API
|
2
|
+
|
3
|
+
require 'rest_client'
|
4
|
+
require 'json'
|
5
|
+
require 'hashie'
|
6
|
+
|
7
|
+
require 'next_big_sound_lite/resource'
|
8
|
+
require 'next_big_sound_lite/resources/artist'
|
9
|
+
require 'next_big_sound_lite/resources/genre'
|
10
|
+
require 'next_big_sound_lite/resources/metric'
|
11
|
+
require 'next_big_sound_lite/resources/profile'
|
12
|
+
require 'next_big_sound_lite/resources/service'
|
13
|
+
|
14
|
+
module NextBigSoundLite
|
15
|
+
|
16
|
+
class << self
|
17
|
+
attr_reader :base
|
18
|
+
attr_accessor :private_key
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.api_key=(key)
|
22
|
+
@base = RestClient::Resource.new("http://#{key}.api3.nextbigsound.com")
|
23
|
+
end
|
24
|
+
|
25
|
+
self.api_key = 'key'
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module NextBigSoundLite
|
2
|
+
|
3
|
+
class Resource
|
4
|
+
def self.resource(name)
|
5
|
+
NextBigSoundLite.base[name]
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.get(resource)
|
9
|
+
begin
|
10
|
+
res = parse resource.get
|
11
|
+
if block_given?
|
12
|
+
yield res
|
13
|
+
else
|
14
|
+
res
|
15
|
+
end
|
16
|
+
# The API uses 400 Bad Request to indicate negative results
|
17
|
+
# such as 'no results found'.
|
18
|
+
rescue RestClient::BadRequest => e
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.post(resource, params)
|
24
|
+
begin
|
25
|
+
parse resource.post(params)
|
26
|
+
rescue RestClient::BadRequest => e
|
27
|
+
false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.parse(response)
|
32
|
+
res = JSON.parse(response)
|
33
|
+
case res
|
34
|
+
when Array
|
35
|
+
if res.first.is_a? Hash
|
36
|
+
res.map { |hash| Hashie::Mash.new hash }
|
37
|
+
else
|
38
|
+
res
|
39
|
+
end
|
40
|
+
when Hash
|
41
|
+
Hashie::Mash.new res
|
42
|
+
else
|
43
|
+
res
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Next Big Sound returns some results as hashes with
|
48
|
+
# keys equal to id of the object and values as the
|
49
|
+
# relevant data. This creates an array that includes
|
50
|
+
# the id within the object.
|
51
|
+
def self.idfy(hash)
|
52
|
+
hash.to_a.map do |id, data|
|
53
|
+
data.dup.tap { |d| d.id = id }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module NextBigSoundLite
|
2
|
+
|
3
|
+
class Artist < Resource
|
4
|
+
|
5
|
+
def self.resource
|
6
|
+
super 'artists'
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.find(id)
|
10
|
+
get resource["view/#{id}.json"]
|
11
|
+
end
|
12
|
+
class << self; alias :view :find; end
|
13
|
+
|
14
|
+
def self.search(q)
|
15
|
+
get resource["search.json?q=#{CGI.escape(q)}"] do |response|
|
16
|
+
idfy response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.ranking(type, ids)
|
21
|
+
ids = ids.join('-')
|
22
|
+
get resource["rank/#{type}/#{ids}.json"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.add(name, profiles)
|
26
|
+
params = {
|
27
|
+
:key => NextBigSoundLite.private_key,
|
28
|
+
:name => name,
|
29
|
+
:profiles => profiles
|
30
|
+
}
|
31
|
+
post resource["add.json"], params
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module NextBigSoundLite
|
2
2
|
|
3
3
|
class Genre < Resource
|
4
4
|
|
@@ -7,8 +7,9 @@ module NBS
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.artist(id)
|
10
|
-
|
11
|
-
|
10
|
+
get resource["artist/#{id}.json"] do |response|
|
11
|
+
idfy response
|
12
|
+
end
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module NextBigSoundLite
|
2
|
+
|
3
|
+
class Metric < Resource
|
4
|
+
|
5
|
+
ALLOWED_METRICS = %w(all plays fans views comments downloads likes price)
|
6
|
+
|
7
|
+
def self.resource
|
8
|
+
super 'metrics'
|
9
|
+
end
|
10
|
+
|
11
|
+
# start and end can be either a Date or Time object
|
12
|
+
def self.profile(id, params = {})
|
13
|
+
get resource["profile/#{id}.json?#{querify params}"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.artist(id, params = {})
|
17
|
+
get resource["artist/#{id}.json?#{querify params}"] do |response|
|
18
|
+
response.map do |metric|
|
19
|
+
Hashie::Mash.new Hash[metric.to_a.map { |k,v| [k.downcase, v] }]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def self.querify(params)
|
27
|
+
params[:start] &&= format_time(params[:start])
|
28
|
+
params[:end] &&= format_time(params[:end])
|
29
|
+
params[:metric] = (ALLOWED_METRICS & [params[:metric]]).first
|
30
|
+
params.to_a.map do |k,v|
|
31
|
+
"#{k}=#{CGI.escape(v)}" if !!v
|
32
|
+
end.compact.join("&")
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.format_time(obj)
|
36
|
+
out = case obj
|
37
|
+
when Date
|
38
|
+
Time.local(obj.year, obj.mon, obj.mday)
|
39
|
+
when Time
|
40
|
+
obj
|
41
|
+
else
|
42
|
+
raise ArgumentError, "start/end times need to be Date or Time objects"
|
43
|
+
end
|
44
|
+
out.to_i.to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module NextBigSoundLite
|
2
|
+
|
3
|
+
class Profile < Resource
|
4
|
+
|
5
|
+
def self.resource
|
6
|
+
super 'profiles'
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.artist(id)
|
10
|
+
get resource["artist/#{id}.json"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.search(url)
|
14
|
+
get resource["search.json?u=#{CGI.escape(url)}"] do |response|
|
15
|
+
idfy response
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.add(artist_id, profiles)
|
20
|
+
params = {
|
21
|
+
:key => NextBigSoundLite.private_key,
|
22
|
+
:profiles => profiles
|
23
|
+
}
|
24
|
+
post resource["add/#{artist_id}.json"], params
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "next_big_sound_lite/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "next-big-sound-lite"
|
7
|
+
s.version = NextBigSoundLite::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Roberto Thais"]
|
10
|
+
s.email = ["roberto.thais@gigmaven.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{A small wrapper around the Next Big Sound API}
|
13
|
+
s.description = %q{A small wrapper around the Next Big Sound API}
|
14
|
+
|
15
|
+
s.rubyforge_project = "next-big-sound-lite"
|
16
|
+
|
17
|
+
s.add_dependency "rest-client"
|
18
|
+
s.add_dependency "hashie"
|
19
|
+
s.add_dependency "json"
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: next-big-sound-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
version: 0.2.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Roberto Thais
|
@@ -14,100 +10,93 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-04-22 00:00:00 -04:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
21
17
|
name: rest-client
|
22
18
|
prerelease: false
|
23
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
24
21
|
requirements:
|
25
22
|
- - ">="
|
26
23
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
24
|
version: "0"
|
30
|
-
type: :
|
25
|
+
type: :runtime
|
31
26
|
version_requirements: *id001
|
32
27
|
- !ruby/object:Gem::Dependency
|
33
|
-
name:
|
28
|
+
name: hashie
|
34
29
|
prerelease: false
|
35
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
36
32
|
requirements:
|
37
33
|
- - ">="
|
38
34
|
- !ruby/object:Gem::Version
|
39
|
-
segments:
|
40
|
-
- 0
|
41
35
|
version: "0"
|
42
|
-
type: :
|
36
|
+
type: :runtime
|
43
37
|
version_requirements: *id002
|
44
|
-
|
45
|
-
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: json
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
description: A small wrapper around the Next Big Sound API
|
50
|
+
email:
|
51
|
+
- roberto.thais@gigmaven.com
|
46
52
|
executables: []
|
47
53
|
|
48
54
|
extensions: []
|
49
55
|
|
50
|
-
extra_rdoc_files:
|
51
|
-
|
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
|
56
|
+
extra_rdoc_files: []
|
57
|
+
|
61
58
|
files:
|
62
|
-
-
|
63
|
-
-
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- README.md
|
64
62
|
- Rakefile
|
65
|
-
- init.rb
|
66
63
|
- lib/next-big-sound-lite.rb
|
67
|
-
- lib/
|
68
|
-
- lib/
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
- lib/
|
72
|
-
- lib/
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
-
|
64
|
+
- lib/next_big_sound_lite.rb
|
65
|
+
- lib/next_big_sound_lite/resource.rb
|
66
|
+
- lib/next_big_sound_lite/resources/artist.rb
|
67
|
+
- lib/next_big_sound_lite/resources/genre.rb
|
68
|
+
- lib/next_big_sound_lite/resources/metric.rb
|
69
|
+
- lib/next_big_sound_lite/resources/profile.rb
|
70
|
+
- lib/next_big_sound_lite/resources/service.rb
|
71
|
+
- lib/next_big_sound_lite/version.rb
|
72
|
+
- next_big_sound_lite.gemspec
|
76
73
|
has_rdoc: true
|
77
|
-
homepage:
|
74
|
+
homepage: ""
|
78
75
|
licenses: []
|
79
76
|
|
80
77
|
post_install_message:
|
81
|
-
rdoc_options:
|
82
|
-
|
83
|
-
- --inline-source
|
84
|
-
- --title
|
85
|
-
- Next-big-sound-lite
|
86
|
-
- --main
|
87
|
-
- README.rdoc
|
78
|
+
rdoc_options: []
|
79
|
+
|
88
80
|
require_paths:
|
89
81
|
- lib
|
90
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
91
84
|
requirements:
|
92
85
|
- - ">="
|
93
86
|
- !ruby/object:Gem::Version
|
94
|
-
segments:
|
95
|
-
- 0
|
96
87
|
version: "0"
|
97
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
98
90
|
requirements:
|
99
91
|
- - ">="
|
100
92
|
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
- 1
|
103
|
-
- 2
|
104
|
-
version: "1.2"
|
93
|
+
version: "0"
|
105
94
|
requirements: []
|
106
95
|
|
107
96
|
rubyforge_project: next-big-sound-lite
|
108
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.6.2
|
109
98
|
signing_key:
|
110
99
|
specification_version: 3
|
111
|
-
summary:
|
100
|
+
summary: A small wrapper around the Next Big Sound API
|
112
101
|
test_files: []
|
113
102
|
|
data/Manifest
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Manifest
|
2
|
-
README.rdoc
|
3
|
-
Rakefile
|
4
|
-
init.rb
|
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/README.rdoc
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
== Next Big Sound Lite
|
2
|
-
|
3
|
-
This gem wraps the next big sound JSON api. Read the API docs {here}[http://api.nextbigsound.com].
|
4
|
-
|
5
|
-
Done? Then you can use this API.
|
6
|
-
|
7
|
-
First setup the gem to use your API key:
|
8
|
-
|
9
|
-
NBS.api_key = 'your_key'
|
10
|
-
|
11
|
-
The methods of this wrapper are organized in the same way as the subsections of the API docs. For example to call the endpoint 'view' on Artists you should call:
|
12
|
-
|
13
|
-
NBS::Artist.view(id)
|
14
|
-
|
15
|
-
Notice that the receiver has a singular name (ala Rails Models)
|
16
|
-
|
17
|
-
Another example:
|
18
|
-
|
19
|
-
NBS::Metric.profile(id)
|
20
|
-
|
21
|
-
Would call the Profile endpoint defined under the Metrics subsection. And so on.
|
22
|
-
|
23
|
-
The one gotcha is the rank endpoint on the Artists subsection. It expects a type and an array of ids. E.g.
|
24
|
-
|
25
|
-
NBS::Artist.rank(type, [365, 654, 123])
|
26
|
-
|
27
|
-
All methods return parsed an array or a hash. No effort is made at this point to create objects out of the raw data. This is where 'lite' comes from :)
|
data/init.rb
DELETED
@@ -1,31 +0,0 @@
|
|
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
|
@@ -1,20 +0,0 @@
|
|
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
|
@@ -1,26 +0,0 @@
|
|
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
|
@@ -1,20 +0,0 @@
|
|
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
|
data/next-big-sound-lite.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{next-big-sound-lite}
|
5
|
-
s.version = "0.2.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-11}
|
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", "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
|
-
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
|