link_thumbnailer 1.0.4 → 1.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.
- data/CHANGELOG.md +4 -0
- data/README.md +3 -0
- data/lib/generators/templates/initializer.rb +3 -0
- data/lib/link_thumbnailer.rb +2 -1
- data/lib/link_thumbnailer/fetcher.rb +1 -0
- data/lib/link_thumbnailer/version.rb +1 -1
- data/spec/link_thumbnailer_spec.rb +8 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -143,6 +143,9 @@ In `config/initializers/link_thumbnailer.rb`
|
|
143
143
|
|
144
144
|
# Enable or disable SSL verification
|
145
145
|
# config.verify_ssl = true
|
146
|
+
|
147
|
+
# HTTP open_timeout: The amount of time in seconds to wait for a connection to be opened.
|
148
|
+
# config.http_timeout = 5
|
146
149
|
end
|
147
150
|
|
148
151
|
## Features
|
data/lib/link_thumbnailer.rb
CHANGED
@@ -18,6 +18,7 @@ module LinkThumbnailer
|
|
18
18
|
http = Net::HTTP::Persistent.new('linkthumbnailer')
|
19
19
|
http.headers['User-Agent'] = LinkThumbnailer.configuration.user_agent
|
20
20
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless LinkThumbnailer.configuration.verify_ssl
|
21
|
+
http.open_timeout = LinkThumbnailer.configuration.http_timeout
|
21
22
|
resp = http.request(self.url)
|
22
23
|
case resp
|
23
24
|
when Net::HTTPSuccess; resp.body
|
@@ -29,6 +29,7 @@ describe LinkThumbnailer do
|
|
29
29
|
config.top = 10
|
30
30
|
config.user_agent = 'linkthumbnailer'
|
31
31
|
config.verify_ssl = true
|
32
|
+
config.http_timeout = 5
|
32
33
|
}
|
33
34
|
end
|
34
35
|
|
@@ -45,6 +46,7 @@ describe LinkThumbnailer do
|
|
45
46
|
specify { LinkThumbnailer.configuration.top.should eq(10) }
|
46
47
|
specify { LinkThumbnailer.configuration.user_agent.should eq('linkthumbnailer') }
|
47
48
|
specify { LinkThumbnailer.configuration.verify_ssl.should be_true }
|
49
|
+
specify { LinkThumbnailer.configuration.http_timeout.should eq(5) }
|
48
50
|
|
49
51
|
end
|
50
52
|
|
@@ -68,6 +70,7 @@ describe LinkThumbnailer do
|
|
68
70
|
specify { LinkThumbnailer.configuration.top.should eq(5) }
|
69
71
|
specify { LinkThumbnailer.configuration.user_agent.should eq('linkthumbnailer') }
|
70
72
|
specify { LinkThumbnailer.configuration.verify_ssl.should be_true }
|
73
|
+
specify { LinkThumbnailer.configuration.http_timeout.should eq(5) }
|
71
74
|
|
72
75
|
end
|
73
76
|
|
@@ -117,6 +120,11 @@ describe LinkThumbnailer do
|
|
117
120
|
it "should set verify_ssl option" do
|
118
121
|
expect { LinkThumbnailer.generate('foo', verify_ssl: false).to change(LinkThumbnailer.configuration.verify_ssl).from(true).to(false) }
|
119
122
|
end
|
123
|
+
|
124
|
+
it "should set http_timeout option" do
|
125
|
+
expect { LinkThumbnailer.generate('foo', http_timeout: 2).to change(LinkThumbnailer.configuration.http_timeout).from(5).to(2) }
|
126
|
+
end
|
127
|
+
|
120
128
|
end
|
121
129
|
|
122
130
|
context "when strict" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: link_thumbnailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|