imagize 0.3.1 → 0.3.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{imagize}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Raymond van Dongelen"]
12
- s.date = %q{2010-11-07}
12
+ s.date = %q{2010-11-18}
13
13
  s.description = %q{Retrieve images from a tweet}
14
14
  s.email = %q{dongelen@nhl.nl}
15
15
  s.extra_rdoc_files = [
@@ -17,10 +17,10 @@ module Imagize
17
17
  :url => "http://youtu.be/",
18
18
  :convert => "http://img.youtube.com/vi/§ID§/0.jpg"
19
19
  },
20
- :youtube_long => {
21
- :url => "http://www.youtube.com/watch",
22
- :convert => "http://img.youtube.com/vi/§ID§/0.jpg"
23
- },
20
+ # :youtube_long => {
21
+ # :url => "http://www.youtube.com/watch",
22
+ # :convert => "http://img.youtube.com/vi/§ID§/0.jpg"
23
+ # },
24
24
  :tweetphoto => {
25
25
  :url => "http://tweetphoto.com/",
26
26
  :convert => "http://tweetphotoapi.com/api/TPAPI.svc/imagefromurl?size=big&url=http://tweetphoto.com/§ID§"
@@ -67,6 +67,7 @@ module Imagize
67
67
 
68
68
  IMAGE_FINDERS = [JPG_FINDER, GIF_FINDER, PNG_FINDER]
69
69
  YOUTUBE_LONG_URL="http://www.youtube.com/watch"
70
+ YOUTUBE_LONG_CONVERT_URL="http://img.youtube.com/vi/§ID§/0.jpg"
70
71
 
71
72
  class Imagizer
72
73
 
@@ -96,8 +97,12 @@ module Imagize
96
97
 
97
98
  # long youtube
98
99
  tweet.scan /#{YOUTUBE_LONG_URL}\?v=\w*/ do |current|
99
- code = current.sub(YOUTUBE_LONG_URL+"?v=", "")
100
- images << make_url (:youtube_long, code)
100
+ p "Current is " + current
101
+ code = current.sub(YOUTUBE_LONG_URL+"?v=", "")
102
+ p code
103
+
104
+ images << make_youtube_url (code)
105
+
101
106
  end
102
107
 
103
108
  IMAGE_FINDERS.each do |finder|
@@ -122,5 +127,8 @@ module Imagize
122
127
  URL_DEFINITIONS[servicename][:convert].gsub "§ID§", code
123
128
  end
124
129
 
130
+ def make_youtube_url (code)
131
+ YOUTUBE_LONG_CONVERT_URL.gsub "§ID§", code
132
+ end
125
133
  end
126
134
  end
@@ -29,14 +29,16 @@ describe "Imagize" do
29
29
 
30
30
  it "should recognize youtube" do
31
31
  urls= @imagizer.imagize("Hallo bnfgjfdgbfd http://youtu.be/B5IgPI9Dc7A?a\n Fiets")
32
- urls.should include("http://img.youtube.com/vi/B5IgPI9Dc7A/0.jpg")
32
+ urls[0].should == "http://img.youtube.com/vi/B5IgPI9Dc7A/0.jpg"
33
33
 
34
34
  urls = @imagizer.imagize("Hallo bnfgjfdgbfd http://www.youtube.com/watch?v=NPahxS10HkY Fiets")
35
- urls.should include("http://img.youtube.com/vi/NPahxS10HkY/0.jpg")
35
+ urls[0].should == "http://img.youtube.com/vi/NPahxS10HkY/0.jpg"
36
36
 
37
37
  urls = @imagizer.imagize("Hallo bnfgjfdgbfd http://www.youtube.com/watch?v=ogZ9WXNNdIc Fiets")
38
- urls.should include("http://img.youtube.com/vi/ogZ9WXNNdIc/0.jpg")
39
-
38
+ urls[0].should == "http://img.youtube.com/vi/ogZ9WXNNdIc/0.jpg"
39
+
40
+ urls = @imagizer.imagize("RT @bartligthart - V0.5 of the hezoo screencast! http://www.youtube.com/watch?v=XGV0rKvtEwc #mtnw #tutorial")
41
+ urls[0].should == "http://img.youtube.com/vi/XGV0rKvtEwc/0.jpg"
40
42
  end
41
43
 
42
44
  it "should recognize tweetphoto" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Raymond van Dongelen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-07 00:00:00 +01:00
17
+ date: 2010-11-18 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency