dribbble-bucket-api 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,9 +15,10 @@ module DribbbleBucketApi
|
|
15
15
|
# parse shot data from HTML
|
16
16
|
id = shot["id"] =~ /^screenshot\-(\d+)$/ && $1.to_i
|
17
17
|
img_src = shot.css(".dribbble-img img").first["src"]
|
18
|
+
ext = img_src =~ /\.(jpe?g|png|gif)$/ && $1
|
18
19
|
url = "http://dribbble.com" + shot.css("a.dribbble-link").first["href"]
|
19
20
|
# pass data into shot object
|
20
|
-
Shot.new(id: id, image_teaser_url: img_src, url: url)
|
21
|
+
Shot.new(id: id, image_teaser_url: img_src, ext: ext, url: url)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -26,7 +26,7 @@ describe DribbbleBucketApi::ShotIndexParser do
|
|
26
26
|
<div class="dribbble">
|
27
27
|
<div class="dribbble-shot">
|
28
28
|
<div class="dribbble-img">
|
29
|
-
<a href="/shots/693929-Alternate-Timeline" class="dribbble-link"><img alt="
|
29
|
+
<a href="/shots/693929-Alternate-Timeline" class="dribbble-link"><img alt="teaser" src="http://dribbble.s3.amazonaws.com/users/2935/screenshots/693929/teaser.jpg"></a>
|
30
30
|
<a href="/shots/693929-Alternate-Timeline" class="dribbble-over">
|
31
31
|
<strong>Alternate Timeline</strong>
|
32
32
|
<em>August 19, 2012</em>
|
@@ -71,6 +71,11 @@ describe DribbbleBucketApi::ShotIndexParser do
|
|
71
71
|
ids = subject.shots.map(&:id)
|
72
72
|
expect(ids).to eq [693587, 693929]
|
73
73
|
end
|
74
|
+
|
75
|
+
it "should parse the extensions correctly" do
|
76
|
+
ids = subject.shots.map(&:ext)
|
77
|
+
expect(ids).to eq ["png", "jpg"]
|
78
|
+
end
|
74
79
|
end
|
75
80
|
|
76
81
|
describe "#current_page" do
|