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,133 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.gandi.net/v5/domain/domains/example.net
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
- "status": [
28
- "clientTransferProhibited"
29
- ],
30
- "dates": {
31
- "created_at": "2019-02-13T11:04:18Z",
32
- "deletes_at": "2021-03-30T00:04:18Z",
33
- "hold_begins_at": "2021-02-13T10:04:18Z",
34
- "hold_ends_at": "2021-03-30T10:04:18Z",
35
- "pending_delete_ends_at": "2021-05-04T10:04:18Z",
36
- "registry_created_at": "2019-02-13T10:04:18Z",
37
- "registry_ends_at": "2021-02-13T10:04:18Z",
38
- "renew_begins_at": "2012-01-01T00:00:00Z",
39
- "restore_ends_at": "2021-04-29T10:04:18Z",
40
- "updated_at": "2019-02-25T16:20:49Z",
41
- "authinfo_expires_at": "2020-02-25T16:20:49Z"
42
- },
43
- "can_tld_lock": true,
44
- "tags": [],
45
- "nameservers": [
46
- "ns-25-a.gnadi.net",
47
- "ns-113-b.gnadi.net",
48
- "ns-58-c.gnadi.net"
49
- ],
50
- "contacts": {
51
- "owner": {
52
- "city": "Paris",
53
- "given": "Alice",
54
- "reachability": "pending",
55
- "family": "Doe",
56
- "zip": "75001",
57
- "extra_parameters": {
58
- "birth_date": "",
59
- "birth_department": "",
60
- "birth_city": "",
61
- "birth_country": ""
62
- },
63
- "country": "FR",
64
- "streetaddr": "5 rue neuve",
65
- "data_obfuscated": true,
66
- "mail_obfuscated": true,
67
- "phone": "+33.123456789",
68
- "state": "FR-J",
69
- "validation": "none",
70
- "type": 0,
71
- "email": "alice@example.org"
72
- }
73
- },
74
- "fqdn": "example.net",
75
- "autorenew": {
76
- "dates": [
77
- "2021-01-13T09:04:18Z",
78
- "2021-01-29T10:04:18Z",
79
- "2021-02-12T10:04:18Z"
80
- ],
81
- "org_id": "fe0b931c-18c5-11e9-b9b5-00163ec4cb00",
82
- "duration": 1,
83
- "href": "http://api.test/v5/domain/domains/example.net/autorenew",
84
- "enabled": false
85
- },
86
- "authinfo": "8vyhljvJg+",
87
- "sharing_space": {
88
- "id": "fe0b931c-18c5-11e9-b9b5-00163ec4cb00",
89
- "name": "alice_doe"
90
- },
91
- "tld": "net",
92
- "services": [
93
- "gandilivedns",
94
- "mailboxv2"
95
- ],
96
- "id": "ba1167be-2f76-11e9-9dfb-00163ec4cb00",
97
- "trustee_roles": [],
98
- "href": "http://api.test/v5/domain/domains/example.net",
99
- "fqdn_unicode": "example.net"
100
- }
101
- http_version:
102
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
103
-
104
- - request:
105
- method: post
106
- uri: https://api.gandi.net/v5/domain/domains/example.net/renew
107
- body:
108
- encoding: US-ASCII
109
- string: '{"duration":2}'
110
- headers:
111
- Accept:
112
- - application/json
113
- Authorization:
114
- - Apikey abdce12345
115
- Host:
116
- - api.gandi.net
117
- response:
118
- status:
119
- code: 200
120
- message: OK
121
- headers:
122
- Content-Type:
123
- - application/json; charset=utf-8
124
- body:
125
- encoding: UTF-8
126
- string: |-
127
- {
128
- "message":"Domain renewed."
129
- }
130
- http_version:
131
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
132
-
133
- recorded_with: VCR 4.0.0
@@ -1,32 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://dns.api.gandi.net/api/v5/domains
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
- {"fqdn":"example.com"},
28
- {"fqdn":"example.net"}
29
- ]
30
- http_version:
31
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
32
- recorded_with: VCR 4.0.0
@@ -1,42 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://dns.api.gandi.net/api/v5/zones
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- X-Api-Key:
13
- - 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
- "retry": 3600,
29
- "uuid": "uuid-of-zone",
30
- "minimum": 10800,
31
- "refresh": 10800,
32
- "expire": 604800,
33
- "serial": 1432798405,
34
- "user_uuid": "uuid-of-user",
35
- "email": "hostmaster.gandi.net.",
36
- "primary_ns": "a.dns.gandi.net.",
37
- "name": "Zone Name"
38
- }
39
- ]
40
- http_version:
41
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
42
- recorded_with: VCR 4.0.0
@@ -1,72 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json
12
- X-Api-Key:
13
- - 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
- "message": "Zone Snapshot Created",
28
- "uuid": "snapshot-uuid"
29
- }
30
- http_version:
31
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
32
-
33
- - request:
34
- method: get
35
- uri: https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots/snapshot-uuid
36
- body:
37
- encoding: US-ASCII
38
- string: ''
39
- headers:
40
- Accept:
41
- - text/plain
42
- X-Api-Key:
43
- - abdce12345
44
- Host:
45
- - api.gandi.net
46
- response:
47
- status:
48
- code: 200
49
- message: OK
50
- headers:
51
- Content-Type:
52
- - application/json; charset=utf-8
53
- body:
54
- encoding: UTF-8
55
- string: |-
56
- {
57
- "date_created": "2016-12-16T16:51:26Z",
58
- "uuid": "snapshot-uuid",
59
- "zone_uuid": "zone-uuid",
60
- "zone_data": [
61
- {
62
- "rrset_type": "A",
63
- "rrset_ttl": 10800,
64
- "rrset_name": "www",
65
- "rrset_values": ["10.0.1.42"]
66
- }
67
- ]
68
- }
69
- http_version:
70
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
71
-
72
- recorded_with: VCR 4.0.0
@@ -1,28 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://dns.api.gandi.net/api/v5/zones/zone-uuid/records
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - text/plain
12
- X-Api-Key:
13
- - abdce12345
14
- Host:
15
- - api.gandi.net
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Content-Type:
22
- - text/plain; charset=utf-8
23
- body:
24
- encoding: UTF-8
25
- string: "Contents of zone file.\n"
26
- http_version:
27
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
28
- recorded_with: VCR 4.0.0
@@ -1,39 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.gandi.net/v5/email/mailboxes/example.net?page=1
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
- "domain": "example.net",
29
- "login": "alice",
30
- "address": "alice@example.net",
31
- "id": "066743e5-96e4-4a1d-9195-8b8a700a8a79",
32
- "mailbox_type": "standard",
33
- "quota_used": 1200,
34
- "href": "https://api.test/api/v5/email/example.net/066743e5-96e4-4a1d-9195-8b8a700a8a79"
35
- }
36
- ]
37
- http_version:
38
- recorded_at: Thu, 30 May 2019 06:22:02 GMT
39
- recorded_with: VCR 4.0.0
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Billing::Info do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::Availability::Product::Period do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::Availability::Product::Price do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::Availability::Product do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::Availability::Tax do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::Contract do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::Dates do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::RestoreInformation do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Domain::SharingSpace do
4
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::Error::GandiError do
4
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe GandiV5::LiveDNS::Zone::Snapshot do
4
- subject do
5
- described_class.new(
6
- created_at: Time.new(2016, 12, 16, 16, 51, 26, 0),
7
- uuid: 'snapshot-uuid',
8
- zone_uuid: 'zone-uuid',
9
- records: []
10
- )
11
- end
12
-
13
- it '#delete' do
14
- expect(GandiV5).to receive(:delete).with('https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots/snapshot-uuid')
15
- .and_return([nil, { 'message' => 'Confirmation message.' }])
16
- expect(subject.delete).to eq 'Confirmation message.'
17
- end
18
-
19
- it '#fetch_zone' do
20
- returns = double GandiV5::LiveDNS::Zone
21
- expect(GandiV5::LiveDNS::Zone).to receive(:fetch).with('zone-uuid')
22
- .and_return(returns)
23
- expect(subject.fetch_zone).to be returns
24
- end
25
-
26
- describe '#zone' do
27
- it 'Not previously fetched' do
28
- returns = double GandiV5::LiveDNS::Zone
29
- expect(subject).to receive(:fetch_zone).and_return(returns)
30
- expect(subject.zone).to be returns
31
- end
32
-
33
- it 'Previously fetched' do
34
- returns = double GandiV5::LiveDNS::Zone
35
- subject.instance_exec { @zone = returns }
36
- expect(subject).to_not receive(:fetch_zone)
37
- expect(subject.zone).to be returns
38
- end
39
- end
40
-
41
- it '.list' do
42
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone_Snapshot', 'list.yml'))
43
- expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots')
44
- .and_return([nil, YAML.load_file(body_fixture)])
45
- expect(described_class.list('zone-uuid')).to eq('snapshot-uuid' => Time.new(2016, 12, 16, 16, 51, 26, 0))
46
- end
47
-
48
- describe '.fetch' do
49
- subject { described_class.fetch 'zone-uuid', 'snapshot-uuid' }
50
-
51
- before :each do
52
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone_Snapshot', 'fetch.yml'))
53
- expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots/snapshot-uuid')
54
- .and_return([nil, YAML.load_file(body_fixture)])
55
- end
56
-
57
- its('created_at') { should eq Time.new(2016, 12, 16, 16, 51, 26, 0) }
58
- its('uuid') { should eq 'snapshot-uuid' }
59
- its('zone_uuid') { should eq 'zone-uuid' }
60
- its('records.count') { should eq 1 }
61
- its('records.first.type') { should eq 'A' }
62
- its('records.first.ttl') { should eq 10_800 }
63
- its('records.first.name') { should eq 'www' }
64
- its('records.first.values') { should match_array ['10.0.1.42'] }
65
- end
66
- end