gandi_v5 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +20 -0
  5. data/.travis.yml +23 -0
  6. data/CHANGELOG.md +3 -0
  7. data/Gemfile +6 -0
  8. data/Guardfile +40 -0
  9. data/LICENSE.md +32 -0
  10. data/README.md +94 -0
  11. data/Rakefile +3 -0
  12. data/TODO.md +29 -0
  13. data/bin/console +13 -0
  14. data/gandi_v5.gemspec +41 -0
  15. data/lib/gandi_v5/billing/info/prepaid.rb +33 -0
  16. data/lib/gandi_v5/billing/info.rb +26 -0
  17. data/lib/gandi_v5/billing.rb +28 -0
  18. data/lib/gandi_v5/data/converter/array_of.rb +35 -0
  19. data/lib/gandi_v5/data/converter/symbol.rb +26 -0
  20. data/lib/gandi_v5/data/converter/time.rb +28 -0
  21. data/lib/gandi_v5/data/converter.rb +41 -0
  22. data/lib/gandi_v5/data.rb +244 -0
  23. data/lib/gandi_v5/domain/auto_renew.rb +64 -0
  24. data/lib/gandi_v5/domain/contact.rb +102 -0
  25. data/lib/gandi_v5/domain/contract.rb +22 -0
  26. data/lib/gandi_v5/domain/dates.rb +44 -0
  27. data/lib/gandi_v5/domain/renewal_information.rb +41 -0
  28. data/lib/gandi_v5/domain/restore_information.rb +18 -0
  29. data/lib/gandi_v5/domain/sharing_space.rb +21 -0
  30. data/lib/gandi_v5/domain.rb +431 -0
  31. data/lib/gandi_v5/email/mailbox/responder.rb +36 -0
  32. data/lib/gandi_v5/email/mailbox.rb +236 -0
  33. data/lib/gandi_v5/email/offer.rb +27 -0
  34. data/lib/gandi_v5/email/slot.rb +134 -0
  35. data/lib/gandi_v5/email.rb +11 -0
  36. data/lib/gandi_v5/error/gandi_error.rb +21 -0
  37. data/lib/gandi_v5/error.rb +9 -0
  38. data/lib/gandi_v5/live_dns/domain.rb +211 -0
  39. data/lib/gandi_v5/live_dns/record_set.rb +79 -0
  40. data/lib/gandi_v5/live_dns/zone/snapshot.rb +62 -0
  41. data/lib/gandi_v5/live_dns/zone.rb +301 -0
  42. data/lib/gandi_v5/live_dns.rb +30 -0
  43. data/lib/gandi_v5/organization.rb +66 -0
  44. data/lib/gandi_v5/version.rb +5 -0
  45. data/lib/gandi_v5.rb +178 -0
  46. data/spec/.rubocop.yml +4 -0
  47. data/spec/features/domain_spec.rb +45 -0
  48. data/spec/features/livedns_domain_spec.rb +8 -0
  49. data/spec/features/livedns_zone_spec.rb +45 -0
  50. data/spec/features/mailbox_spec.rb +18 -0
  51. data/spec/fixtures/bodies/GandiV5_Billing/info.yaml +10 -0
  52. data/spec/fixtures/bodies/GandiV5_Domain/availability.yaml +15 -0
  53. data/spec/fixtures/bodies/GandiV5_Domain/fetch_contacts.yaml +8 -0
  54. data/spec/fixtures/bodies/GandiV5_Domain/get.yaml +37 -0
  55. data/spec/fixtures/bodies/GandiV5_Domain/list.yaml +20 -0
  56. data/spec/fixtures/bodies/GandiV5_Domain/renewal_info.yaml +12 -0
  57. data/spec/fixtures/bodies/GandiV5_Domain/restore_info.yaml +5 -0
  58. data/spec/fixtures/bodies/GandiV5_Domain/tld.yaml +10 -0
  59. data/spec/fixtures/bodies/GandiV5_Domain/tlds.yaml +7 -0
  60. data/spec/fixtures/bodies/GandiV5_Email_Mailbox/get.yaml +16 -0
  61. data/spec/fixtures/bodies/GandiV5_Email_Mailbox/list.yaml +8 -0
  62. data/spec/fixtures/bodies/GandiV5_Email_Slot/get.yaml +10 -0
  63. data/spec/fixtures/bodies/GandiV5_Email_Slot/list.yaml +8 -0
  64. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/get.yaml +4 -0
  65. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/list.yaml +2 -0
  66. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/get.yaml +11 -0
  67. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/list.yaml +11 -0
  68. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/get.yaml +9 -0
  69. data/spec/fixtures/bodies/GandiV5_Organization/get.yaml +17 -0
  70. data/spec/fixtures/vcr/Domain_features/List_domains.yml +54 -0
  71. data/spec/fixtures/vcr/Domain_features/Renew_domain.yml +133 -0
  72. data/spec/fixtures/vcr/LiveDNS_Domain_features/List_domains.yml +32 -0
  73. data/spec/fixtures/vcr/LiveDNS_Zone_features/List_zones.yml +42 -0
  74. data/spec/fixtures/vcr/LiveDNS_Zone_features/Make_and_save_snapshot.yml +72 -0
  75. data/spec/fixtures/vcr/LiveDNS_Zone_features/Save_zone_to_file.yml +28 -0
  76. data/spec/fixtures/vcr/Mailbox_features/List_mailboxes.yml +39 -0
  77. data/spec/spec_helper.rb +60 -0
  78. data/spec/test.env +1 -0
  79. data/spec/units/gandi_v5/billing/info/prepaid_spec.rb +20 -0
  80. data/spec/units/gandi_v5/billing/info_spec.rb +4 -0
  81. data/spec/units/gandi_v5/billing_spec.rb +41 -0
  82. data/spec/units/gandi_v5/data/converter/array_of_spec.rb +18 -0
  83. data/spec/units/gandi_v5/data/converter/symbol_spec.rb +16 -0
  84. data/spec/units/gandi_v5/data/converter/time_spec.rb +16 -0
  85. data/spec/units/gandi_v5/data/converter_spec.rb +31 -0
  86. data/spec/units/gandi_v5/data_spec.rb +340 -0
  87. data/spec/units/gandi_v5/domain/auto_renew_spec.rb +70 -0
  88. data/spec/units/gandi_v5/domain/contact_spec.rb +36 -0
  89. data/spec/units/gandi_v5/domain/contract_spec.rb +4 -0
  90. data/spec/units/gandi_v5/domain/dates_spec.rb +4 -0
  91. data/spec/units/gandi_v5/domain/renewal_information_spec.rb +81 -0
  92. data/spec/units/gandi_v5/domain/restore_information_spec.rb +4 -0
  93. data/spec/units/gandi_v5/domain/sharing_space_spec.rb +4 -0
  94. data/spec/units/gandi_v5/domain_spec.rb +451 -0
  95. data/spec/units/gandi_v5/email/mailbox/responder_spec.rb +131 -0
  96. data/spec/units/gandi_v5/email/mailbox_spec.rb +384 -0
  97. data/spec/units/gandi_v5/email/offer_spec.rb +17 -0
  98. data/spec/units/gandi_v5/email/slot_spec.rb +102 -0
  99. data/spec/units/gandi_v5/error/gandi_error_spec.rb +30 -0
  100. data/spec/units/gandi_v5/error_spec.rb +4 -0
  101. data/spec/units/gandi_v5/live_dns/domain_spec.rb +247 -0
  102. data/spec/units/gandi_v5/live_dns/record_set_spec.rb +74 -0
  103. data/spec/units/gandi_v5/live_dns/zone/snapshot_spec.rb +37 -0
  104. data/spec/units/gandi_v5/live_dns/zone_spec.rb +329 -0
  105. data/spec/units/gandi_v5/live_dns_spec.rb +17 -0
  106. data/spec/units/gandi_v5/organization_spec.rb +30 -0
  107. data/spec/units/gandi_v5_spec.rb +204 -0
  108. metadata +406 -0
data/lib/gandi_v5.rb ADDED
@@ -0,0 +1,178 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'gandi_v5/version'
4
+ require_relative 'gandi_v5/data'
5
+ require_relative 'gandi_v5/error'
6
+
7
+ require_relative 'gandi_v5/billing'
8
+ require_relative 'gandi_v5/domain'
9
+ require_relative 'gandi_v5/email'
10
+ require_relative 'gandi_v5/live_dns'
11
+ require_relative 'gandi_v5/organization'
12
+
13
+ require 'rest_client'
14
+ require 'securerandom'
15
+
16
+ # Namespace for classes which access the Gandi V5 API.
17
+ # Also provides useful methods and constants for them.
18
+ # This is where you configure the gem:
19
+ # * Setting your Gandi API key:
20
+ # 1. Get your API key - Login to Gandi and visit User Settings ->
21
+ # Change password & configure access restrictions.
22
+ # @see https://api.gandi.net/docs/
23
+ # @see https://doc.livedns.gandi.net/
24
+ # @!attribute [w] api_key
25
+ # @return [String]
26
+ class GandiV5
27
+ BASE = 'https://api.gandi.net/v5/'
28
+
29
+ class << self
30
+ attr_writer :api_key
31
+
32
+ # Might raise:
33
+ # * RestClient::NotFound
34
+ # * RestClient::Unauthorized
35
+ # Bad authentication attempt because of a wrong API Key.
36
+ # * RestClient::Forbidden
37
+ # Access to the resource is denied.
38
+ # Mainly due to a lack of permissions to access it.
39
+ # * GandiV5::Error
40
+ # * JSON::ParserError
41
+ def get(url, **headers)
42
+ prepare_headers headers, url
43
+ response = RestClient.get url, **headers
44
+ parse_response response
45
+ rescue RestClient::BadRequest => e
46
+ handle_bad_request(e)
47
+ end
48
+
49
+ # Might raise:
50
+ # * RestClient::NotFound
51
+ # * RestClient::Unauthorized
52
+ # Bad authentication attempt because of a wrong API Key.
53
+ # * RestClient::Forbidden
54
+ # Access to the resource is denied.
55
+ # Mainly due to a lack of permissions to access it.
56
+ # * RestClient::Conflict
57
+ # * GandiV5::Error
58
+ # * JSON::ParserError
59
+ def delete(url, **headers)
60
+ prepare_headers headers, url
61
+ response = RestClient.delete url, **headers
62
+ parse_response response
63
+ rescue RestClient::BadRequest => e
64
+ handle_bad_request(e)
65
+ end
66
+
67
+ # Might raise:
68
+ # * RestClient::NotFound
69
+ # * RestClient::Unauthorized
70
+ # Bad authentication attempt because of a wrong API Key.
71
+ # * RestClient::Forbidden
72
+ # Access to the resource is denied.
73
+ # Mainly due to a lack of permissions to access it.
74
+ # * RestClient::BadRequest
75
+ # * RestClient::Conflict
76
+ # * GandiV5::Error
77
+ # * JSON::ParserError
78
+ def patch(url, payload = '', **headers)
79
+ prepare_headers headers, url
80
+ headers[:'content-type'] ||= 'application/json'
81
+ response = RestClient.patch url, payload, **headers
82
+ parse_response response
83
+ rescue RestClient::BadRequest => e
84
+ handle_bad_request(e)
85
+ end
86
+
87
+ # Might raise:
88
+ # * RestClient::NotFound
89
+ # * RestClient::Unauthorized
90
+ # Bad authentication attempt because of a wrong API Key.
91
+ # * RestClient::Forbidden
92
+ # Access to the resource is denied.
93
+ # Mainly due to a lack of permissions to access it.
94
+ # * RestClient::BadRequest
95
+ # * RestClient::Conflict
96
+ # * GandiV5::Error
97
+ # * JSON::ParserError
98
+ def post(url, payload = '', **headers)
99
+ prepare_headers headers, url
100
+ headers[:'content-type'] ||= 'application/json'
101
+ response = RestClient.post url, payload, **headers
102
+ parse_response response
103
+ rescue RestClient::BadRequest => e
104
+ handle_bad_request(e)
105
+ end
106
+
107
+ # Might raise:
108
+ # * RestClient::NotFound
109
+ # * RestClient::Unauthorized
110
+ # Bad authentication attempt because of a wrong API Key.
111
+ # * RestClient::Forbidden
112
+ # Access to the resource is denied.
113
+ # Mainly due to a lack of permissions to access it.
114
+ # * RestClient::BadRequest
115
+ # * RestClient::Conflict
116
+ # * GandiV5::Error
117
+ # * JSON::ParserError
118
+ def put(url, payload = '', **headers)
119
+ prepare_headers headers, url
120
+ headers[:'content-type'] ||= 'application/json'
121
+ response = RestClient.put url, payload, **headers
122
+ parse_response response
123
+ rescue RestClient::BadRequest => e
124
+ handle_bad_request(e)
125
+ end
126
+
127
+ private
128
+
129
+ def api_key
130
+ @api_key ||= ENV.fetch('GANDI_API_KEY')
131
+ end
132
+
133
+ def authorisation_header(url)
134
+ if url.start_with?(BASE)
135
+ { Authorization: "Apikey #{api_key}" }
136
+ elsif url.start_with?(GandiV5::LiveDNS::BASE)
137
+ { 'X-Api-Key': api_key }
138
+ else
139
+ fail ArgumentError, "Don't know how to authorise for url: #{url}"
140
+ end
141
+ end
142
+
143
+ def parse_response(response)
144
+ type = response.headers.fetch(:content_type).split(';').first.chomp
145
+ case type
146
+ when 'text/plain'
147
+ response.body.to_s
148
+ when 'application/json'
149
+ response = JSON.parse(response.body)
150
+ if response.is_a?(Hash) && response['status'].eql?('error')
151
+ fail GandiV5::Error::GandiError.from_hash(response)
152
+ end
153
+
154
+ response
155
+ else
156
+ fail ArgumentError, "Don't know how to parse a #{type} response"
157
+ end
158
+ end
159
+
160
+ def prepare_headers(headers, url)
161
+ headers.transform_keys!(&:to_sym)
162
+ headers[:accept] ||= 'application/json'
163
+ headers.merge!(authorisation_header(url))
164
+ end
165
+
166
+ def handle_bad_request(exception)
167
+ data = JSON.parse exception.response.body
168
+ unless data.is_a?(Hash) && data['status'].eql?('error') && data['errors'].is_a?(Array)
169
+ raise exception
170
+ end
171
+
172
+ field, message = data['errors'].first.values_at('name', 'description')
173
+ fail GandiV5::Error::GandiError, "#{field}: #{message}"
174
+ rescue JSON::ParserError
175
+ raise exception
176
+ end
177
+ end
178
+ end
data/spec/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ Metrics/BlockLength:
2
+ Max: 500
3
+ Metrics/LineLength:
4
+ Max: 125
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe 'Domain features' do
4
+ it 'List domains', :vcr do
5
+ list = GandiV5::Domain.list
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 be nil
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
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,45 @@
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
+ yaml = "--- !ruby/object:GandiV5::LiveDNS::Zone::Snapshot\n" \
29
+ "uuid: snapshot-uuid\n" \
30
+ "zone_uuid: zone-uuid\n" \
31
+ "created_at: 2016-12-16 16:51:26.000000000 Z\n" \
32
+ "records:\n" \
33
+ "- !ruby/object:GandiV5::LiveDNS::RecordSet\n" \
34
+ " type: A\n" \
35
+ " ttl: 10800\n" \
36
+ " name: www\n" \
37
+ " values:\n" \
38
+ " - 10.0.1.42\n"
39
+ expect(File).to receive(:write).with('/path/to/file', yaml)
40
+
41
+ zone = GandiV5::LiveDNS::Zone.new uuid: 'zone-uuid'
42
+ snapshot = zone.take_snapshot
43
+ File.write '/path/to/file', snapshot.to_yaml
44
+ end
45
+ end
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,10 @@
1
+ ---
2
+ annual_balance: 123.45
3
+ grid: A
4
+ prepaid:
5
+ currency: GBP
6
+ amount: 1
7
+ warning_threshold:
8
+ created_at: '2011-02-19T11:23:25Z'
9
+ updated_at: '2019-02-23T21:47:22Z'
10
+ outstanding_amount: 0
@@ -0,0 +1,15 @@
1
+ ---
2
+ currency: GBP
3
+ grid: A
4
+ products:
5
+ - status: unavailable
6
+ name: example.com
7
+ process: create
8
+ taxes:
9
+ - type: service
10
+ rate: 0
11
+ name: vat
12
+ taxes:
13
+ - type: service
14
+ rate: 0
15
+ name: vat
@@ -0,0 +1,8 @@
1
+ ---
2
+ owner:
3
+ country: GB
4
+ email: owner@example.com
5
+ family: Fam
6
+ given: Giv
7
+ streetaddr: Somestreet
8
+ type: 1
@@ -0,0 +1,37 @@
1
+ ---
2
+ status: []
3
+ dates:
4
+ created_at: '2011-02-21T10:39:00Z'
5
+ registry_created_at: '2003-03-12T12:02:11Z'
6
+ registry_ends_at: '2020-03-12T12:02:11Z'
7
+ updated_at: '2019-02-06T09:49:37Z'
8
+ tags:
9
+ - Tag
10
+ fqdn: example.com
11
+ id: domain-uuid
12
+ autorenew:
13
+ href: http://api.test/v5/domain/domains/example.com/autorenew
14
+ dates:
15
+ - '2021-01-13T09:04:18Z'
16
+ - '2021-01-29T10:04:18Z'
17
+ duration: 1
18
+ enabled: true
19
+ org_id: org-uuid
20
+ tld: com
21
+ nameservers:
22
+ - '192.168.0.1'
23
+ - '192.168.0.2'
24
+ href: https://api.gandi.net/v5/domain/domains/example.com
25
+ fqdn_unicode: example.com
26
+ can_tld_lock: true
27
+ contacts:
28
+ owner:
29
+ country: GB
30
+ email: owner@example.com
31
+ family: Fam
32
+ given: Giv
33
+ streetaddr: Somestreet
34
+ type: 1
35
+ services:
36
+ - gandilivedns
37
+ - dnssec
@@ -0,0 +1,20 @@
1
+ ---
2
+ - status: []
3
+ dates:
4
+ created_at: '2011-02-21T10:39:00Z'
5
+ registry_created_at: '2003-03-12T12:02:11Z'
6
+ registry_ends_at: '2020-03-12T12:02:11Z'
7
+ updated_at: '2019-02-06T09:49:37Z'
8
+ tags:
9
+ - Tag
10
+ fqdn: example.com
11
+ id: domain-uuid
12
+ autorenew: false
13
+ tld: com
14
+ owner: Example Owner
15
+ orga_owner: Example Organisation
16
+ domain_owner: Example Owner
17
+ nameserver:
18
+ current: livedns
19
+ href: https://api.gandi.net/v5/domain/domains/example.com
20
+ fqdn_unicode: example.com
@@ -0,0 +1,12 @@
1
+ ---
2
+ renew:
3
+ begins_at: '2012-01-01T00:00:00Z'
4
+ durations:
5
+ - 1
6
+ - 2
7
+ maximum: 2
8
+ minimum: 1
9
+ prohibited: false
10
+ contracts:
11
+ - id: uuid
12
+ name: Name
@@ -0,0 +1,5 @@
1
+ ---
2
+ restorable: true
3
+ contracts:
4
+ - id: uuid
5
+ name: Name
@@ -0,0 +1,10 @@
1
+ ---
2
+ category: ccTLD
3
+ name: eu
4
+ lock: false
5
+ change_owner: true
6
+ authinfo_for_transfer: true
7
+ full_tld: eu
8
+ corporate: false
9
+ ext_trade: true
10
+ href: https://api.test/v5/domain/tlds/eu
@@ -0,0 +1,7 @@
1
+ ---
2
+ - name: a
3
+ href: https://api.gandi.net/v5/domain/tlds/a
4
+ - name: b
5
+ href: https://api.gandi.net/v5/domain/tlds/b
6
+ - name: c
7
+ href: https://api.gandi.net/v5/domain/tlds/c
@@ -0,0 +1,16 @@
1
+ ---
2
+ address: address@example.com
3
+ aliases:
4
+ - alias-1
5
+ - alias-2
6
+ domain: example.com
7
+ href: https://api.test/api/v5/email/example.com/mailbox-uuid
8
+ id: mailbox-uuid
9
+ login: address
10
+ mailbox_type: standard
11
+ quota_used: 1000000
12
+ responder:
13
+ enabled: false
14
+ starts_at: '2000-01-01T00:00:00Z'
15
+ ends_at: '2000-01-02T00:00:00Z'
16
+ message: This is an autoresponse.
@@ -0,0 +1,8 @@
1
+ ---
2
+ - address: address@example.com
3
+ domain: example.com
4
+ href: https://api.test/api/v5/email/example.com/mailbox-uuid
5
+ id: mailbox-uuid
6
+ login: address
7
+ mailbox_type: standard
8
+ quota_used: 1000000
@@ -0,0 +1,10 @@
1
+ ---
2
+ status: inactive
3
+ capacity: 51200
4
+ refund_amount: 16.16
5
+ mailbox_type: premium
6
+ refundable: true
7
+ refund_currency: EUR
8
+ id: 125
9
+ href: http://api.test/v5/email/slots/mailbox-api-test-1.fr/125
10
+ created_at: '2019-04-08T08:48:41Z'
@@ -0,0 +1,8 @@
1
+ ---
2
+ - status: inactive
3
+ capacity: 3072
4
+ mailbox_type: standard
5
+ refundable: true
6
+ id: 125
7
+ href: http://api.test/v5/email/slots/mailbox-api-test-1.fr/125
8
+ created_at: '2019-04-08T08:48:41Z'
@@ -0,0 +1,4 @@
1
+ ---
2
+ zonedata: /zones/zone-uuid/recprds
3
+ fqdn: example.com
4
+ zone: /zones/zone-uuid
@@ -0,0 +1,2 @@
1
+ ---
2
+ - fqdn: example.com
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,9 @@
1
+ ---
2
+ date_created: '2016-12-16T16:51:26Z'
3
+ uuid: snapshot-uuid
4
+ zone_uuid: zone-uuid
5
+ zone_data:
6
+ - rrset_type: A
7
+ rrset_ttl: 10800
8
+ rrset_name: www
9
+ rrset_values: ['10.0.1.42']
@@ -0,0 +1,17 @@
1
+ ---
2
+ username: UserName
3
+ city: City
4
+ streetaddr: Street Address
5
+ zip: Post Code
6
+ name: FirstLast
7
+ firstname: First
8
+ lastname: Last
9
+ security_email: security@example.com
10
+ id: organization-uuid
11
+ phone: '+12.34567890'
12
+ security_phone: '+23.45678901'
13
+ country: GB
14
+ security_email_validated: true
15
+ security_email_validation_deadline: '2017-11-22T17:13:33Z'
16
+ email: username@example.com
17
+ lang: en
@@ -0,0 +1,54 @@
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
+ }
51
+ ]
52
+ http_version:
53
+ recorded_at: Thu, 30 May 2019 06:22:02 GMT
54
+ recorded_with: VCR 4.0.0