1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
%w(rubygems hpricot open-uri).each{|r| require r}
module Kuler
def rating
query(:rating)
end
def recent
query(:recent)
end
def popular
query(:popular)
end
def query(q)
uri = "http://kuler.adobe.com/kuler/API/rss/get.cfm?listtype=#{q.to_s}&readerType=public"
hp = Hpricot.parse open(uri)
string = (hp/:item/:description).first.to_s
if string =~ /Hex:(.*)<\/description\>/m
$1.strip.split(', ')
end
end
end
|