thornbed 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/thornbed/providers/imgur.rb +5 -11
- data/lib/thornbed/version.rb +1 -1
- data/spec/providers/imgur_spec.rb +9 -6
- metadata +7 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: def99e7141f5bdc118f2c513f166ceaa4ad9dcbc
|
4
|
+
data.tar.gz: c7ba4aab5bc6d450413414231f8ab48c51f17fc7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cb8371adc6f86b8334cf03c106336ceddd11e23c6eb398b187d29e654dd1646cad358430d59ebd262c0418a02f37731fdbd84eda789b57f27279ec611f17bf6a
|
7
|
+
data.tar.gz: e5c8ef5cad532fea0c987f242d4c2bb6c08a4276028908058e4f8cc784c551be267c2dd13b72994f72b467cd05b8d28015ad8642be3aad2753e45c881d1530c8
|
@@ -19,21 +19,15 @@ module Thornbed::Providers
|
|
19
19
|
# first get the pseudo id
|
20
20
|
md = pattern.match(url)
|
21
21
|
pid = md[:pid]
|
22
|
-
# TODO: improve this code
|
23
|
-
if pid.length > 5
|
24
|
-
pid = pid.gsub(/(h|m|l|s)?$/, '')
|
25
|
-
end
|
26
|
-
raise Thornbed::NotValid, url if not pid
|
27
|
-
|
28
|
-
res = HTTParty.get("http://imgur.com/#{pid}?tags", headers: {"User-Agent" => USER_AGENT})
|
29
22
|
|
30
|
-
#
|
31
|
-
|
32
|
-
|
23
|
+
# from Alan Schaaf, Founder & CEO, Imgur.com
|
24
|
+
# If the image ID is 6 or 8 characters then it's a thumbnail.
|
25
|
+
if [6,8].include? pid.size
|
26
|
+
pid = pid[0...-1]
|
27
|
+
end
|
33
28
|
|
34
29
|
raise Thornbed::NotValid, url if not pid
|
35
30
|
|
36
|
-
md = /id\=\"direct\"[ ]+value\=\"http:\/\/i.imgur.com\/\w+(?<ptype>\.jpg|\.jpeg|\.png|\.gif)/.match(res.body)
|
37
31
|
ptype = md[:ptype] || ".jpg"
|
38
32
|
|
39
33
|
{
|
data/lib/thornbed/version.rb
CHANGED
@@ -30,10 +30,10 @@ describe "Imgur" do
|
|
30
30
|
res.should include(url: 'http://i.imgur.com/A0TP9.jpg')
|
31
31
|
|
32
32
|
res = imgur.get('http://i.imgur.com/A0TP9.png')
|
33
|
-
res.should include(url: 'http://i.imgur.com/A0TP9.
|
33
|
+
res.should include(url: 'http://i.imgur.com/A0TP9.png')
|
34
34
|
|
35
35
|
res = imgur.get('http://i.imgur.com/A0TP9.gif')
|
36
|
-
res.should include(url: 'http://i.imgur.com/A0TP9.
|
36
|
+
res.should include(url: 'http://i.imgur.com/A0TP9.gif')
|
37
37
|
|
38
38
|
res = imgur.get('http://i.imgur.com/A0TP9.jpg')
|
39
39
|
res.should include(url: 'http://i.imgur.com/A0TP9.jpg')
|
@@ -54,17 +54,20 @@ describe "Imgur" do
|
|
54
54
|
res.should include(url: 'http://i.imgur.com/A0TP9.jpg')
|
55
55
|
|
56
56
|
res = imgur.get('http://www.imgur.com/RUUuR.jpeg')
|
57
|
-
res.should include(url: 'http://i.imgur.com/RUUuR.
|
57
|
+
res.should include(url: 'http://i.imgur.com/RUUuR.jpeg')
|
58
58
|
|
59
59
|
res = imgur.get('http://imgur.com/LcbbCHv')
|
60
|
-
res.should include(url: 'http://i.imgur.com/LcbbCHv.
|
60
|
+
res.should include(url: 'http://i.imgur.com/LcbbCHv.jpg')
|
61
61
|
|
62
62
|
res = imgur.get('http://i.imgur.com/LcbbCHvs.jpg')
|
63
|
-
res.should include(url: 'http://i.imgur.com/LcbbCHv.
|
63
|
+
res.should include(url: 'http://i.imgur.com/LcbbCHv.jpg')
|
64
64
|
|
65
65
|
res = imgur.get('http://imgur.com/0TczaPb')
|
66
66
|
res.should include(url: 'http://i.imgur.com/0TczaPb.jpg')
|
67
67
|
|
68
|
+
res = imgur.get('http://i.imgur.com/xQdLBoVl.jpg')
|
69
|
+
res.should include(url: 'http://i.imgur.com/xQdLBoV.jpg')
|
70
|
+
|
68
71
|
lambda { imgur.get('http://imgur.com/none') }.should raise_error(Thornbed::NotValid)
|
69
72
|
lambda { imgur.get('http://imgur.com/none.jpg') }.should raise_error(Thornbed::NotValid)
|
70
73
|
lambda { imgur.get('http://imgur.com/a/pq0N2') }.should raise_error(Thornbed::NotValid)
|
@@ -72,7 +75,7 @@ describe "Imgur" do
|
|
72
75
|
|
73
76
|
it "should discover Imgur provider" do
|
74
77
|
res = Thornbed.get('http://imgur.com/N2IDN')
|
75
|
-
res.should include(url: 'http://i.imgur.com/N2IDN.
|
78
|
+
res.should include(url: 'http://i.imgur.com/N2IDN.jpg')
|
76
79
|
res.should include(provider_name: "Imgur")
|
77
80
|
end
|
78
81
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thornbed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Esteban (Eka) Feldman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ruby-oembed
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: httparty
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: guard-rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rb-fsevent
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: terminal-notifier-guard
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: fakeweb
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ~>
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: rake
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ~>
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,7 +118,6 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ~>
|
140
123
|
- !ruby/object:Gem::Version
|
@@ -174,33 +157,26 @@ files:
|
|
174
157
|
- thornbed.gemspec
|
175
158
|
homepage: https://github.com/eka/thornbed/
|
176
159
|
licenses: []
|
160
|
+
metadata: {}
|
177
161
|
post_install_message:
|
178
162
|
rdoc_options: []
|
179
163
|
require_paths:
|
180
164
|
- lib
|
181
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
-
none: false
|
183
166
|
requirements:
|
184
|
-
- -
|
167
|
+
- - '>='
|
185
168
|
- !ruby/object:Gem::Version
|
186
169
|
version: '0'
|
187
|
-
segments:
|
188
|
-
- 0
|
189
|
-
hash: 2668191655535075852
|
190
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
171
|
requirements:
|
193
|
-
- -
|
172
|
+
- - '>='
|
194
173
|
- !ruby/object:Gem::Version
|
195
174
|
version: '0'
|
196
|
-
segments:
|
197
|
-
- 0
|
198
|
-
hash: 2668191655535075852
|
199
175
|
requirements: []
|
200
176
|
rubyforge_project:
|
201
|
-
rubygems_version:
|
177
|
+
rubygems_version: 2.0.1
|
202
178
|
signing_key:
|
203
|
-
specification_version:
|
179
|
+
specification_version: 4
|
204
180
|
summary: Thornbed provides a single interface to get embeddable content from many
|
205
181
|
sites, even sites with no OEmbed support.
|
206
182
|
test_files:
|