gandi_v5 0.6.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +81 -5
  3. data/README.md +65 -14
  4. data/lib/gandi_v5.rb +139 -70
  5. data/lib/gandi_v5/billing/info/prepaid.rb +1 -0
  6. data/lib/gandi_v5/data.rb +3 -2
  7. data/lib/gandi_v5/data/converter.rb +3 -2
  8. data/lib/gandi_v5/data/converter/array_of.rb +3 -2
  9. data/lib/gandi_v5/data/converter/integer.rb +3 -2
  10. data/lib/gandi_v5/data/converter/symbol.rb +3 -2
  11. data/lib/gandi_v5/data/converter/time.rb +3 -2
  12. data/lib/gandi_v5/domain.rb +55 -18
  13. data/lib/gandi_v5/domain/availability/product/period.rb +1 -1
  14. data/lib/gandi_v5/domain/contact.rb +5 -5
  15. data/lib/gandi_v5/domain/tld.rb +2 -2
  16. data/lib/gandi_v5/domain/transfer_in.rb +172 -0
  17. data/lib/gandi_v5/domain/transfer_in/availability.rb +51 -0
  18. data/lib/gandi_v5/domain/web_forwarding.rb +182 -0
  19. data/lib/gandi_v5/email.rb +3 -0
  20. data/lib/gandi_v5/email/forward.rb +3 -9
  21. data/lib/gandi_v5/email/mailbox.rb +5 -11
  22. data/lib/gandi_v5/error/gandi_error.rb +1 -0
  23. data/lib/gandi_v5/live_dns.rb +2 -12
  24. data/lib/gandi_v5/live_dns/domain.rb +340 -29
  25. data/lib/gandi_v5/live_dns/domain/dnssec_key.rb +120 -0
  26. data/lib/gandi_v5/live_dns/domain/record.rb +81 -0
  27. data/lib/gandi_v5/live_dns/domain/snapshot.rb +111 -0
  28. data/lib/gandi_v5/live_dns/domain/tsig_key.rb +74 -0
  29. data/lib/gandi_v5/sharing_space.rb +27 -0
  30. data/lib/gandi_v5/simple_hosting.rb +13 -0
  31. data/lib/gandi_v5/simple_hosting/instance.rb +251 -0
  32. data/lib/gandi_v5/simple_hosting/instance/application.rb +45 -0
  33. data/lib/gandi_v5/simple_hosting/instance/database.rb +20 -0
  34. data/lib/gandi_v5/simple_hosting/instance/language.rb +22 -0
  35. data/lib/gandi_v5/simple_hosting/instance/upgrade.rb +22 -0
  36. data/lib/gandi_v5/simple_hosting/instance/virtual_host.rb +272 -0
  37. data/lib/gandi_v5/simple_hosting/instance/virtual_host/linked_dns_zone.rb +75 -0
  38. data/lib/gandi_v5/template.rb +271 -0
  39. data/lib/gandi_v5/template/dispatch.rb +109 -0
  40. data/lib/gandi_v5/template/payload.rb +64 -0
  41. data/lib/gandi_v5/template/payload/dns_record.rb +23 -0
  42. data/lib/gandi_v5/template/payload/web_forwarding.rb +82 -0
  43. data/lib/gandi_v5/version.rb +1 -1
  44. data/spec/.rubocop.yml +9 -9
  45. data/spec/features/list_domain_renewals_spec.rb +16 -0
  46. data/spec/features/list_email_addresses_spec.rb +39 -0
  47. data/spec/fixtures/bodies/GandiV5_Domain_TransferIn/fetch.yml +21 -0
  48. data/spec/fixtures/bodies/GandiV5_Domain_TransferIn_Availability/fetch.yml +10 -0
  49. data/spec/fixtures/bodies/GandiV5_Domain_WebForwarding/fetch.yml +9 -0
  50. data/spec/fixtures/bodies/GandiV5_Domain_WebForwarding/list.yml +9 -0
  51. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/fetch.yml +1 -2
  52. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/list_tsig.yml +3 -0
  53. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/nameservers.yml +3 -0
  54. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_DnssecKey/fetch.yml +12 -0
  55. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_DnssecKey/list.yml +9 -0
  56. data/spec/fixtures/bodies/{GandiV5_LiveDNS_Zone_Snapshot → GandiV5_LiveDNS_Domain_Snapshot}/fetch.yml +4 -3
  57. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_Snapshot/list.yml +5 -0
  58. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_TsigKey/fetch.yml +9 -0
  59. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain_TsigKey/list.yml +4 -0
  60. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance/fetch.yml +80 -0
  61. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance/list.yml +38 -0
  62. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance_VirtualHost/fetch.yml +26 -0
  63. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance_VirtualHost/list.yml +18 -0
  64. data/spec/fixtures/bodies/GandiV5_Template/fetch.yml +41 -0
  65. data/spec/fixtures/bodies/GandiV5_Template/list.yml +20 -0
  66. data/spec/fixtures/bodies/GandiV5_Template_Dispatch/fetch.yml +49 -0
  67. data/spec/fixtures/vcr/Examples/List_domain_renewals.yml +54 -0
  68. data/spec/fixtures/vcr/Examples/List_email_addresses.yml +103 -0
  69. data/spec/spec_helper.rb +8 -7
  70. data/spec/units/gandi_v5/domain/transfer_in/availability_spec.rb +49 -0
  71. data/spec/units/gandi_v5/domain/transfer_in_spec.rb +143 -0
  72. data/spec/units/gandi_v5/domain/web_forwarding_spec.rb +150 -0
  73. data/spec/units/gandi_v5/domain_spec.rb +56 -37
  74. data/spec/units/gandi_v5/email/forward_spec.rb +5 -34
  75. data/spec/units/gandi_v5/email/mailbox_spec.rb +4 -34
  76. data/spec/units/gandi_v5/live_dns/domain/dnssec_key_spec.rb +128 -0
  77. data/spec/units/gandi_v5/live_dns/{record_set_spec.rb → domain/record_spec.rb} +1 -1
  78. data/spec/units/gandi_v5/live_dns/domain/snapshot_spec.rb +101 -0
  79. data/spec/units/gandi_v5/live_dns/domain/tsig_key_spec.rb +78 -0
  80. data/spec/units/gandi_v5/live_dns/domain_spec.rb +297 -118
  81. data/spec/units/gandi_v5/live_dns_spec.rb +0 -12
  82. data/spec/units/gandi_v5/simple_hosting/instance/application_spec.rb +37 -0
  83. data/spec/units/gandi_v5/simple_hosting/instance/virtual_host/linked_dns_zone_spec.rb +50 -0
  84. data/spec/units/gandi_v5/simple_hosting/instance/virtual_host_spec.rb +324 -0
  85. data/spec/units/gandi_v5/simple_hosting/instance_spec.rb +190 -0
  86. data/spec/units/gandi_v5/simple_hosting_spec.rb +9 -0
  87. data/spec/units/gandi_v5/template/dispatch_spec.rb +70 -0
  88. data/spec/units/gandi_v5/template/payload/web_forwarding_spec.rb +44 -0
  89. data/spec/units/gandi_v5/template_spec.rb +341 -0
  90. data/spec/units/gandi_v5_spec.rb +111 -14
  91. metadata +226 -79
  92. data/.gitignore +0 -26
  93. data/.rspec +0 -3
  94. data/.rubocop.yml +0 -30
  95. data/.travis.yml +0 -38
  96. data/FUNDING.yml +0 -10
  97. data/Gemfile +0 -6
  98. data/Guardfile +0 -39
  99. data/Rakefile +0 -3
  100. data/bin/console +0 -13
  101. data/gandi_v5.gemspec +0 -42
  102. data/lib/gandi_v5/domain/sharing_space.rb +0 -29
  103. data/lib/gandi_v5/live_dns/has_zone_records.rb +0 -153
  104. data/lib/gandi_v5/live_dns/record_set.rb +0 -79
  105. data/lib/gandi_v5/live_dns/zone.rb +0 -160
  106. data/lib/gandi_v5/live_dns/zone/snapshot.rb +0 -81
  107. data/spec/features/domain_spec.rb +0 -45
  108. data/spec/features/livedns_domain_spec.rb +0 -8
  109. data/spec/features/livedns_zone_spec.rb +0 -44
  110. data/spec/features/mailbox_spec.rb +0 -18
  111. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/fetch.yml +0 -11
  112. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/list.yml +0 -11
  113. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/list.yml +0 -3
  114. data/spec/fixtures/vcr/Domain_features/List_domains.yml +0 -55
  115. data/spec/fixtures/vcr/Domain_features/Renew_domain.yml +0 -133
  116. data/spec/fixtures/vcr/LiveDNS_Domain_features/List_domains.yml +0 -32
  117. data/spec/fixtures/vcr/LiveDNS_Zone_features/List_zones.yml +0 -42
  118. data/spec/fixtures/vcr/LiveDNS_Zone_features/Make_and_save_snapshot.yml +0 -72
  119. data/spec/fixtures/vcr/LiveDNS_Zone_features/Save_zone_to_file.yml +0 -28
  120. data/spec/fixtures/vcr/Mailbox_features/List_mailboxes.yml +0 -39
  121. data/spec/units/gandi_v5/billing/info_spec.rb +0 -4
  122. data/spec/units/gandi_v5/domain/availability/product/period_spec.rb +0 -4
  123. data/spec/units/gandi_v5/domain/availability/product/price_spec.rb +0 -4
  124. data/spec/units/gandi_v5/domain/availability/product_spec.rb +0 -4
  125. data/spec/units/gandi_v5/domain/availability/tax_spec.rb +0 -4
  126. data/spec/units/gandi_v5/domain/contract_spec.rb +0 -4
  127. data/spec/units/gandi_v5/domain/dates_spec.rb +0 -4
  128. data/spec/units/gandi_v5/domain/restore_information_spec.rb +0 -4
  129. data/spec/units/gandi_v5/domain/sharing_space_spec.rb +0 -4
  130. data/spec/units/gandi_v5/error_spec.rb +0 -4
  131. data/spec/units/gandi_v5/live_dns/zone/snapshot_spec.rb +0 -66
  132. data/spec/units/gandi_v5/live_dns/zone_spec.rb +0 -347
@@ -1,160 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class GandiV5
4
- class LiveDNS
5
- # A zone within the LiveDNS system.
6
- # Zones can be used by any number of domains.
7
- # @!attribute [r] uuid
8
- # @return [String]
9
- # @!attribute [r] name
10
- # @return [String]
11
- # @!attribute [r] sharing_uuid
12
- # @return [String]
13
- # @!attribute [r] soa_retry
14
- # @return [Integer] retry period, as reported in SOA record.
15
- # @!attribute [r] soa_minimum
16
- # @return [Integer] minimum and negative TTL, as reported in SOA record.
17
- # @!attribute [r] soa_refresh
18
- # @return [Integer] refresh period, as reported in SOA record.
19
- # @!attribute [r] soa_expire
20
- # @return [Integer] expire period, as reported in SOA record.
21
- # @!attribute [r] soa_serial
22
- # @return [Integer] serial number, as reported in SOA record.
23
- # @!attribute [r] soa_email
24
- # @return [String] admin email address, as reported in SOA record.
25
- # @!attribute [r] soa_primary_ns
26
- # @return [String] primary name server, as reported in SOA record.
27
- class Zone
28
- include GandiV5::Data
29
- include GandiV5::LiveDNS::HasZoneRecords
30
-
31
- members :uuid, :name
32
- member :sharing_uuid, gandi_key: 'sharing_id'
33
- member :soa_retry, gandi_key: 'retry'
34
- member :soa_minimum, gandi_key: 'minimum'
35
- member :soa_refresh, gandi_key: 'refresh'
36
- member :soa_expire, gandi_key: 'expire'
37
- member :soa_serial, gandi_key: 'serial'
38
- member :soa_email, gandi_key: 'email'
39
- member :soa_primary_ns, gandi_key: 'primary_ns'
40
-
41
- alias zone_uuid uuid
42
-
43
- # Generate SOA record for the zone
44
- # @return [String]
45
- def to_s
46
- "@\tIN\tSOA\t#{soa_primary_ns} #{soa_email} (\n" \
47
- "\t#{soa_serial}\t;Serial\n" \
48
- "\t#{soa_refresh}\t\t;Refresh\n" \
49
- "\t#{soa_retry}\t\t;Retry\n" \
50
- "\t#{soa_expire}\t\t;Expire\n" \
51
- "\t#{soa_minimum}\t\t;Minimum & Negative TTL\n" \
52
- ')'
53
- end
54
-
55
- # List the domains that use this zone.
56
- # @return [Array<String>] The FQDNs.
57
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
58
- def list_domains
59
- _response, data = GandiV5.get "#{url}/domains"
60
- data.map { |item| item['fqdn'] }
61
- end
62
-
63
- # Attach domain to this zone.
64
- # @param fqdn [String, #fqdn, #to_s] the fully qualified domain name
65
- # that should start using this zone.
66
- # @return [String] The confirmation message from Gandi.
67
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
68
- def attach_domain(fqdn)
69
- fqdn = fqdn.fqdn if fqdn.respond_to?(:fqdn)
70
- _resp, data = GandiV5.patch "#{BASE}domains/#{CGI.escape fqdn}", { zone_uuid: uuid }.to_json
71
- data['message']
72
- end
73
-
74
- # Get snapshot UUIDs for this zone from Gandi.
75
- # @return [Hash{String => Time}] Mapping snapshot UUID to time made.
76
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
77
- def snapshots
78
- GandiV5::LiveDNS::Zone::Snapshot.list uuid
79
- end
80
-
81
- # Get snapshot from Gandi.
82
- # @param uuid [String] the UUID of the snapshot to fetch.
83
- # @return [GandiV5::LiveDNS::Zone::Snapshot]
84
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
85
- def snapshot(uuid)
86
- GandiV5::LiveDNS::Zone::Snapshot.fetch self.uuid, uuid
87
- end
88
-
89
- # Take a snapshot of this zone.
90
- # @return [GandiV5::LiveDNS::Zone::Snapshot]
91
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
92
- def take_snapshot
93
- _response, data = GandiV5.post "#{url}/snapshots"
94
- snapshot data['uuid']
95
- end
96
-
97
- # Update this zone.
98
- # @param name [String, #to_s] new name for the zone.
99
- # @return [String] The confirmation message from Gandi.
100
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
101
- def update(name:)
102
- _response, data = GandiV5.patch url, { name: name }.to_json
103
- self.name = name
104
- data['message']
105
- end
106
-
107
- # Delete this zone from Gandi.
108
- # @return [nil]
109
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
110
- def delete
111
- GandiV5.delete url
112
- end
113
-
114
- # Create a new zone.
115
- # @param name [String] the name for the created zone.
116
- # @param sharing_id [String] the UUID of the account to ceate the zone under.
117
- # @return [GandiV5::LiveDNS::Zone] The created zone.
118
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
119
- def self.create(name, sharing_id: nil)
120
- params = sharing_id ? { sharing_id: sharing_id } : {}
121
-
122
- response, _data = GandiV5.post(
123
- url,
124
- { name: name }.to_json,
125
- params: params
126
- )
127
-
128
- fetch response.headers[:location].split('/').last
129
- end
130
-
131
- # List the zones.
132
- # @return [Array<GandiV5::LiveDNS::Zone>]
133
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
134
- def self.list
135
- _response, data = GandiV5.get url
136
- data.map { |item| from_gandi item }
137
- end
138
-
139
- # Get a zone from Gandi.
140
- # @param uuid [String, #to_s] the UUID of the zone to fetch.
141
- # @return [GandiV5::LiveDNS::Zone]
142
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
143
- def self.fetch(uuid)
144
- _response, data = GandiV5.get url(uuid)
145
- from_gandi data
146
- end
147
-
148
- private
149
-
150
- def url
151
- "#{BASE}zones/#{CGI.escape uuid}"
152
- end
153
-
154
- def self.url(uuid = nil)
155
- BASE + (uuid ? "zones/#{CGI.escape(uuid)}" : 'zones')
156
- end
157
- private_class_method :url
158
- end
159
- end
160
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class GandiV5
4
- class LiveDNS
5
- class Zone
6
- # A snapshot (backup) of a zone.
7
- # @!attribute [r] uuid
8
- # @return [String]
9
- # @!attribute [r] zone_uuid
10
- # @return [String]
11
- # @!attribute [r] created_at
12
- # @return [Time]
13
- # @!attribute [r] records
14
- # @return [Array<GandiV5::LiveDNS::RecordSet>]
15
- class Snapshot
16
- include GandiV5::Data
17
-
18
- members :uuid, :zone_uuid
19
- member :created_at, gandi_key: 'date_created', converter: GandiV5::Data::Converter::Time
20
- member(
21
- :records,
22
- gandi_key: 'zone_data',
23
- converter: GandiV5::LiveDNS::RecordSet,
24
- array: true
25
- )
26
-
27
- alias snapshot_uuid uuid
28
-
29
- # Delete this snapshot.
30
- # @return [String] The confirmation message from Gandi.
31
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
32
- def delete
33
- _response, data = GandiV5.delete url
34
- data['message']
35
- end
36
-
37
- # @see GandiV5::LiveDNS::Zone.fetch
38
- def fetch_zone
39
- GandiV5::LiveDNS::Zone.fetch zone_uuid
40
- end
41
-
42
- # The snapshot's zone (fetching from Gandi if required).
43
- # @return [GandiV5::LiveDNS::Zone]
44
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
45
- def zone
46
- @zone ||= fetch_zone
47
- end
48
-
49
- # Get snapshot UUIDs for this zone from Gandi.
50
- # @return [Hash{String => Time}] Mapping UUID to time made.
51
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
52
- def self.list(zone_uuid)
53
- _response, data = GandiV5.get url(zone_uuid)
54
- Hash[data.map { |snapshot| [snapshot['uuid'], Time.parse(snapshot['date_created'])] }]
55
- end
56
-
57
- # Get snapshot from Gandi.
58
- # @param zone_uuid [String, #to_s] the UUID of the zone the snapshot was made of.
59
- # @param snapshot_uuid [String, #to_s] the UUID of the snapshot to fetch.
60
- # @return [GandiV5::LiveDNS::Zone::Snapshot]
61
- # @raise [GandiV5::Error::GandiError] if Gandi returns an error.
62
- def self.fetch(zone_uuid, snapshot_uuid)
63
- _response, data = GandiV5.get url(zone_uuid, snapshot_uuid)
64
- from_gandi data
65
- end
66
-
67
- private
68
-
69
- def url
70
- "#{BASE}zones/#{CGI.escape zone_uuid}/snapshots/#{CGI.escape uuid}"
71
- end
72
-
73
- def self.url(zone_uuid, snapshot_uuid = nil)
74
- "#{BASE}zones/#{CGI.escape zone_uuid}/snapshots" +
75
- (snapshot_uuid ? "/#{CGI.escape snapshot_uuid}" : '')
76
- end
77
- private_class_method :url
78
- end
79
- end
80
- end
81
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'Domain features' do
4
- it 'List domains', :vcr do
5
- list = GandiV5.domains
6
-
7
- expect(list.count).to eq 1
8
- expect(list.first.fqdn).to eq 'example.net'
9
- expect(list.first.fqdn_unicode).to eq 'example.net'
10
- expect(list.first.name_servers).to eq []
11
- expect(list.first.services).to be nil
12
- expect(list.first.sharing_space).to be nil
13
- expect(list.first.status).to match_array [:clientTransferProhibited]
14
- expect(list.first.tld).to eq 'net'
15
- expect(list.first.dates.registry_created_at).to eq Time.new(2019, 2, 13, 10, 4, 18)
16
- expect(list.first.dates.updated_at).to eq Time.new(2019, 2, 25, 16, 20, 49)
17
- expect(list.first.dates.authinfo_expires_at).to be nil
18
- expect(list.first.dates.created_at).to eq Time.new(2019, 2, 13, 11, 4, 18)
19
- expect(list.first.dates.deletes_at).to be nil
20
- expect(list.first.dates.hold_begins_at).to be nil
21
- expect(list.first.dates.hold_ends_at).to be nil
22
- expect(list.first.dates.pending_delete_ends_at).to be nil
23
- expect(list.first.dates.registry_ends_at).to eq Time.new(2021, 2, 13, 10, 4, 18)
24
- expect(list.first.dates.renew_begins_at).to be nil
25
- expect(list.first.dates.restore_ends_at).to be nil
26
- expect(list.first.can_tld_lock).to be nil
27
- expect(list.first.auto_renew.dates).to be nil
28
- expect(list.first.auto_renew.duration).to be nil
29
- expect(list.first.auto_renew.enabled).to be false
30
- expect(list.first.auto_renew.org_id).to be nil
31
- expect(list.first.auth_info).to be nil
32
- expect(list.first.uuid).to eq 'ba1167be-2f76-11e9-9dfb-00163ec4cb00'
33
- expect(list.first.sharing_uuid).to be nil
34
- expect(list.first.tags).to match_array []
35
- expect(list.first.trustee_roles).to be nil
36
- expect(list.first.owner).to eq 'alice_doe'
37
- expect(list.first.organisation_owner).to eq 'alice_doe'
38
- expect(list.first.domain_owner).to eq 'Alice Doe'
39
- expect(list.first.name_server).to be :livedns
40
- end
41
-
42
- it 'Renew domain', :vcr do
43
- expect(GandiV5::Domain.fetch('example.net').renew_for(2)).to eq 'Domain renewed.'
44
- end
45
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'LiveDNS Domain features' do
4
- it 'List domains', :vcr do
5
- list = GandiV5::LiveDNS::Domain.list
6
- expect(list.map(&:fqdn)).to match_array %w[example.com example.net]
7
- end
8
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'LiveDNS Zone features' do
4
- it 'List zones', :vcr do
5
- list = GandiV5::LiveDNS::Zone.list
6
-
7
- expect(list.count).to eq 1
8
- expect(list.first.uuid).to eq 'uuid-of-zone'
9
- expect(list.first.name).to eq 'Zone Name'
10
- expect(list.first.sharing_uuid).to be nil
11
- expect(list.first.soa_retry).to eq 3_600
12
- expect(list.first.soa_minimum).to eq 10_800
13
- expect(list.first.soa_refresh).to eq 10_800
14
- expect(list.first.soa_expire).to eq 604_800
15
- expect(list.first.soa_serial).to eq 1_432_798_405
16
- expect(list.first.soa_email).to eq 'hostmaster.gandi.net.'
17
- expect(list.first.soa_primary_ns).to eq 'a.dns.gandi.net.'
18
- end
19
-
20
- it 'Save zone to file', :vcr do
21
- zone = GandiV5::LiveDNS::Zone.new uuid: 'zone-uuid'
22
- expect(File).to receive(:write).with('/path/to/file', "Contents of zone file.\n")
23
-
24
- File.write '/path/to/file', zone.fetch_zone_lines
25
- end
26
-
27
- it 'Make and save snapshot', :vcr do
28
- hash = {
29
- uuid: 'snapshot-uuid',
30
- zone_uuid: 'zone-uuid',
31
- created_at: Time.new(2016, 12, 16, 16, 51, 26),
32
- records: [
33
- type: 'A',
34
- ttl: 10_800,
35
- name: 'www',
36
- values: ['10.0.1.42']
37
- ]
38
- }
39
-
40
- zone = GandiV5::LiveDNS::Zone.new uuid: 'zone-uuid'
41
- snapshot = zone.take_snapshot
42
- expect(snapshot.to_h).to eq hash
43
- end
44
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'Mailbox features' do
4
- it 'List mailboxes', :vcr do
5
- list = GandiV5::Email::Mailbox.list 'example.net'
6
-
7
- expect(list.count).to eq 1
8
- expect(list.first.login).to eq 'alice'
9
- expect(list.first.fqdn).to eq 'example.net'
10
- expect(list.first.address).to eq 'alice@example.net'
11
- expect(list.first.uuid).to eq '066743e5-96e4-4a1d-9195-8b8a700a8a79'
12
- expect(list.first.type).to be :standard
13
- expect(list.first.quota_used).to eq 1_200
14
- expect(list.first.aliases).to be nil
15
- expect(list.first.fallback_email).to be nil
16
- expect(list.first.responder).to be nil
17
- end
18
- end
@@ -1,11 +0,0 @@
1
- ---
2
- retry: 3600
3
- uuid: zone-uuid
4
- minimum: 900
5
- refresh: 10800
6
- expire: 604800
7
- serial: 1432798405
8
- user_uuid: user-uuid
9
- email: hostmaster.gandi.net.
10
- primary_ns: a.dns.gandi.net.
11
- name: Name
@@ -1,11 +0,0 @@
1
- ---
2
- - retry: 3600
3
- uuid: zone-uuid
4
- minimum: 900
5
- refresh: 10800
6
- expire: 604800
7
- serial: 1432798405
8
- user_uuid: user-uuid
9
- email: hostmaster.gandi.net.
10
- primary_ns: a.dns.gandi.net.
11
- name: Name
@@ -1,3 +0,0 @@
1
- ---
2
- - uuid: snapshot-uuid
3
- date_created: '2016-12-16T16:51:26Z'
@@ -1,55 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.gandi.net/v5/domain/domains?page=1&per_page=100
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- Authorization:
13
- - Apikey abdce12345
14
- Host:
15
- - api.gandi.net
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Content-Type:
22
- - application/json; charset=utf-8
23
- body:
24
- encoding: UTF-8
25
- string: |-
26
- [
27
- {
28
- "status": [
29
- "clientTransferProhibited"
30
- ],
31
- "dates": {
32
- "created_at": "2019-02-13T11:04:18Z",
33
- "registry_created_at": "2019-02-13T10:04:18Z",
34
- "registry_ends_at": "2021-02-13T10:04:18Z",
35
- "updated_at": "2019-02-25T16:20:49Z"
36
- },
37
- "tags": [],
38
- "fqdn": "example.net",
39
- "id": "ba1167be-2f76-11e9-9dfb-00163ec4cb00",
40
- "autorenew": false,
41
- "tld": "net",
42
- "owner": "alice_doe",
43
- "orga_owner": "alice_doe",
44
- "domain_owner": "Alice Doe",
45
- "nameserver": {
46
- "current": "livedns"
47
- },
48
- "href": "https://api.test/v5/domain/domains/example.net",
49
- "fqdn_unicode": "example.net",
50
- "nameservers": []
51
- }
52
- ]
53
- http_version:
54
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
55
- recorded_with: VCR 4.0.0