esgob 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c771929d5f34833c2a7b647e05c11686e0ecd9db
4
+ data.tar.gz: c0c648e1341855edd956c83d29b373e107e8db8e
5
+ SHA512:
6
+ metadata.gz: 6650464bd90d58172139131df815d59f7b8601c9f75cd5a2b214ed9bded0b393e81ff4252e782f03ee10cfce2679a927bcfeba9dd655acb81740269c976a556b
7
+ data.tar.gz: 35b9700a1ec0f86df74720e404ea5ebb5ee08e33ecb0a7885d1f8cb5874d369d68a7af7029dd3e8d4e263259af0b2941c900a862be3e4f2edb3e62b8f484c07e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.1.2"
4
+ - "1.9.3"
5
+ - "1.9.2"
6
+ - "1.8.7"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in esgob.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright (c) Nicholas J Humfrey
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ [![Build Status](https://travis-ci.org/njh/ruby-esgob.svg)](https://travis-ci.org/njh/ruby-esgob)
2
+
3
+ Esgob Ruby Client
4
+ =================
5
+
6
+ [Esgob Ltd] operate an [international network] of anycast servers.
7
+ Their [Secondary DNS] service is available for free.
8
+ This Ruby Gem provides convenient access to the [Esgob API].
9
+
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'esgob'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install esgob
26
+
27
+ ## Usage
28
+
29
+ First create a new client instance, by passing in your account name and API key:
30
+
31
+ esgob = Esgob::Client.new('account', 'key')
32
+
33
+ Alternatively, as it is often desirable to keep secrets outside of the source code, it is also possible to pass in the account name and API key using environment variables set in the shell:
34
+
35
+ export ESGOB_ACCOUNT=accountname
36
+ export ESGOB_API_KEY=4472ed80e0f511e4aee13c0754043581
37
+
38
+ The client instance can then be initialised without passing any arguments:
39
+
40
+ esgob = Esgob::Client.new
41
+
42
+
43
+ Add a new slave domain, passing in the domain and the master DNS server to fetch the zone from:
44
+
45
+ esgob.domains_slaves_add('example.org', '192.168.0.1')
46
+
47
+ Get a list of the registered slave domains:
48
+
49
+ domains = esgob.domains_slaves_list
50
+
51
+ Here is an example of what can be done in an IRB session:
52
+
53
+ $ irb -resgob
54
+ irb(main):001:0> esgob = Esgob::Client.new
55
+ => #<Esgob::Client:0x007fd2e3b13420>
56
+ irb(main):002:0> esgob.domains_slaves_list
57
+ => {"example.com"=>"192.168.0.1", "example.uk"=>"192.168.0.1"}
58
+ irb(main):003:0> esgob.domains_slaves_list.keys
59
+ => ["example.com", "example.uk"]
60
+ irb(main):004:0>
61
+
62
+ See the [API documentation] for full details.
63
+
64
+
65
+ ## More information
66
+
67
+ * https://noc.esgob.com/secondary_dns
68
+ * https://noc.esgob.com/docs/api
69
+
70
+ ## Contributing
71
+
72
+ 1. Fork it ( https://github.com/njh/esgob/fork )
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create a new Pull Request
77
+
78
+
79
+ ## License
80
+
81
+ The esgob ruby gem is licensed under the terms of the MIT license.
82
+ See the file LICENSE for details.
83
+
84
+
85
+ ## Contact
86
+
87
+ * Author: Nicholas J Humfrey
88
+ * Email: njh@aelius.com
89
+ * Twitter: [@njh]
90
+ * Home Page: http://www.aelius.com/njh/
91
+
92
+
93
+ [@njh]: http://twitter.com/njh
94
+
95
+ [Esgob Ltd]: https://www.esgob.com/
96
+ [Esgob API]: https://noc.esgob.com/docs/api
97
+ [international network]: https://noc.esgob.com/status/anycast_instances
98
+ [Secondary DNS]: https://noc.esgob.com/secondary_dns
99
+
100
+ [API documentation]: http://www.rubydoc.info/gems/esgob
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push File.expand_path("./lib", __FILE__)
4
+
5
+ require 'rubygems'
6
+ require 'yard'
7
+ require 'rake/testtask'
8
+ require "bundler/gem_tasks"
9
+
10
+ Rake::TestTask.new do |t|
11
+ t.pattern = "test/*_test.rb"
12
+ end
13
+
14
+ namespace :doc do
15
+ YARD::Rake::YardocTask.new
16
+ end
17
+
18
+ task :default => :test
data/esgob.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'esgob/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "esgob"
8
+ spec.version = Esgob::VERSION
9
+ spec.authors = ["Nicholas Humfrey"]
10
+ spec.email = ["njh@aelius.com"]
11
+ spec.summary = %q{Client library for talking to the Esgob anycast DNS API.}
12
+ #spec.description = %q{TODO: Write a longer description. Optional.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+
22
+ spec.add_dependency "json", "~> 1.8"
23
+
24
+ if Gem.ruby_version > Gem::Version.new('1.9')
25
+ spec.add_development_dependency 'bundler', '>= 1.5.0'
26
+ spec.add_development_dependency 'rake', '>= 0.10.0'
27
+ spec.add_development_dependency 'yard', '>= 0.8.0'
28
+ spec.add_development_dependency 'fakeweb', '~> 1.3.0'
29
+ spec.add_development_dependency 'simplecov'
30
+ elsif Gem.ruby_version > Gem::Version.new('1.8')
31
+ spec.add_development_dependency 'bundler', '>= 1.1.0'
32
+ spec.add_development_dependency 'rake', '~> 0.9.0'
33
+ spec.add_development_dependency 'yard', '~> 0.8.0'
34
+ spec.add_development_dependency 'minitest', '~> 5.5.0'
35
+ spec.add_development_dependency 'fakeweb', '~> 1.3.0'
36
+ else
37
+ raise "#{Gem.ruby_version} is an unsupported version of ruby"
38
+ end
39
+ end
data/lib/esgob.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Esgob
2
+ autoload :Client, 'esgob/client'
3
+ autoload :Version, 'esgob/version'
4
+ end
@@ -0,0 +1,133 @@
1
+ require "net/https"
2
+ require "uri"
3
+ require "json"
4
+
5
+ class Esgob::Client
6
+ attr_accessor :endpoint
7
+ attr_accessor :account
8
+ attr_accessor :api_key
9
+
10
+ DEFAULT_API_ENDPOINT = "https://api.esgob.com/1.0/".freeze
11
+
12
+ def initialize(*args)
13
+ if args.first.kind_of?(Hash)
14
+ args.first.each_pair { |k,v| send("#{k}=", v) }
15
+ else
16
+ self.account = args[0]
17
+ self.api_key = args[1]
18
+ end
19
+
20
+ self.endpoint ||= DEFAULT_API_ENDPOINT
21
+ self.account ||= ENV['ESGOB_ACCOUNT']
22
+ self.api_key ||= ENV['ESGOB_API_KEY']
23
+ end
24
+
25
+ def call(function_name, arguments={})
26
+ uri = URI(endpoint + function_name)
27
+ uri.query = build_query(default_arguments.merge(arguments))
28
+
29
+ res = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
30
+ req = Net::HTTP::Get.new(uri.request_uri)
31
+ req['Accept'] = 'application/json'
32
+ http.request(req)
33
+ end
34
+
35
+ if res.code =~ /^2/
36
+ if res.content_type == 'application/json'
37
+ symbolize_keys! JSON.parse(res.body)
38
+ else
39
+ raise "HTTP response from ESGOB is not of type JSON"
40
+ end
41
+ else
42
+ # The badly named method throws an Net::HTTP exception
43
+ res.value
44
+ end
45
+
46
+ end
47
+
48
+ # Return account status; credit balance, etc
49
+ def accounts_get
50
+ call('accounts.get')
51
+ end
52
+
53
+ # Returns all hosted domains
54
+ def domains_list
55
+ call('domains.list')[:domains]
56
+ end
57
+
58
+ # Returns all hosted slave domains as a hash
59
+ #
60
+ def domains_slaves_list
61
+ Hash[
62
+ call('domains.slaves.list')[:domains].map do |item|
63
+ [item[:domain], item[:masterip]]
64
+ end
65
+ ]
66
+ end
67
+
68
+ # Adds a new slave domain
69
+ def domains_slaves_add(domain, masterip)
70
+ call('domains.slaves.add', :domain => domain, :masterip => masterip)
71
+ end
72
+
73
+ # Deletes a slave domain
74
+ def domains_slaves_delete(domain)
75
+ call('domains.slaves.delete', :domain => domain)
76
+ end
77
+
78
+ # Force AXFR / transfer from master of a slave domain
79
+ def domains_slaves_forcetransfer(domain)
80
+ call('domains.slaves.forcetransfer', :domain => domain)
81
+ end
82
+
83
+ # Updates the master IP of a slave domain
84
+ def domains_slaves_updatemasterip(domain, masterip)
85
+ call('domains.slaves.updatemasterip', :domain => domain, :masterip => masterip)
86
+ end
87
+
88
+ # Add a host allowed to AXFR out
89
+ def domains_slaves_axfrout_add(domain, axfrip)
90
+ call('domains.slaves.axfrout.add', :domain => domain, :axfrip => axfrip)
91
+ end
92
+
93
+ # Account Delete a host allowed to AXFR out
94
+ def domains_slaves_axfrout_delete(domain, axfrip)
95
+ call('domains.slaves.axfrout.delete', :domain => domain, :axfrip => axfrip)
96
+ end
97
+
98
+ # Retrieve the domain SOA serial number from the master and each anycast node
99
+ def domains_tools_soacheck(domain)
100
+ call('domains.tools.soacheck', :domain => domain)
101
+ end
102
+
103
+
104
+ protected
105
+
106
+ def symbolize_keys!(hash)
107
+ hash.keys.each do |key|
108
+ ks = key.to_sym
109
+ hash[ks] = hash.delete(key)
110
+ case hash[ks]
111
+ when Hash
112
+ symbolize_keys!(hash[ks])
113
+ when Array
114
+ hash[ks].each {|item| symbolize_keys!(item) if item.kind_of?(Hash)}
115
+ end
116
+ end
117
+ return hash
118
+ end
119
+
120
+ def default_arguments
121
+ {
122
+ :account => account,
123
+ :key => api_key,
124
+ :f => 'json'
125
+ }
126
+ end
127
+
128
+ def build_query(hash)
129
+ hash.keys.sort{|a,b| a.to_s <=> b.to_s}.map { |key|
130
+ URI::escape(key.to_s) + '=' + URI::escape(hash[key].to_s)
131
+ }.join('&')
132
+ end
133
+ end
@@ -0,0 +1,3 @@
1
+ module Esgob
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,228 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'test_helper'
4
+ require 'esgob'
5
+
6
+ class TestClient < MiniTest::Unit::TestCase
7
+ def setup
8
+ # Run before each test
9
+ FakeWeb.clean_registry
10
+ @client = Esgob::Client.new('acct', 'xxxx')
11
+ end
12
+
13
+ def teardown
14
+ # Reset environment variables after each test
15
+ ENV.delete('ESGOB_ACCOUNT')
16
+ ENV.delete('ESGOB_API_KEY')
17
+ end
18
+
19
+ def test_new_client_using_environment
20
+ ENV['ESGOB_ACCOUNT'] = 'envacct'
21
+ ENV['ESGOB_API_KEY'] = 'envkey'
22
+
23
+ client = Esgob::Client.new
24
+ assert_equal 'envacct', client.account
25
+ assert_equal 'envkey', client.api_key
26
+ assert_equal 'https://api.esgob.com/1.0/', client.endpoint
27
+ end
28
+
29
+ def test_new_client_using_arguments
30
+ client = Esgob::Client.new('foobar', 'mykey')
31
+ assert_equal 'foobar', client.account
32
+ assert_equal 'mykey', client.api_key
33
+ assert_equal 'https://api.esgob.com/1.0/', client.endpoint
34
+ end
35
+
36
+ def test_new_client_using_hash
37
+ client = Esgob::Client.new(
38
+ :account => 'hashacct',
39
+ :api_key => 'hashkey',
40
+ :endpoint => 'http://api.example.com/'
41
+ )
42
+ assert_equal 'hashacct', client.account
43
+ assert_equal 'hashkey', client.api_key
44
+ assert_equal 'http://api.example.com/', client.endpoint
45
+ end
46
+
47
+ def test_call_with_no_parameters
48
+ register_fixture('accounts.get')
49
+ response = @client.call('accounts.get')
50
+
51
+ assert_equal(
52
+ '/1.0/accounts.get?account=acct&f=json&key=xxxx',
53
+ FakeWeb.last_request.path
54
+ )
55
+ assert_equal(
56
+ {:credits=>48, :users=>[], :added=>1422792434, :id=>"xyz", :name=>"Person Name"},
57
+ response
58
+ )
59
+ end
60
+
61
+ def test_call_with_extra_params
62
+ register_fixture('accounts.get')
63
+ response = @client.call('accounts.get', :foo => :bar)
64
+
65
+ assert_equal(
66
+ '/1.0/accounts.get?account=acct&f=json&foo=bar&key=xxxx',
67
+ FakeWeb.last_request.path
68
+ )
69
+ end
70
+
71
+ def test_call_with_overriding_params
72
+ register_fixture('accounts.get')
73
+ response = @client.call('accounts.get', :account => 'acct2')
74
+
75
+ assert_equal(
76
+ '/1.0/accounts.get?account=acct2&f=json&key=xxxx',
77
+ FakeWeb.last_request.path
78
+ )
79
+ end
80
+
81
+ def test_call_with_404_error
82
+ assert_raises(Net::HTTPServerException) do
83
+ FakeWeb.register_uri(
84
+ :get, %r[^https?://api\.esgob\.com(:443)?/],
85
+ :status => ["404", "Not Found"],
86
+ :content_type => "application/json",
87
+ :body => '{}'
88
+ )
89
+ response = @client.call('accounts.get')
90
+ end
91
+ end
92
+
93
+ def test_call_with_non_json_reponse
94
+ assert_raises(RuntimeError) do
95
+ FakeWeb.register_uri(
96
+ :get, %r[^https?://api\.esgob\.com(:443)?/],
97
+ :status => ["200", "OK"],
98
+ :content_type => "text/plain",
99
+ :body => 'This is plain text'
100
+ )
101
+ response = @client.call('accounts.get')
102
+ end
103
+ end
104
+
105
+ def test_accounts_get
106
+ register_fixture('accounts.get')
107
+ response = @client.accounts_get
108
+
109
+ assert_equal(
110
+ '/1.0/accounts.get?account=acct&f=json&key=xxxx',
111
+ FakeWeb.last_request.path
112
+ )
113
+ assert_equal(
114
+ {:credits=>48, :users=>[], :added=>1422792434, :id=>"xyz", :name=>"Person Name"},
115
+ response
116
+ )
117
+ end
118
+
119
+ def test_domains_list
120
+ register_fixture('domains.list')
121
+ response = @client.domains_list
122
+
123
+ assert_equal(
124
+ '/1.0/domains.list?account=acct&f=json&key=xxxx',
125
+ FakeWeb.last_request.path
126
+ )
127
+ assert_equal(
128
+ [
129
+ {:domain => "example.com", :type => "slave"},
130
+ {:domain => "example.uk", :type => "slave"}
131
+ ],
132
+ response
133
+ )
134
+ end
135
+
136
+ def test_domains_slaves_list
137
+ register_fixture('domains.slaves.list')
138
+ response = @client.domains_slaves_list
139
+
140
+ assert_equal(
141
+ '/1.0/domains.slaves.list?account=acct&f=json&key=xxxx',
142
+ FakeWeb.last_request.path
143
+ )
144
+ assert_equal(
145
+ {"example.com"=>"195.177.253.166", "example.uk"=>"195.177.253.166"},
146
+ response
147
+ )
148
+ end
149
+
150
+ def test_domains_slaves_add
151
+ register_fixture('domains.slaves.add')
152
+ response = @client.domains_slaves_add('example.org', '195.177.253.166')
153
+
154
+ assert_equal(
155
+ '/1.0/domains.slaves.add?account=acct&domain=example.org&f=json&key=xxxx&masterip=195.177.253.166',
156
+ FakeWeb.last_request.path
157
+ )
158
+ assert_equal({:action=>"domain added"}, response)
159
+ end
160
+
161
+ def test_domains_slaves_delete
162
+ register_fixture('domains.slaves.delete')
163
+ response = @client.domains_slaves_delete('example.org')
164
+
165
+ assert_equal(
166
+ '/1.0/domains.slaves.delete?account=acct&domain=example.org&f=json&key=xxxx',
167
+ FakeWeb.last_request.path
168
+ )
169
+ assert_equal({:action=>"domain deleted"}, response)
170
+ end
171
+
172
+ def test_domains_slaves_forcetransfer
173
+ register_fixture('domains.slaves.forcetransfer')
174
+ response = @client.domains_slaves_forcetransfer('example.org')
175
+
176
+ assert_equal(
177
+ '/1.0/domains.slaves.forcetransfer?account=acct&domain=example.org&f=json&key=xxxx',
178
+ FakeWeb.last_request.path
179
+ )
180
+ assert_equal({:action=>"Domain AXFR requested from master"}, response)
181
+ end
182
+
183
+ def test_domains_slaves_updatemasterip
184
+ register_fixture('domains.slaves.updatemasterip')
185
+ response = @client.domains_slaves_updatemasterip('example.org', '195.177.253.167')
186
+
187
+ assert_equal(
188
+ '/1.0/domains.slaves.updatemasterip?account=acct&domain=example.org&f=json&key=xxxx&masterip=195.177.253.167',
189
+ FakeWeb.last_request.path
190
+ )
191
+ assert_equal({:action=>"domain master IP updated"}, response)
192
+ end
193
+
194
+ def test_domains_slaves_axfrout_add
195
+ register_fixture('domains.slaves.axfrout.add')
196
+ response = @client.domains_slaves_axfrout_add('example.org', '195.177.253.1')
197
+
198
+ assert_equal(
199
+ '/1.0/domains.slaves.axfrout.add?account=acct&axfrip=195.177.253.1&domain=example.org&f=json&key=xxxx',
200
+ FakeWeb.last_request.path
201
+ )
202
+ assert_equal({:action=>"domain AXFR out IPs updated"}, response)
203
+ end
204
+
205
+ def test_domains_slaves_axfrout_delete
206
+ register_fixture('domains.slaves.axfrout.delete')
207
+ response = @client.domains_slaves_axfrout_delete('example.org', '195.177.253.1')
208
+
209
+ assert_equal(
210
+ '/1.0/domains.slaves.axfrout.delete?account=acct&axfrip=195.177.253.1&domain=example.org&f=json&key=xxxx',
211
+ FakeWeb.last_request.path
212
+ )
213
+ assert_equal({:action=>"domain AXFR out IPs updated"}, response)
214
+ end
215
+
216
+ def test_domains_tools_soacheck
217
+ register_fixture('domains.tools.soacheck')
218
+ response = @client.domains_tools_soacheck('example.org')
219
+
220
+ assert_equal(
221
+ '/1.0/domains.tools.soacheck?account=acct&domain=example.org&f=json&key=xxxx',
222
+ FakeWeb.last_request.path
223
+ )
224
+ assert_equal('example.org', response[:domain])
225
+ refute_empty(response[:responses])
226
+ end
227
+
228
+ end
@@ -0,0 +1,14 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
+ require 'test_helper'
4
+ require 'esgob'
5
+
6
+ class TestVersion < MiniTest::Unit::TestCase
7
+
8
+ def test_version_number_looks_sensible
9
+ assert_equal 'constant', defined?(Esgob::VERSION)
10
+ assert_kind_of String, Esgob::VERSION
11
+ assert_match /^\d{1,2}\.\d{1,2}\.\d{1,2}$/, Esgob::VERSION
12
+ end
13
+
14
+ end
@@ -0,0 +1,7 @@
1
+ {
2
+ "credits": 48,
3
+ "users": [],
4
+ "added": 1422792434,
5
+ "id": "xyz",
6
+ "name": "Person Name"
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "domains": [
3
+ {
4
+ "domain": "example.com",
5
+ "type": "slave"
6
+ },
7
+ {
8
+ "domain": "example.uk",
9
+ "type": "slave"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "action": "domain added"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "action": "domain AXFR out IPs updated"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "action": "domain AXFR out IPs updated"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "action": "domain deleted"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "action": "Domain AXFR requested from master"
3
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "domains": [
3
+ {
4
+ "domain": "example.com",
5
+ "type": "slave",
6
+ "masterip": "195.177.253.166"
7
+ },
8
+ {
9
+ "domain": "example.uk",
10
+ "type": "slave",
11
+ "masterip": "195.177.253.166"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "action": "domain master IP updated"
3
+ }
@@ -0,0 +1,185 @@
1
+ {
2
+ "domain": "example.org",
3
+ "responses": {
4
+ "masters": [
5
+ {
6
+ "soa": null,
7
+ "ip": "195.177.253.167",
8
+ "response": "fail"
9
+ }
10
+ ],
11
+ "anycastnodes": [
12
+ {
13
+ "soa": null,
14
+ "country": "dk",
15
+ "ref": "b767bbde",
16
+ "location": "Denmark, Copenhagen",
17
+ "response": "fail"
18
+ },
19
+ {
20
+ "soa": null,
21
+ "country": "ie",
22
+ "ref": "a5829255",
23
+ "location": "Dublin, Ireland",
24
+ "response": "fail"
25
+ },
26
+ {
27
+ "soa": null,
28
+ "country": "gb",
29
+ "ref": "3b3ba18c",
30
+ "location": "England, Fareham",
31
+ "response": "fail"
32
+ },
33
+ {
34
+ "soa": null,
35
+ "country": "gb",
36
+ "ref": "pw77xk42",
37
+ "location": "England, Hemel Hempstead",
38
+ "response": "fail"
39
+ },
40
+ {
41
+ "soa": null,
42
+ "country": "gb",
43
+ "ref": "b0r2k2c4",
44
+ "location": "England, London, A",
45
+ "response": "fail"
46
+ },
47
+ {
48
+ "soa": null,
49
+ "country": "gb",
50
+ "ref": "ql7f823b",
51
+ "location": "England, London, B",
52
+ "response": "fail"
53
+ },
54
+ {
55
+ "soa": null,
56
+ "country": "gb",
57
+ "ref": "a645b1b8",
58
+ "location": "England, Studley",
59
+ "response": "fail"
60
+ },
61
+ {
62
+ "soa": null,
63
+ "country": "de",
64
+ "ref": "zeij3q25",
65
+ "location": "Germany, Bremen",
66
+ "response": "fail"
67
+ },
68
+ {
69
+ "soa": null,
70
+ "country": "gb",
71
+ "ref": "a9a9aa41",
72
+ "location": "London, England, D",
73
+ "response": "fail"
74
+ },
75
+ {
76
+ "soa": null,
77
+ "country": "us",
78
+ "ref": "eeedd3pp",
79
+ "location": "Los Angeles, US",
80
+ "response": "fail"
81
+ },
82
+ {
83
+ "soa": null,
84
+ "country": "nl",
85
+ "ref": "5cf4cc31",
86
+ "location": "Netherlands, Amsterdam",
87
+ "response": "fail"
88
+ },
89
+ {
90
+ "soa": null,
91
+ "country": "gb",
92
+ "ref": "4f31ad80",
93
+ "location": "Northern Ireland, Belfast",
94
+ "response": "fail"
95
+ },
96
+ {
97
+ "soa": null,
98
+ "country": "is",
99
+ "ref": "2be59c70",
100
+ "location": "Reykjavik, Iceland",
101
+ "response": "fail"
102
+ },
103
+ {
104
+ "soa": null,
105
+ "country": "is",
106
+ "ref": "5a235000",
107
+ "location": "Reykjavik, Iceland (RIX)",
108
+ "response": "fail"
109
+ },
110
+ {
111
+ "soa": null,
112
+ "country": "gb",
113
+ "ref": "oeo8uewk",
114
+ "location": "Scotland, Edinburgh",
115
+ "response": "fail"
116
+ },
117
+ {
118
+ "soa": null,
119
+ "country": "sg",
120
+ "ref": "a4fd893c",
121
+ "location": "Singapore",
122
+ "response": "fail"
123
+ },
124
+ {
125
+ "soa": null,
126
+ "country": "au",
127
+ "ref": "1277c255",
128
+ "location": "Sydney, Australia",
129
+ "response": "fail"
130
+ },
131
+ {
132
+ "soa": null,
133
+ "country": "ru",
134
+ "ref": "a661cda4",
135
+ "location": "Ulyanovsk, Russia (ULN-IX)",
136
+ "response": "fail"
137
+ },
138
+ {
139
+ "soa": null,
140
+ "country": "us",
141
+ "ref": "h1m9maf8",
142
+ "location": "United States, Boston",
143
+ "response": "fail"
144
+ },
145
+ {
146
+ "soa": null,
147
+ "country": "us",
148
+ "ref": "fgej72a1",
149
+ "location": "United States, Detroit",
150
+ "response": "fail"
151
+ },
152
+ {
153
+ "soa": null,
154
+ "country": "at",
155
+ "ref": "dc6aaec4",
156
+ "location": "Vienna, Austria",
157
+ "response": "fail"
158
+ },
159
+ {
160
+ "soa": null,
161
+ "country": "pl",
162
+ "ref": "60c64eb3",
163
+ "location": "Warsaw, Poland",
164
+ "response": "fail"
165
+ }
166
+ ],
167
+ "axfrnodes": [
168
+ {
169
+ "soa": null,
170
+ "ref": "1cd05e5d",
171
+ "response": "fail"
172
+ }
173
+ ]
174
+ },
175
+ "cached": false,
176
+ "timestamp": 1428774478,
177
+ "analysis": {
178
+ "mastersok": true,
179
+ "consistent": true,
180
+ "earliest": null,
181
+ "nodesok": false,
182
+ "latest": null
183
+ },
184
+ "cachefor": 60
185
+ }
@@ -0,0 +1,28 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__),'..','lib'))
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ Bundler.require(:default, :development)
6
+ require 'minitest/autorun'
7
+
8
+ unless RUBY_VERSION =~ /^1\.8/
9
+ SimpleCov.start
10
+ end
11
+
12
+ FakeWeb.allow_net_connect = false
13
+
14
+
15
+ def register_fixture(api_call, fixture_name=nil)
16
+ if fixture_name.nil?
17
+ fixture_name = api_call.gsub(/\W+/, '_')
18
+ end
19
+
20
+ fixture_file = File.join(File.dirname(__FILE__), 'fixtures', fixture_name + '.json')
21
+
22
+ FakeWeb.register_uri(
23
+ :get, %r[^https?://api\.esgob\.com(:443)?/1.0/#{api_call}],
24
+ :status => ["200", "OK"],
25
+ :content_type => "application/json",
26
+ :body => File.read(fixture_file)
27
+ )
28
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: esgob
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nicholas Humfrey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.5.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.5.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: fakeweb
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.3.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - njh@aelius.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".travis.yml"
106
+ - Gemfile
107
+ - LICENSE.md
108
+ - README.md
109
+ - Rakefile
110
+ - esgob.gemspec
111
+ - lib/esgob.rb
112
+ - lib/esgob/client.rb
113
+ - lib/esgob/version.rb
114
+ - test/esgob_client_test.rb
115
+ - test/esgob_version_test.rb
116
+ - test/fixtures/accounts_get.json
117
+ - test/fixtures/domains_list.json
118
+ - test/fixtures/domains_slaves_add.json
119
+ - test/fixtures/domains_slaves_axfrout_add.json
120
+ - test/fixtures/domains_slaves_axfrout_delete.json
121
+ - test/fixtures/domains_slaves_delete.json
122
+ - test/fixtures/domains_slaves_forcetransfer.json
123
+ - test/fixtures/domains_slaves_list.json
124
+ - test/fixtures/domains_slaves_updatemasterip.json
125
+ - test/fixtures/domains_tools_soacheck.json
126
+ - test/test_helper.rb
127
+ homepage: ''
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.2.2
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Client library for talking to the Esgob anycast DNS API.
151
+ test_files:
152
+ - test/esgob_client_test.rb
153
+ - test/esgob_version_test.rb
154
+ - test/fixtures/accounts_get.json
155
+ - test/fixtures/domains_list.json
156
+ - test/fixtures/domains_slaves_add.json
157
+ - test/fixtures/domains_slaves_axfrout_add.json
158
+ - test/fixtures/domains_slaves_axfrout_delete.json
159
+ - test/fixtures/domains_slaves_delete.json
160
+ - test/fixtures/domains_slaves_forcetransfer.json
161
+ - test/fixtures/domains_slaves_list.json
162
+ - test/fixtures/domains_slaves_updatemasterip.json
163
+ - test/fixtures/domains_tools_soacheck.json
164
+ - test/test_helper.rb
165
+ has_rdoc: