dribbble-bucket-api 0.0.5 → 0.0.6

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.
@@ -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
- img_src = shot.css(".dribbble-img img").first["src"]
18
- ext = img_src =~ /\.(jpe?g|png|gif)$/ && $1
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: img_src, ext: ext, url: 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
 
@@ -1,3 +1,3 @@
1
1
  module DribbbleBucketApi
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -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/teaser.jpg"></a>
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dribbble-bucket-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: