arin-rws 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.
- data/lib/arin-rws/client.rb +18 -7
- metadata +7 -10
data/lib/arin-rws/client.rb
CHANGED
@@ -3,17 +3,28 @@ require 'pp'
|
|
3
3
|
module Arin
|
4
4
|
module RWS
|
5
5
|
class Client
|
6
|
-
|
6
|
+
|
7
|
+
def self.init_http
|
8
|
+
@@http = Net::HTTP.start(Arin::RWS::HOST, Arin::RWS::PORT)
|
9
|
+
@@http.read_timeout=10
|
10
|
+
end
|
11
|
+
self.init_http
|
12
|
+
|
7
13
|
def initialize
|
8
14
|
end
|
9
15
|
|
10
16
|
def self.query(resource)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
tries = 5
|
18
|
+
begin
|
19
|
+
r = @@http.get("#{Arin::RWS::BASE_PATH}/#{resource}")
|
20
|
+
result = JSON.parse(r.body)
|
21
|
+
result
|
22
|
+
rescue EOFError, Errno::ECONNRESET
|
23
|
+
if (tries -= 1) > 0
|
24
|
+
self.init_http
|
25
|
+
retry
|
26
|
+
end
|
27
|
+
end
|
17
28
|
end
|
18
29
|
|
19
30
|
def find_ip(ip)
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arin-rws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Matt Thompson
|
@@ -15,7 +14,8 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2012-
|
17
|
+
date: 2012-08-31 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: ARIN Restful Web Services
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/arin-rws.rb
|
36
36
|
- Rakefile
|
37
37
|
- test/test_arin-rws.rb
|
38
|
+
has_rdoc: true
|
38
39
|
homepage: http://rubygems.org/gems/arin-rws
|
39
40
|
licenses: []
|
40
41
|
|
@@ -44,27 +45,23 @@ rdoc_options: []
|
|
44
45
|
require_paths:
|
45
46
|
- lib
|
46
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
hash: 3
|
52
51
|
segments:
|
53
52
|
- 0
|
54
53
|
version: "0"
|
55
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
55
|
requirements:
|
58
56
|
- - ">="
|
59
57
|
- !ruby/object:Gem::Version
|
60
|
-
hash: 3
|
61
58
|
segments:
|
62
59
|
- 0
|
63
60
|
version: "0"
|
64
61
|
requirements: []
|
65
62
|
|
66
63
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.
|
64
|
+
rubygems_version: 1.3.6
|
68
65
|
signing_key:
|
69
66
|
specification_version: 3
|
70
67
|
summary: Arin-RWS
|