dribbble-bucket-api 0.0.4 → 0.0.5

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.
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module DribbbleBucketApi
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
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="Screen_shot_2012-08-18_at_6" src="http://dribbble.s3.amazonaws.com/users/2935/screenshots/693929/screen_shot_2012-08-18_at_6.41.38_pm_teaser.png"></a>
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
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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: