notu 0.3.1 → 1.0.0
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.
- checksums.yaml +4 -4
- data/README.mdown +1 -1
- data/VERSION +1 -1
- data/lib/notu.rb +7 -0
- data/lib/notu/http_download.rb +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a454ce547a7385eecde5164c61b73749f23830c
|
4
|
+
data.tar.gz: 868d17c3848dec1824a410379ccd64d712c7094b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b0e9ceb28673985ff7db6b1a25dd9f46aa3696966aaae0b36d8444a3ec1bcb6aa45f782a94d1484112a97ac65e89e2072ebf10246eb2a380e50434534fd5c48
|
7
|
+
data.tar.gz: 486f6c3b1aa4795052548bf4ff11dc90b45711f1637f440fb455d39213425dfd37ceb0635224e743a79a55d5f33fa6b61698d73e87f15630e6236318cbca3bed
|
data/README.mdown
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/notu.rb
CHANGED
data/lib/notu/http_download.rb
CHANGED
@@ -4,7 +4,8 @@ module Notu
|
|
4
4
|
|
5
5
|
def self.get(url, options = {})
|
6
6
|
uri = url.is_a?(URI) ? url : URI.parse(url)
|
7
|
-
raise "Invalid URL: #{url.inspect}" unless uri.is_a?(URI::HTTP)
|
7
|
+
raise Error.new("Invalid URL: #{url.inspect}") unless uri.is_a?(URI::HTTP)
|
8
|
+
Notu.logger.debug('Notu') { "GET #{url}" }
|
8
9
|
options.reverse_merge!(max_redirects: 10, timeout: 10, max_retries: 3, retry_sleep: 2)
|
9
10
|
connection = Net::HTTP.new(uri.host, uri.port)
|
10
11
|
connection.open_timeout = options[:timeout]
|
@@ -18,7 +19,7 @@ module Notu
|
|
18
19
|
begin
|
19
20
|
response.value # raise if not success
|
20
21
|
rescue Net::HTTPRetriableError
|
21
|
-
raise 'Max redirects has been reached' if options[:max_redirects] < 1
|
22
|
+
raise NetworkError.new('Max redirects has been reached') if options[:max_redirects] < 1
|
22
23
|
options[:max_redirects] -= 1
|
23
24
|
return get(response['Location'], options)
|
24
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project: notu
|
232
|
-
rubygems_version: 2.5.
|
232
|
+
rubygems_version: 2.5.2
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: API for Last.fm
|