gandirb 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -1
- data/README.rdoc +4 -4
- data/lib/gandi/domain/zone/record.rb +41 -0
- data/lib/gandi/domain/zone/version.rb +32 -0
- data/lib/gandi/domain/zone.rb +100 -0
- data/lib/gandi/domain.rb +2 -1
- data/lib/gandi/operation.rb +8 -0
- data/lib/gandi/version.rb +1 -1
- data/spec/gandi/domain/zone/record_spec.rb +73 -0
- data/spec/gandi/domain/zone/version_spec.rb +46 -0
- data/spec/gandi/domain/zone_spec.rb +186 -0
- data/spec/support/domain_macros.rb +33 -0
- metadata +17 -8
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -22,12 +22,12 @@ Detailed RDoc documentation for each method is available using `rake rdoc`.
|
|
22
22
|
|
23
23
|
== TODO
|
24
24
|
|
25
|
-
*
|
25
|
+
* Add missing methods and classes (packmail, webredir...)
|
26
|
+
* Abstract the multiple fetches (with the 'pending' states) for Domain.available
|
26
27
|
* Refactor the Operation object creation from the other classes
|
27
|
-
*
|
28
|
-
* Refactor the Contact class to match the other classes behaviour (instances of the class should only match existing records)
|
29
|
-
* Make the Domain/Contact/etc. classes more ActiveModel-like
|
28
|
+
* Refactor the object classes to ensure consistent behaviour (starting with the Contact class) : use hashes with class method and object with instance methods
|
30
29
|
* Better handling of failures and server exceptions, and overall stricter params checking
|
30
|
+
* More tests
|
31
31
|
|
32
32
|
== Copyright
|
33
33
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Gandi
|
2
|
+
class Domain
|
3
|
+
class Zone
|
4
|
+
class Record
|
5
|
+
extend Gandi::Connector
|
6
|
+
|
7
|
+
class << self
|
8
|
+
#Add a new record to zone/version.
|
9
|
+
#Return a Record hash.
|
10
|
+
def add(zone_id, version_id, record)
|
11
|
+
call('domain.zone.record.add', zone_id, version_id, record)
|
12
|
+
end
|
13
|
+
|
14
|
+
#Count number of records for a given zone/version.
|
15
|
+
def count(zone_id, version_id)
|
16
|
+
call('domain.zone.record.count', zone_id, version_id)
|
17
|
+
end
|
18
|
+
|
19
|
+
#Remove some records from a zone/version, filters are the same as for list.
|
20
|
+
#Return the number of records deleted.
|
21
|
+
def delete(zone_id, version_id, filters = {})
|
22
|
+
call('domain.zone.record.delete', zone_id, version_id, filters)
|
23
|
+
end
|
24
|
+
|
25
|
+
#List a zone’s records, with an optional filter.
|
26
|
+
#Return an array of record hashes.
|
27
|
+
def list(zone_id, version_id, filters = {})
|
28
|
+
call('domain.zone.record.list', zone_id, version_id, filters = {})
|
29
|
+
end
|
30
|
+
|
31
|
+
#Sets the records for a zone/version.
|
32
|
+
#Return an array of record hashes.
|
33
|
+
def set(zone_id, version_id, records)
|
34
|
+
call('domain.zone.record.set', zone_id, version_id, records)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Gandi
|
2
|
+
class Domain
|
3
|
+
class Zone
|
4
|
+
class Version
|
5
|
+
extend Gandi::Connector
|
6
|
+
|
7
|
+
class << self
|
8
|
+
#Delete a specific version.
|
9
|
+
#Return true.
|
10
|
+
def delete(zone_id, version_id)
|
11
|
+
call('domain.zone.version.delete', zone_id, version_id)
|
12
|
+
end
|
13
|
+
|
14
|
+
#New version from another version. This will duplicate the version’s records.
|
15
|
+
#Note that cloned records will have new identifiers.
|
16
|
+
#Return the created version number.
|
17
|
+
#NOTE: This method is called new in the XML-RPC, API, and has been named create here to avoid conflicts with Ruby's initialize method
|
18
|
+
def create(zone_id, version_id = 0)
|
19
|
+
call('domain.zone.version.new', zone_id, version_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
#Sets the active zone version.
|
23
|
+
#Return true.
|
24
|
+
def set(zone_id, version_id)
|
25
|
+
call('domain.zone.version.set', zone_id, version_id)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'gandi/domain/zone/record'
|
2
|
+
require 'gandi/domain/zone/version'
|
3
|
+
|
4
|
+
module Gandi
|
5
|
+
class Domain
|
6
|
+
class Zone
|
7
|
+
include Gandi::GandiObjectMethods
|
8
|
+
|
9
|
+
#The zone_id of the Zone
|
10
|
+
attr_reader :id
|
11
|
+
|
12
|
+
def initialize(attributes)
|
13
|
+
set_attributes attributes
|
14
|
+
end
|
15
|
+
|
16
|
+
#Clone a zone and its records from a given version.
|
17
|
+
#Return the created Gandi::Domain::Zone object.
|
18
|
+
def clone(version_id = 0, params = {})
|
19
|
+
self.class.new(self.class.clone(@id, version_id, params))
|
20
|
+
end
|
21
|
+
|
22
|
+
#Delete the zone.
|
23
|
+
#Return true.
|
24
|
+
def delete
|
25
|
+
self.class.delete(@id)
|
26
|
+
end
|
27
|
+
|
28
|
+
#Update a zone.
|
29
|
+
#Return self.
|
30
|
+
def update(params)
|
31
|
+
set_attributes self.class.update(@id, params)
|
32
|
+
self
|
33
|
+
end
|
34
|
+
|
35
|
+
class << self
|
36
|
+
#Create a zone.
|
37
|
+
#Return a Gandi::Domain::Zone object.
|
38
|
+
def create(params)
|
39
|
+
new(call('domain.zone.create', params))
|
40
|
+
end
|
41
|
+
|
42
|
+
#Return the zone identified by its zone_id
|
43
|
+
def find(zone_id)
|
44
|
+
new(call('domain.zone.info', zone_id))
|
45
|
+
end
|
46
|
+
|
47
|
+
#Fetch the zone information for the zone identified by its zone_id.
|
48
|
+
#Return a hash.
|
49
|
+
def info(zone_id)
|
50
|
+
call('domain.zone.info', zone_id)
|
51
|
+
end
|
52
|
+
|
53
|
+
#Count the zones.
|
54
|
+
def count(opts = {})
|
55
|
+
call('domain.zone.count', opts)
|
56
|
+
end
|
57
|
+
|
58
|
+
#List zones.
|
59
|
+
#Return an array of hashes.
|
60
|
+
def list(opts = {})
|
61
|
+
call('domain.zone.list', opts)
|
62
|
+
end
|
63
|
+
|
64
|
+
#Clone a zone and its records from a given version.
|
65
|
+
#This create a new zone that will only contain this version.
|
66
|
+
#Note that cloned records will have new identifiers.
|
67
|
+
#Return a hash with the new zone information.
|
68
|
+
def clone(zone_id, version_id = 0, params = {})
|
69
|
+
call('domain.zone.clone', zone_id, version_id, params)
|
70
|
+
end
|
71
|
+
|
72
|
+
#Deletes a zone if not linked to any domain
|
73
|
+
#Warning: this also deletes all versions and records.
|
74
|
+
#Return true.
|
75
|
+
def delete(zone_id)
|
76
|
+
call('domain.zone.delete', zone_id)
|
77
|
+
end
|
78
|
+
|
79
|
+
#Change the current zone of a domain.
|
80
|
+
#Return a hash with the modified domain
|
81
|
+
def set(domain, zone_id)
|
82
|
+
call('domain.zone.set', domain, zone_id)
|
83
|
+
end
|
84
|
+
|
85
|
+
#Update an existing zone.
|
86
|
+
#Return the updated information hash.
|
87
|
+
def update(zone_id, params)
|
88
|
+
call('domain.zone.update', zone_id, params)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def set_attributes(attributes)
|
95
|
+
@attributes = attributes
|
96
|
+
@id = attributes['id']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/lib/gandi/domain.rb
CHANGED
@@ -8,6 +8,7 @@ require 'gandi/domain/nameservers'
|
|
8
8
|
require 'gandi/domain/host'
|
9
9
|
require 'gandi/domain/mailbox'
|
10
10
|
require 'gandi/domain/forward'
|
11
|
+
require 'gandi/domain/zone'
|
11
12
|
|
12
13
|
module Gandi
|
13
14
|
class Domain
|
@@ -56,7 +57,7 @@ module Gandi
|
|
56
57
|
end
|
57
58
|
|
58
59
|
#Create a domain with the given information.
|
59
|
-
#Returns a Gandi::
|
60
|
+
#Returns a Gandi::Operation object.
|
60
61
|
def create(fqdn, params)
|
61
62
|
operation_hash = call('domain.create', fqdn, params)
|
62
63
|
Gandi::Operation.new(operation_hash['id'], operation_hash)
|
data/lib/gandi/operation.rb
CHANGED
@@ -16,6 +16,14 @@ module Gandi
|
|
16
16
|
self.class.call('operation.info', @id)
|
17
17
|
end
|
18
18
|
|
19
|
+
##TODO utility method to check if the operation has finished running
|
20
|
+
#def finished?
|
21
|
+
#end
|
22
|
+
|
23
|
+
##TODO use ActiveSupport::StringInquirer
|
24
|
+
#def step
|
25
|
+
#end
|
26
|
+
|
19
27
|
#Set the step of an operation to CANCEL.
|
20
28
|
def cancel
|
21
29
|
result = self.class.call('operation.cancel', @id)
|
data/lib/gandi/version.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gandi'
|
3
|
+
|
4
|
+
describe Gandi::Domain::Zone::Record do
|
5
|
+
let(:zone_id) { 42 }
|
6
|
+
let(:version_id) { 7 }
|
7
|
+
|
8
|
+
before do
|
9
|
+
@connection_mock = double()
|
10
|
+
::Gandi.connection = @connection_mock
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '.add' do
|
14
|
+
let(:record_creation_attributes) { domain_zone_record_creation_attributes }
|
15
|
+
let(:record_attributes) { record_creation_attributes.merge('id' => 42) }
|
16
|
+
|
17
|
+
before do
|
18
|
+
@connection_mock.should_receive(:call).with('domain.zone.record.add', zone_id, version_id, record_creation_attributes).and_return(record_attributes)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns a record hash" do
|
22
|
+
record = Gandi::Domain::Zone::Record.add(zone_id, version_id, record_creation_attributes)
|
23
|
+
record.should == record_attributes
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '.count' do
|
28
|
+
before do
|
29
|
+
@connection_mock.should_receive(:call).with('domain.zone.record.count', zone_id, version_id).and_return(55)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns an integer" do
|
33
|
+
Gandi::Domain::Zone::Record.count(zone_id, version_id).should == 55
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.delete' do
|
38
|
+
before do
|
39
|
+
@connection_mock.should_receive(:call).with('domain.zone.record.delete', zone_id, version_id, {}).and_return(12)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns an integer" do
|
43
|
+
Gandi::Domain::Zone::Record.delete(zone_id, version_id).should == 12
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '.list' do
|
48
|
+
let(:records_list) { [domain_zone_record_attributes, domain_zone_record_attributes('id' => 2), domain_zone_record_attributes('id' => 3)] }
|
49
|
+
|
50
|
+
before do
|
51
|
+
@connection_mock.should_receive(:call).with('domain.zone.record.list', zone_id, version_id, {}).and_return(records_list)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "returns an array of hashes" do
|
55
|
+
Gandi::Domain::Zone::Record.list(zone_id, version_id).should == records_list
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '.set' do
|
60
|
+
let(:records_creation_list) { [domain_zone_record_creation_attributes, domain_zone_record_creation_attributes] }
|
61
|
+
let(:records_list) { [domain_zone_record_attributes, domain_zone_record_attributes('id' => 2)] }
|
62
|
+
|
63
|
+
before do
|
64
|
+
@connection_mock.should_receive(:call).with('domain.zone.record.set', zone_id, version_id, records_creation_list).and_return(records_list)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "returns a domain hash" do
|
68
|
+
records_hash = Gandi::Domain::Zone::Record.set(zone_id, version_id, records_creation_list)
|
69
|
+
records_hash.should == records_list
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gandi'
|
3
|
+
|
4
|
+
describe Gandi::Domain::Zone::Version do
|
5
|
+
let(:zone_id) { 42 }
|
6
|
+
|
7
|
+
before do
|
8
|
+
@connection_mock = double()
|
9
|
+
::Gandi.connection = @connection_mock
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '.delete' do
|
13
|
+
let(:version_id) { 42 }
|
14
|
+
|
15
|
+
before do
|
16
|
+
@connection_mock.should_receive(:call).with('domain.zone.version.delete', zone_id, version_id).and_return(true)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns true" do
|
20
|
+
Gandi::Domain::Zone::Version.delete(zone_id, version_id).should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.create' do
|
25
|
+
before do
|
26
|
+
@connection_mock.should_receive(:call).with('domain.zone.version.new', zone_id, 0).and_return(11)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns the new version" do
|
30
|
+
Gandi::Domain::Zone::Version.create(zone_id).should == 11
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.set' do
|
35
|
+
let(:version_id) { 23 }
|
36
|
+
|
37
|
+
before do
|
38
|
+
@connection_mock.should_receive(:call).with('domain.zone.version.set', zone_id, version_id).and_return(true)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "returns true" do
|
42
|
+
Gandi::Domain::Zone::Version.set(zone_id, version_id).should be_true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gandi'
|
3
|
+
|
4
|
+
describe Gandi::Domain::Zone do
|
5
|
+
let(:fqdn) { 'domain1.tld' }
|
6
|
+
|
7
|
+
before do
|
8
|
+
@connection_mock = double()
|
9
|
+
::Gandi.connection = @connection_mock
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '.list' do
|
13
|
+
let(:domain_zones_list) { [domain_zone_list_attributes, domain_zone_list_attributes('name' => '2nd zone', 'id' => 2)] }
|
14
|
+
|
15
|
+
before do
|
16
|
+
@connection_mock.should_receive(:call).with('domain.zone.list', {}).and_return(domain_zones_list)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns an array of hashes" do
|
20
|
+
Gandi::Domain::Zone.list.should == domain_zones_list
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.count' do
|
25
|
+
before do
|
26
|
+
@connection_mock.should_receive(:call).with('domain.zone.count', {}).and_return(42)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns an integer" do
|
30
|
+
Gandi::Domain::Zone.count.should == 42
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '.create' do
|
35
|
+
let(:zone_name) { "My new Zone" }
|
36
|
+
let(:domain_zone_attributes) { domain_zone_info_attributes }
|
37
|
+
|
38
|
+
before do
|
39
|
+
@connection_mock.should_receive(:call).with('domain.zone.create', zone_name).and_return(domain_zone_attributes)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns a Zone object" do
|
43
|
+
zone = Gandi::Domain::Zone.create(zone_name)
|
44
|
+
zone.should be_a(Gandi::Domain::Zone)
|
45
|
+
zone.id.should == domain_zone_attributes['id']
|
46
|
+
zone.to_hash.should == domain_zone_attributes
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '.info' do
|
51
|
+
let(:zone_id) { 42 }
|
52
|
+
let(:domain_zone_attributes) { domain_zone_info_attributes('id' => zone_id) }
|
53
|
+
|
54
|
+
before do
|
55
|
+
@connection_mock.should_receive(:call).with('domain.zone.info', zone_id).and_return(domain_zone_attributes)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "returns a hash" do
|
59
|
+
Gandi::Domain::Zone.info(zone_id).should == domain_zone_attributes
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '.find' do
|
64
|
+
let(:zone_id) { 42 }
|
65
|
+
let(:domain_zone_attributes) { domain_zone_info_attributes('id' => zone_id) }
|
66
|
+
|
67
|
+
before do
|
68
|
+
@connection_mock.should_receive(:call).with('domain.zone.info', zone_id).and_return(domain_zone_attributes)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "returns a Zone object" do
|
72
|
+
zone = Gandi::Domain::Zone.find(zone_id)
|
73
|
+
zone.should be_a(Gandi::Domain::Zone)
|
74
|
+
zone.id.should == domain_zone_attributes['id']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '.clone' do
|
79
|
+
let(:zone_id) { 42 }
|
80
|
+
let(:new_zone_id) { 43 }
|
81
|
+
let(:zone_attributes) { domain_zone_info_attributes('id' => new_zone_id) }
|
82
|
+
|
83
|
+
before do
|
84
|
+
@connection_mock.should_receive(:call).with('domain.zone.clone', zone_id, 0, {}).and_return(zone_attributes)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "returns a hash" do
|
88
|
+
zone = Gandi::Domain::Zone.clone(zone_id)
|
89
|
+
zone['id'].should == new_zone_id
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '.delete' do
|
94
|
+
let(:zone_id) { 42 }
|
95
|
+
|
96
|
+
before do
|
97
|
+
@connection_mock.should_receive(:call).with('domain.zone.delete', zone_id).and_return(true)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "returns an integer" do
|
101
|
+
Gandi::Domain::Zone.delete(zone_id).should be_true
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '.set' do
|
106
|
+
let(:zone_id) { 42 }
|
107
|
+
let(:domain_attributes) { domain_information_attributes_hash('fqdn' => fqdn, zone_id => zone_id) }
|
108
|
+
|
109
|
+
before do
|
110
|
+
@connection_mock.should_receive(:call).with('domain.zone.set', fqdn, zone_id).and_return(domain_attributes)
|
111
|
+
end
|
112
|
+
|
113
|
+
it "returns a domain hash" do
|
114
|
+
domain_hash = Gandi::Domain::Zone.set(fqdn, zone_id)
|
115
|
+
domain_hash.should == domain_attributes
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '.update' do
|
120
|
+
let(:zone_id) { 42 }
|
121
|
+
let(:zone_attributes) { domain_zone_info_attributes('id' => zone_id) }
|
122
|
+
let(:zone_params) { {'name' => "New Name"} }
|
123
|
+
|
124
|
+
before do
|
125
|
+
@connection_mock.should_receive(:call).with('domain.zone.update', zone_id, zone_params).and_return(zone_attributes.merge(zone_params))
|
126
|
+
end
|
127
|
+
|
128
|
+
it "returns a Zone hash" do
|
129
|
+
zone_hash = Gandi::Domain::Zone.update(zone_id, zone_params)
|
130
|
+
zone_hash['name'].should == "New Name"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'given an instance' do
|
135
|
+
let(:zone_id) { 42 }
|
136
|
+
let(:zone_attributes) { domain_zone_info_attributes('id' => zone_id) }
|
137
|
+
let(:zone) { Gandi::Domain::Zone.new(zone_attributes) }
|
138
|
+
|
139
|
+
subject { zone }
|
140
|
+
|
141
|
+
it "can read its attributes" do
|
142
|
+
subject.to_hash.should == zone_attributes
|
143
|
+
subject['id'].should == zone_attributes['id']
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '#delete' do
|
147
|
+
before do
|
148
|
+
@connection_mock.should_receive(:call).with('domain.zone.delete', zone_id).and_return(true)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "returns true" do
|
152
|
+
subject.delete.should be_true
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe '#update' do
|
157
|
+
let(:zone_update_params) { {'name' => "New Name"} }
|
158
|
+
|
159
|
+
before do
|
160
|
+
@connection_mock.should_receive(:call).with('domain.zone.update', zone_id, zone_update_params).and_return(zone_attributes.merge(zone_update_params))
|
161
|
+
end
|
162
|
+
|
163
|
+
it "returns self" do
|
164
|
+
subject.update(zone_update_params).should == subject
|
165
|
+
end
|
166
|
+
|
167
|
+
it "updates its attributes" do
|
168
|
+
subject.update(zone_update_params)
|
169
|
+
subject['name'].should == zone_update_params['name']
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '#clone' do
|
174
|
+
before do
|
175
|
+
@connection_mock.should_receive(:call).with('domain.zone.clone', zone_id, 0, {}).and_return(zone_attributes.merge('id' => 44, 'name' => "Gandi Zone (1)"))
|
176
|
+
end
|
177
|
+
|
178
|
+
it "returns a Zone object" do
|
179
|
+
cloned_zone = subject.clone
|
180
|
+
cloned_zone.should be_a(Gandi::Domain::Zone)
|
181
|
+
cloned_zone['name'].should == "Gandi Zone (1)"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|
@@ -96,6 +96,39 @@ module DomainMacros
|
|
96
96
|
def domain_forward_attributes(source, destinations = ['john.doe@domain.tld', 'jane.doe@domain2.tld'])
|
97
97
|
{'source' => source, 'destinations' => destinations}
|
98
98
|
end
|
99
|
+
|
100
|
+
def domain_zone_list_attributes(ext_attrs = {})
|
101
|
+
year, month, day, hour, min, sec = 1970, 1, 1, 1, 1, 1
|
102
|
+
{
|
103
|
+
"date_updated"=> XMLRPC::DateTime.new(year, month, day, hour, min, sec),
|
104
|
+
"version"=>1,
|
105
|
+
"id"=>1,
|
106
|
+
"name"=>"Gandi Zone"
|
107
|
+
}.merge(ext_attrs)
|
108
|
+
end
|
109
|
+
|
110
|
+
def domain_zone_info_attributes(ext_attrs = {})
|
111
|
+
year, month, day, hour, min, sec = 1970, 1, 1, 1, 1, 1
|
112
|
+
{
|
113
|
+
"date_updated"=> XMLRPC::DateTime.new(year, month, day, hour, min, sec),
|
114
|
+
"versions"=>[1],
|
115
|
+
"version"=>1,
|
116
|
+
"domains" => 0,
|
117
|
+
"id"=>1,
|
118
|
+
"owner" => "BACKEND1-GANDI",
|
119
|
+
"name"=>"Gandi Zone"
|
120
|
+
}.merge(ext_attrs)
|
121
|
+
end
|
122
|
+
|
123
|
+
def domain_zone_record_creation_attributes(ext_attrs = {})
|
124
|
+
{
|
125
|
+
"name"=>"@", "type"=>"A", "value"=>"127.0.0.1", "ttl"=>10800
|
126
|
+
}.merge(ext_attrs)
|
127
|
+
end
|
128
|
+
|
129
|
+
def domain_zone_record_attributes(ext_attrs = {})
|
130
|
+
domain_zone_record_creation_attributes('id' => 1).merge(ext_attrs)
|
131
|
+
end
|
99
132
|
end
|
100
133
|
|
101
134
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gandirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &74003420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *74003420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &74003150 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *74003150
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &74002840 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.8'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *74002840
|
47
47
|
description: ! " A Ruby library for using the Gandi XML-RPC API.\n At the moment
|
48
48
|
support is planned for the Domain, Contact and Operation APIs only, but Hosting
|
49
49
|
and Catalog APIs support may be added in the future.\n"
|
@@ -63,8 +63,11 @@ files:
|
|
63
63
|
- Rakefile
|
64
64
|
- gandirb.gemspec
|
65
65
|
- lib/gandi/contact.rb
|
66
|
+
- lib/gandi/domain/zone/record.rb
|
67
|
+
- lib/gandi/domain/zone/version.rb
|
66
68
|
- lib/gandi/domain/forward.rb
|
67
69
|
- lib/gandi/domain/nameservers.rb
|
70
|
+
- lib/gandi/domain/zone.rb
|
68
71
|
- lib/gandi/domain/transferin.rb
|
69
72
|
- lib/gandi/domain/tld.rb
|
70
73
|
- lib/gandi/domain/mailbox.rb
|
@@ -82,7 +85,10 @@ files:
|
|
82
85
|
- spec/gandi/gandi_spec.rb
|
83
86
|
- spec/gandi/connection_spec.rb
|
84
87
|
- spec/gandi/operation_spec.rb
|
88
|
+
- spec/gandi/domain/zone/version_spec.rb
|
89
|
+
- spec/gandi/domain/zone/record_spec.rb
|
85
90
|
- spec/gandi/domain/mailbox_spec.rb
|
91
|
+
- spec/gandi/domain/zone_spec.rb
|
86
92
|
- spec/gandi/domain/forward_spec.rb
|
87
93
|
- spec/gandi/domain/host_spec.rb
|
88
94
|
- spec/gandi/domain/tld_spec.rb
|
@@ -127,7 +133,10 @@ test_files:
|
|
127
133
|
- spec/gandi/gandi_spec.rb
|
128
134
|
- spec/gandi/connection_spec.rb
|
129
135
|
- spec/gandi/operation_spec.rb
|
136
|
+
- spec/gandi/domain/zone/version_spec.rb
|
137
|
+
- spec/gandi/domain/zone/record_spec.rb
|
130
138
|
- spec/gandi/domain/mailbox_spec.rb
|
139
|
+
- spec/gandi/domain/zone_spec.rb
|
131
140
|
- spec/gandi/domain/forward_spec.rb
|
132
141
|
- spec/gandi/domain/host_spec.rb
|
133
142
|
- spec/gandi/domain/tld_spec.rb
|