dribbble-bucket-api 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -14,11 +14,12 @@ module DribbbleBucketApi
|
|
14
14
|
@shots ||= document.css(".dribbbles > li").map do |shot|
|
15
15
|
# parse shot data from HTML
|
16
16
|
id = shot["id"] =~ /^screenshot\-(\d+)$/ && $1.to_i
|
17
|
-
|
18
|
-
|
17
|
+
image_teaser_url = shot.css(".dribbble-img img").first["src"]
|
18
|
+
image_url = image_teaser_url.gsub(/\_teaser\.(jpe?g|png|gif)$/, '.\1')
|
19
|
+
ext = image_teaser_url =~ /\.(jpe?g|png|gif)$/ && $1
|
19
20
|
url = "http://dribbble.com" + shot.css("a.dribbble-link").first["href"]
|
20
21
|
# pass data into shot object
|
21
|
-
Shot.new(id: id, image_teaser_url:
|
22
|
+
Shot.new(id: id, image_teaser_url: image_teaser_url, image_url: image_url, ext: ext, url: url)
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -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="teaser" src="http://dribbble.s3.amazonaws.com/users/2935/screenshots/693929/
|
29
|
+
<a href="/shots/693929-Alternate-Timeline" class="dribbble-link"><img alt="teaser" src="http://dribbble.s3.amazonaws.com/users/2935/screenshots/693929/something_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>
|
@@ -76,6 +76,11 @@ describe DribbbleBucketApi::ShotIndexParser do
|
|
76
76
|
ids = subject.shots.map(&:ext)
|
77
77
|
expect(ids).to eq ["png", "jpg"]
|
78
78
|
end
|
79
|
+
|
80
|
+
it "should parse the image urls correctly" do
|
81
|
+
ids = subject.shots.map(&:image_url)
|
82
|
+
expect(ids).to eq ["http://dribbble.s3.amazonaws.com/users/2935/screenshots/693587/screen_shot_2012-08-18_at_6.41.47_pm.png", "http://dribbble.s3.amazonaws.com/users/2935/screenshots/693929/something.jpg"]
|
83
|
+
end
|
79
84
|
end
|
80
85
|
|
81
86
|
describe "#current_page" do
|