robowhois 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +22 -15
- data/LICENSE.txt +1 -1
- data/README.md +63 -53
- data/lib/robo_whois.rb +3 -3
- data/lib/robo_whois/version.rb +2 -2
- data/lib/robowhois.rb +1 -1
- data/robowhois.gemspec +3 -3
- data/spec/unit/robo_whois_spec.rb +10 -10
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 812e6eb9cc47ceec12a8b39bf63a812d2dca8ec0
|
4
|
+
data.tar.gz: 45bd255e00aec2b65a4ccaf713745754325dd127
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2690fc7d789618593b7474b19dcfa86d5fbc53b64f52733b489619323ac101215f1fab57a2c296ae52a9acd31842c0ad6c9175b0a65a829b1c9a70d9b8fca0eb
|
7
|
+
data.tar.gz: d2bccf0027ee80127a97cb0633925ab06afa200b998f313d5c39c241b64efbf2ed169d671951a344e407fbe7dba164957f3f6b511a8433791fc8a34b594f75a2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,37 +1,44 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
#### Release 0.5.0
|
5
5
|
|
6
|
-
|
6
|
+
- CHANGED: Switched to HTTPs API URI.
|
7
7
|
|
8
|
-
|
8
|
+
- CHANGED: Slightly change user agent to robowhois-ruby/VERSION
|
9
9
|
|
10
10
|
|
11
|
-
|
11
|
+
#### Release 0.4.0
|
12
12
|
|
13
|
-
|
13
|
+
- CHANGED: Relaxed dependencies to other gems
|
14
14
|
|
15
|
-
|
15
|
+
- CHANGED: Removed deprecated #whois_availability method
|
16
16
|
|
17
|
-
* CHANGED: /whois/availability is deprecated.
|
18
17
|
|
18
|
+
#### Release 0.3.0
|
19
19
|
|
20
|
-
|
20
|
+
- ADDED: Support for the new /availability endpoint.
|
21
21
|
|
22
|
-
|
22
|
+
- CHANGED: Switch to versioned endpoint (v1).
|
23
23
|
|
24
|
+
- CHANGED: /whois/availability is deprecated.
|
24
25
|
|
25
|
-
## Release 0.2.1
|
26
26
|
|
27
|
-
|
27
|
+
#### Release 0.2.2
|
28
28
|
|
29
|
+
- CHANGED: Update clients to the new API Errors.
|
29
30
|
|
30
|
-
## Release 0.2.0
|
31
31
|
|
32
|
-
|
32
|
+
#### Release 0.2.1
|
33
33
|
|
34
|
+
- FIXED: Fixed outdated documentation that describes an invalid way to initialize the client.
|
34
35
|
|
35
|
-
## Release 0.1.0
|
36
36
|
|
37
|
-
|
37
|
+
#### Release 0.2.0
|
38
|
+
|
39
|
+
- NEW: Added support for Heroku ROBOWHOIS_API_KEY environment variable
|
40
|
+
|
41
|
+
|
42
|
+
#### Release 0.1.0
|
43
|
+
|
44
|
+
- First release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This is the official Ruby client for [RoboWhois](https://www.robowhois.com/) [API](https://www.robowhois.com/docs/api/).
|
4
4
|
|
5
|
-
[RoboWhois](
|
5
|
+
[RoboWhois](https://www.robowhois.com/) is a web service that provides an API suite to **access WHOIS records and domain related information with a unified, consistent interface**.
|
6
6
|
|
7
7
|
Using RoboWhois API you can:
|
8
8
|
|
@@ -26,7 +26,7 @@ You might need administrator privileges on your system to install the gem.
|
|
26
26
|
## Usage
|
27
27
|
|
28
28
|
All the examples below assume you installed the gem and required it via RubyGems.
|
29
|
-
You also need a [RoboWhois](
|
29
|
+
You also need a [RoboWhois](https://www.robowhois.com/) account and a valid API key.
|
30
30
|
|
31
31
|
require 'robowhois'
|
32
32
|
|
@@ -34,77 +34,87 @@ Please refer to the RoboWhois [API Documentation](https://www.robowhois.com/docs
|
|
34
34
|
|
35
35
|
### Account information
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
```ruby
|
38
|
+
client = RoboWhois.new(:api_key => 'YOUR_API_KEY')
|
39
|
+
account = client.account
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
puts account['email']
|
42
|
+
# => your email
|
43
|
+
puts account['credits_limit']
|
44
|
+
# => available credits
|
45
|
+
```
|
44
46
|
|
45
47
|
### Original WHOIS record
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
```ruby
|
50
|
+
client = RoboWhois.new(:api_key => 'YOUR_API_KEY')
|
51
|
+
response = client.whois('example.com')
|
49
52
|
|
50
|
-
|
51
|
-
|
53
|
+
puts response
|
54
|
+
# => The record String
|
55
|
+
```
|
52
56
|
|
53
57
|
### Parsed WHOIS record
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
59
|
+
```ruby
|
60
|
+
client = RoboWhois.new(:api_key => 'YOUR_API_KEY')
|
61
|
+
response = client.whois_properties('example.com')
|
62
|
+
|
63
|
+
# The record date
|
64
|
+
puts response['daystamp']
|
65
|
+
|
66
|
+
# The record registrant
|
67
|
+
if contact = response['properties']['registrant_contacts']
|
68
|
+
puts contact['id']
|
69
|
+
puts contact['name']
|
70
|
+
puts contact['organization']
|
71
|
+
else
|
72
|
+
puts "Registrant details not available."
|
73
|
+
end
|
74
|
+
|
75
|
+
# The record nameservers
|
76
|
+
response['properties']['nameservers'].each do |nameserver|
|
77
|
+
puts nameserver['name']
|
78
|
+
puts nameserver['ipv4']
|
79
|
+
puts nameserver['ipv6']
|
80
|
+
end
|
81
|
+
```
|
76
82
|
|
77
83
|
### Response Object
|
78
84
|
|
79
85
|
You can access the last response object using the `last_response` method.
|
80
86
|
|
81
|
-
|
82
|
-
|
87
|
+
```ruby
|
88
|
+
client = RoboWhois.new(:api_key => 'YOUR_API_KEY')
|
89
|
+
account = client.account
|
83
90
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
response = client.last_response
|
92
|
+
response.code
|
93
|
+
# => 200
|
94
|
+
response.headers
|
95
|
+
# => { ... }
|
96
|
+
```
|
89
97
|
|
90
98
|
### Errors
|
91
99
|
|
92
100
|
In case of failure, the API call raises a `RoboWhois::APIError` exception.
|
93
101
|
|
94
|
-
|
102
|
+
```ruby
|
103
|
+
client = RoboWhois.new(:api_key => 'YOUR_API_KEY')
|
95
104
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
begin
|
106
|
+
response = client.whois_properties('example.es')
|
107
|
+
rescue => error
|
108
|
+
puts error.code
|
109
|
+
# => "R04"
|
110
|
+
puts error.name
|
111
|
+
# => "WhoisServerOnlyWeb"
|
112
|
+
puts error.status
|
113
|
+
# => 400
|
114
|
+
end
|
115
|
+
```
|
106
116
|
|
107
|
-
Error codes are explained in the [API Errors](https://www.robowhois.com/docs/api/errors/) documentation page.
|
117
|
+
Error codes are explained in the [API Errors](https://www.robowhois.com/docs/api/v1/errors/) documentation page.
|
108
118
|
|
109
119
|
|
110
120
|
## Changelog
|
@@ -115,6 +125,6 @@ See the CHANGELOG.md file for details.
|
|
115
125
|
## License
|
116
126
|
|
117
127
|
Copyright (c) 2012 RoboDomain Inc.
|
118
|
-
Copyright (c) 2012 Aetrion LLC.
|
128
|
+
Copyright (c) 2012-2014 Aetrion LLC.
|
119
129
|
|
120
130
|
This is Free Software distributed under the MIT license.
|
data/lib/robo_whois.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Ruby client for the RoboWhois API.
|
5
5
|
#
|
6
|
-
# Copyright (c) 2012 Aetrion LLC.
|
6
|
+
# Copyright (c) 2012-2014 Aetrion LLC.
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
@@ -39,7 +39,7 @@ class RoboWhois
|
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
-
base_uri "
|
42
|
+
base_uri "https://api.robowhois.com/v1"
|
43
43
|
|
44
44
|
# @return [HTTParty::Response] The response object returned by the last API call.
|
45
45
|
attr_reader :last_response
|
@@ -106,7 +106,7 @@ private
|
|
106
106
|
|
107
107
|
def options(hash = {})
|
108
108
|
hash[:headers] ||= {}
|
109
|
-
hash[:headers]["User-Agent"] = "
|
109
|
+
hash[:headers]["User-Agent"] = "robowhois-ruby/#{VERSION}"
|
110
110
|
hash[:basic_auth] = @auth
|
111
111
|
hash
|
112
112
|
end
|
data/lib/robo_whois/version.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Ruby client for the RoboWhois API.
|
5
5
|
#
|
6
|
-
# Copyright (c) 2012 Aetrion LLC.
|
6
|
+
# Copyright (c) 2012-2014 Aetrion LLC.
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
@@ -12,7 +12,7 @@ class RoboWhois
|
|
12
12
|
# Holds information about library version.
|
13
13
|
module Version
|
14
14
|
MAJOR = 0
|
15
|
-
MINOR =
|
15
|
+
MINOR = 5
|
16
16
|
PATCH = 0
|
17
17
|
BUILD = nil
|
18
18
|
|
data/lib/robowhois.rb
CHANGED
data/robowhois.gemspec
CHANGED
@@ -6,19 +6,19 @@ Gem::Specification.new do |s|
|
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Simone Carletti"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2014-02-26"
|
10
10
|
s.description = "Ruby client for the RoboWhois API."
|
11
11
|
s.email = ["weppos@weppos.net"]
|
12
12
|
s.files = [".gitignore", ".rspec", ".travis.yml", "CHANGELOG.md", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/robo_whois.rb", "lib/robo_whois/version.rb", "lib/robowhois.rb", "robowhois.gemspec", "spec/fixtures/account.dump", "spec/fixtures/availability.dump", "spec/fixtures/commands.sh", "spec/fixtures/error_bad_credentials.dump", "spec/fixtures/error_unauthorized.dump", "spec/fixtures/error_whois_server_only_web.dump", "spec/fixtures/whois.dump", "spec/fixtures/whois_parts.dump", "spec/fixtures/whois_properties.dump", "spec/fixtures/whois_properties_available.dump", "spec/fixtures/whois_properties_registered.dump", "spec/fixtures/whois_record.dump", "spec/spec_helper.rb", "spec/support/fake_request_helpers.rb", "spec/support/helpers.rb", "spec/unit/robo_whois_spec.rb"]
|
13
13
|
s.homepage = "https://github.com/robowhois/robowhois-ruby"
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
16
|
-
s.rubygems_version = "
|
16
|
+
s.rubygems_version = "2.0.14"
|
17
17
|
s.summary = "Ruby client for the RoboWhois API."
|
18
18
|
s.test_files = ["spec/fixtures/account.dump", "spec/fixtures/availability.dump", "spec/fixtures/commands.sh", "spec/fixtures/error_bad_credentials.dump", "spec/fixtures/error_unauthorized.dump", "spec/fixtures/error_whois_server_only_web.dump", "spec/fixtures/whois.dump", "spec/fixtures/whois_parts.dump", "spec/fixtures/whois_properties.dump", "spec/fixtures/whois_properties_available.dump", "spec/fixtures/whois_properties_registered.dump", "spec/fixtures/whois_record.dump", "spec/spec_helper.rb", "spec/support/fake_request_helpers.rb", "spec/support/helpers.rb", "spec/unit/robo_whois_spec.rb"]
|
19
19
|
|
20
20
|
if s.respond_to? :specification_version then
|
21
|
-
s.specification_version =
|
21
|
+
s.specification_version = 4
|
22
22
|
|
23
23
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
24
24
|
s.add_runtime_dependency(%q<httparty>, [">= 0.9"])
|
@@ -36,7 +36,7 @@ describe RoboWhois do
|
|
36
36
|
}
|
37
37
|
|
38
38
|
before do
|
39
|
-
stub_get('
|
39
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/account', 'account')
|
40
40
|
end
|
41
41
|
|
42
42
|
it "sets authentication credentials" do
|
@@ -49,7 +49,7 @@ describe RoboWhois do
|
|
49
49
|
|
50
50
|
it "sets headers" do
|
51
51
|
RoboWhois.should_receive(:get).with('/account', hash_including(:headers => {
|
52
|
-
"User-Agent" => "
|
52
|
+
"User-Agent" => "robowhois-ruby/#{RoboWhois::VERSION}"
|
53
53
|
})).and_return(mock_response)
|
54
54
|
client.account
|
55
55
|
end
|
@@ -57,7 +57,7 @@ describe RoboWhois do
|
|
57
57
|
|
58
58
|
describe "#account" do
|
59
59
|
before do
|
60
|
-
stub_get('
|
60
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/account', 'account')
|
61
61
|
@response = client.account
|
62
62
|
end
|
63
63
|
|
@@ -76,7 +76,7 @@ describe RoboWhois do
|
|
76
76
|
|
77
77
|
describe "#whois" do
|
78
78
|
before do
|
79
|
-
stub_get('
|
79
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/whois/example.com', 'whois')
|
80
80
|
@response = client.whois("example.com")
|
81
81
|
end
|
82
82
|
|
@@ -92,7 +92,7 @@ describe RoboWhois do
|
|
92
92
|
|
93
93
|
describe "#whois_parts" do
|
94
94
|
before do
|
95
|
-
stub_get('
|
95
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/whois/example.com/parts', 'whois_parts')
|
96
96
|
@response = client.whois_parts("example.com")
|
97
97
|
end
|
98
98
|
|
@@ -117,7 +117,7 @@ describe RoboWhois do
|
|
117
117
|
|
118
118
|
describe "#whois_properties" do
|
119
119
|
before do
|
120
|
-
stub_get('
|
120
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/whois/example.com/properties', 'whois_properties')
|
121
121
|
@response = client.whois_properties("example.com")
|
122
122
|
end
|
123
123
|
|
@@ -142,7 +142,7 @@ describe RoboWhois do
|
|
142
142
|
|
143
143
|
describe "#whois_record" do
|
144
144
|
before do
|
145
|
-
stub_get('
|
145
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/whois/example.com/record', 'whois_record')
|
146
146
|
@response = client.whois_record("example.com")
|
147
147
|
end
|
148
148
|
|
@@ -159,7 +159,7 @@ describe RoboWhois do
|
|
159
159
|
|
160
160
|
describe "#availability" do
|
161
161
|
before do
|
162
|
-
stub_get('
|
162
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/availability/example.com', 'availability')
|
163
163
|
@response = client.availability("example.com")
|
164
164
|
end
|
165
165
|
|
@@ -179,7 +179,7 @@ describe RoboWhois do
|
|
179
179
|
let(:client) { client = RoboWhois.new(:api_key => 'BAD_KEY') }
|
180
180
|
|
181
181
|
before do
|
182
|
-
stub_get('
|
182
|
+
stub_get('https://BAD_KEY:X@api.robowhois.com/v1/account', 'error_bad_credentials')
|
183
183
|
end
|
184
184
|
|
185
185
|
it "raises an APIError" do
|
@@ -191,7 +191,7 @@ describe RoboWhois do
|
|
191
191
|
|
192
192
|
describe "ServerWhoisOnlyWeb" do
|
193
193
|
before do
|
194
|
-
stub_get('
|
194
|
+
stub_get('https://API_KEY:X@api.robowhois.com/v1/whois/example.com/record', 'error_whois_server_only_web')
|
195
195
|
end
|
196
196
|
|
197
197
|
it "raises an APIError" do
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robowhois
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Simone Carletti
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: httparty
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0.9'
|
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
|
29
26
|
version: '0.9'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 10.0.0
|
38
34
|
type: :development
|
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
|
45
40
|
version: 10.0.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: yard
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
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
|
61
54
|
version: '0'
|
62
55
|
description: Ruby client for the RoboWhois API.
|
@@ -96,27 +89,26 @@ files:
|
|
96
89
|
- spec/unit/robo_whois_spec.rb
|
97
90
|
homepage: https://github.com/robowhois/robowhois-ruby
|
98
91
|
licenses: []
|
92
|
+
metadata: {}
|
99
93
|
post_install_message:
|
100
94
|
rdoc_options: []
|
101
95
|
require_paths:
|
102
96
|
- lib
|
103
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
-
none: false
|
105
98
|
requirements:
|
106
|
-
- -
|
99
|
+
- - '>='
|
107
100
|
- !ruby/object:Gem::Version
|
108
101
|
version: 1.8.7
|
109
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
103
|
requirements:
|
112
|
-
- -
|
104
|
+
- - '>='
|
113
105
|
- !ruby/object:Gem::Version
|
114
106
|
version: '0'
|
115
107
|
requirements: []
|
116
108
|
rubyforge_project:
|
117
|
-
rubygems_version:
|
109
|
+
rubygems_version: 2.0.14
|
118
110
|
signing_key:
|
119
|
-
specification_version:
|
111
|
+
specification_version: 4
|
120
112
|
summary: Ruby client for the RoboWhois API.
|
121
113
|
test_files:
|
122
114
|
- spec/fixtures/account.dump
|