gandi_v5 0.2.0 → 0.3.0

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.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +1 -1
  4. data/.travis.yml +9 -0
  5. data/CHANGELOG.md +15 -0
  6. data/FUNDING.yml +10 -0
  7. data/README.md +7 -17
  8. data/gandi_v5.gemspec +3 -2
  9. data/lib/gandi_v5.rb +24 -10
  10. data/lib/gandi_v5/billing.rb +0 -2
  11. data/lib/gandi_v5/billing/info.rb +0 -2
  12. data/lib/gandi_v5/data.rb +0 -2
  13. data/lib/gandi_v5/data/converter.rb +0 -4
  14. data/lib/gandi_v5/domain.rb +159 -17
  15. data/lib/gandi_v5/domain/availability.rb +0 -3
  16. data/lib/gandi_v5/domain/availability/product.rb +0 -3
  17. data/lib/gandi_v5/domain/live_dns.rb +42 -0
  18. data/lib/gandi_v5/domain/renewal_information.rb +0 -3
  19. data/lib/gandi_v5/email.rb +0 -4
  20. data/lib/gandi_v5/email/forward.rb +108 -0
  21. data/lib/gandi_v5/email/mailbox.rb +0 -2
  22. data/lib/gandi_v5/error.rb +0 -2
  23. data/lib/gandi_v5/live_dns.rb +0 -4
  24. data/lib/gandi_v5/live_dns/domain.rb +1 -144
  25. data/lib/gandi_v5/live_dns/has_zone_records.rb +153 -0
  26. data/lib/gandi_v5/live_dns/zone.rb +1 -146
  27. data/lib/gandi_v5/organization.rb +28 -5
  28. data/lib/gandi_v5/version.rb +1 -1
  29. data/spec/.rubocop.yml +1 -1
  30. data/spec/features/domain_spec.rb +1 -1
  31. data/spec/fixtures/bodies/GandiV5_Billing/{info.yaml → info.yml} +0 -0
  32. data/spec/fixtures/bodies/GandiV5_Domain/{get.yaml → fetch.yml} +0 -0
  33. data/spec/fixtures/bodies/GandiV5_Domain/{fetch_contacts.yaml → fetch_contacts.yml} +0 -0
  34. data/spec/fixtures/bodies/GandiV5_Domain/fetch_glue_records.yml +7 -0
  35. data/spec/fixtures/bodies/GandiV5_Domain/fetch_livedns.yml +6 -0
  36. data/spec/fixtures/bodies/GandiV5_Domain/fetch_name_servers.yml +2 -0
  37. data/spec/fixtures/bodies/GandiV5_Domain/{renewal_info.yaml → fetch_renewal_info.yml} +0 -3
  38. data/spec/fixtures/bodies/GandiV5_Domain/{restore_info.yaml → fetch_restore_info.yml} +0 -0
  39. data/spec/fixtures/bodies/GandiV5_Domain/{list.yaml → list.yml} +1 -0
  40. data/spec/fixtures/bodies/GandiV5_Domain_Availability/{fetch.yaml → fetch.yml} +0 -0
  41. data/spec/fixtures/bodies/GandiV5_Domain_TLD/{fetch.yaml → fetch.yml} +0 -0
  42. data/spec/fixtures/bodies/GandiV5_Domain_TLD/{list.yaml → list.yml} +0 -0
  43. data/spec/fixtures/bodies/GandiV5_Email_Forward/list.yml +6 -0
  44. data/spec/fixtures/bodies/GandiV5_Email_Mailbox/{get.yaml → fetch.yml} +0 -0
  45. data/spec/fixtures/bodies/GandiV5_Email_Mailbox/{list.yaml → list.yml} +0 -0
  46. data/spec/fixtures/bodies/GandiV5_Email_Slot/{get.yaml → fetch.yml} +0 -0
  47. data/spec/fixtures/bodies/GandiV5_Email_Slot/{list.yaml → list.yml} +0 -0
  48. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/{get.yaml → fetch.yml} +0 -0
  49. data/spec/fixtures/bodies/GandiV5_LiveDNS_Domain/{list.yaml → list.yml} +0 -0
  50. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/{get.yaml → fetch.yml} +0 -0
  51. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone/{list.yaml → list.yml} +0 -0
  52. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/{fetch.yaml → fetch.yml} +0 -0
  53. data/spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/{list.yaml → list.yml} +0 -0
  54. data/spec/fixtures/bodies/GandiV5_Organization/{get.yaml → fetch.yml} +0 -0
  55. data/spec/fixtures/bodies/GandiV5_Organization/list.yml +7 -0
  56. data/spec/fixtures/vcr/Domain_features/List_domains.yml +2 -1
  57. data/spec/spec_helper.rb +2 -2
  58. data/spec/units/gandi_v5/billing_spec.rb +2 -2
  59. data/spec/units/gandi_v5/domain/availability_spec.rb +1 -1
  60. data/spec/units/gandi_v5/domain/live_dns_spec.rb +45 -0
  61. data/spec/units/gandi_v5/domain/tld_spec.rb +2 -2
  62. data/spec/units/gandi_v5/domain_spec.rb +241 -22
  63. data/spec/units/gandi_v5/email/forward_spec.rb +121 -0
  64. data/spec/units/gandi_v5/email/mailbox_spec.rb +3 -3
  65. data/spec/units/gandi_v5/email/slot_spec.rb +3 -3
  66. data/spec/units/gandi_v5/live_dns/domain_spec.rb +3 -3
  67. data/spec/units/gandi_v5/live_dns/zone/snapshot_spec.rb +2 -2
  68. data/spec/units/gandi_v5/live_dns/zone_spec.rb +2 -2
  69. data/spec/units/gandi_v5/organization_spec.rb +38 -1
  70. metadata +51 -77
  71. data/doc/GandiV5.html +0 -1183
  72. data/doc/GandiV5/Billing.html +0 -293
  73. data/doc/GandiV5/Billing/Info.html +0 -641
  74. data/doc/GandiV5/Billing/Info/Prepaid.html +0 -817
  75. data/doc/GandiV5/Data.html +0 -785
  76. data/doc/GandiV5/Data/ClassMethods.html +0 -223
  77. data/doc/GandiV5/Data/Converter.html +0 -433
  78. data/doc/GandiV5/Data/Converter/ArrayOf.html +0 -413
  79. data/doc/GandiV5/Data/Converter/Symbol.html +0 -322
  80. data/doc/GandiV5/Data/Converter/Time.html +0 -330
  81. data/doc/GandiV5/Domain.html +0 -16847
  82. data/doc/GandiV5/Domain/AutoRenew.html +0 -1237
  83. data/doc/GandiV5/Domain/Availability.html +0 -1020
  84. data/doc/GandiV5/Domain/Availability/Product.html +0 -988
  85. data/doc/GandiV5/Domain/Availability/Product/Period.html +0 -220
  86. data/doc/GandiV5/Domain/Availability/Product/Price.html +0 -1031
  87. data/doc/GandiV5/Domain/Availability/Tax.html +0 -440
  88. data/doc/GandiV5/Domain/Contact.html +0 -4459
  89. data/doc/GandiV5/Domain/Contract.html +0 -520
  90. data/doc/GandiV5/Domain/Dates.html +0 -1313
  91. data/doc/GandiV5/Domain/RenewalInformation.html +0 -1147
  92. data/doc/GandiV5/Domain/RestoreInformation.html +0 -339
  93. data/doc/GandiV5/Domain/SharingSpace.html +0 -437
  94. data/doc/GandiV5/Domain/TLD.html +0 -1565
  95. data/doc/GandiV5/Email.html +0 -144
  96. data/doc/GandiV5/Email/Mailbox.html +0 -6307
  97. data/doc/GandiV5/Email/Mailbox/Responder.html +0 -1560
  98. data/doc/GandiV5/Email/Offer.html +0 -514
  99. data/doc/GandiV5/Email/Slot.html +0 -4244
  100. data/doc/GandiV5/Error.html +0 -151
  101. data/doc/GandiV5/Error/GandiError.html +0 -270
  102. data/doc/GandiV5/LiveDNS.html +0 -300
  103. data/doc/GandiV5/LiveDNS/Domain.html +0 -2984
  104. data/doc/GandiV5/LiveDNS/RecordSet.html +0 -1593
  105. data/doc/GandiV5/LiveDNS/Zone.html +0 -8891
  106. data/doc/GandiV5/LiveDNS/Zone/Snapshot.html +0 -1556
  107. data/doc/GandiV5/Organization.html +0 -2341
  108. data/doc/_index.html +0 -474
  109. data/doc/class_list.html +0 -51
  110. data/doc/css/common.css +0 -1
  111. data/doc/css/full_list.css +0 -58
  112. data/doc/css/style.css +0 -496
  113. data/doc/file.README.html +0 -175
  114. data/doc/file_list.html +0 -56
  115. data/doc/frames.html +0 -17
  116. data/doc/index.html +0 -175
  117. data/doc/js/app.js +0 -303
  118. data/doc/js/full_list.js +0 -216
  119. data/doc/js/jquery.js +0 -4
  120. data/doc/method_list.html +0 -2427
  121. data/doc/top-level-namespace.html +0 -110
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::Email::Forward do
4
+ subject { described_class.new source: 'alice', destinations: ['bob@example.com'], fqdn: 'example.com' }
5
+
6
+ describe '#update' do
7
+ it 'ʘ‿ʘ' do
8
+ expect(GandiV5).to receive(:put).with(
9
+ 'https://api.gandi.net/v5/email/forwards/example.com/alice',
10
+ '{"destinations":["bob@example.com","charlie@example.com"]}'
11
+ )
12
+ .and_return([nil, { 'message' => 'Confirmation message.' }])
13
+ expect(subject.update('bob@example.com', 'charlie@example.com')).to eq 'Confirmation message.'
14
+ expect(subject.destinations).to match_array ['bob@example.com', 'charlie@example.com']
15
+ end
16
+
17
+ it 'Empty destinations' do
18
+ expect { subject.update }.to raise_error ArgumentError, 'destinations can\'t be empty'
19
+ end
20
+ end
21
+
22
+ it '#delete' do
23
+ expect(GandiV5).to receive(:delete).with(
24
+ 'https://api.gandi.net/v5/email/forwards/example.com/alice'
25
+ )
26
+ .and_return([nil, { 'message' => 'Confirmation message.' }])
27
+ expect(subject.delete).to eq 'Confirmation message.'
28
+ end
29
+
30
+ describe '#to_s' do
31
+ it 'With one destination' do
32
+ expect(subject.to_s).to eq 'alice@example.com -> bob@example.com'
33
+ end
34
+
35
+ it 'With many destinations' do
36
+ subject.instance_exec { @destinations = ['bob@example.com', 'charlie@example.com'] }
37
+ expect(subject.to_s).to eq 'alice@example.com -> bob@example.com, charlie@example.com'
38
+ end
39
+ end
40
+
41
+ describe '.create' do
42
+ it 'ʘ‿ʘ' do
43
+ response = double(
44
+ RestClient::Response,
45
+ headers: { location: 'https://api.gandi.net/v5/email/forwards/example.com/alice' }
46
+ )
47
+ expect(GandiV5).to receive(:post).with(
48
+ 'https://api.gandi.net/v5/email/forwards/example.com',
49
+ '{"source":"alice","destinations":["bob@example.com"]}'
50
+ )
51
+ .and_return([response, { 'message' => 'Confirmation message.' }])
52
+
53
+ forward = described_class.new fqdn: 'example.com', source: 'alice', destinations: ['bob@example.com']
54
+ expect(described_class.create('example.com', 'alice', 'bob@example.com').to_h).to eq forward.to_h
55
+ end
56
+
57
+ it 'Empty destinations' do
58
+ expect { described_class.create('example.com', 'alice') }.to raise_error ArgumentError, 'destinations can\'t be empty'
59
+ end
60
+ end
61
+
62
+ describe '.list' do
63
+ let(:body_fixture) do
64
+ File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Forward', 'list.yml'))
65
+ end
66
+
67
+ describe 'With default values' do
68
+ subject { described_class.list 'example.com' }
69
+
70
+ before :each do
71
+ headers = { params: { page: 1 } }
72
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/forwards/example.com', headers)
73
+ .and_return([nil, YAML.load_file(body_fixture)])
74
+ end
75
+
76
+ its('count') { should eq 1 }
77
+ its('first.source') { should eq 'alice' }
78
+ its('first.destinations') { should match_array ['bob@example.com', 'charlie@example.com'] }
79
+ its('first.fqdn') { should eq 'example.com' }
80
+ end
81
+
82
+ it 'Keeps fetching until no more to get' do
83
+ headers1 = { params: { page: 1, per_page: 1 } }
84
+ headers2 = { params: { page: 2, per_page: 1 } }
85
+ # https://github.com/rubocop-hq/rubocop/issues/7088
86
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/forwards/example.com', headers1)
87
+ .ordered
88
+ .and_return([nil, YAML.load_file(body_fixture)])
89
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/forwards/example.com', headers2)
90
+ .ordered
91
+ .and_return([nil, []])
92
+
93
+ expect(described_class.list('example.com', per_page: 1).count).to eq 1
94
+ end
95
+
96
+ it 'Given a range as page number' do
97
+ headers1 = { params: { page: 1, per_page: 1 } }
98
+ headers2 = { params: { page: 2, per_page: 1 } }
99
+ # https://github.com/rubocop-hq/rubocop/issues/7088
100
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/forwards/example.com', headers1)
101
+ .ordered
102
+ .and_return([nil, YAML.load_file(body_fixture)])
103
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/forwards/example.com', headers2)
104
+ .ordered
105
+ .and_return([nil, []])
106
+
107
+ expect(described_class.list('example.com', page: (1..2), per_page: 1).count).to eq 1
108
+ end
109
+
110
+ describe 'Passes optional query params' do
111
+ %i[source sort_by].each do |param|
112
+ it param.to_s do
113
+ headers = { params: { page: 1 }.merge(param => 'value') }
114
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/forwards/example.com', headers)
115
+ .and_return([nil, []])
116
+ expect(described_class.list('example.com', param => 'value')).to eq []
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -9,7 +9,7 @@ describe GandiV5::Email::Mailbox do
9
9
 
10
10
  describe '#refresh' do
11
11
  before :each do
12
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Mailbox', 'get.yaml'))
12
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Mailbox', 'fetch.yml'))
13
13
  expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/mailboxes/example.com/mailbox-uuid')
14
14
  .and_return([nil, YAML.load_file(body_fixture)])
15
15
  subject.refresh
@@ -260,7 +260,7 @@ describe GandiV5::Email::Mailbox do
260
260
  subject { described_class.fetch 'example.com', 'mailbox-uuid' }
261
261
 
262
262
  before :each do
263
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Mailbox', 'get.yaml'))
263
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Mailbox', 'fetch.yml'))
264
264
  expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/mailboxes/example.com/mailbox-uuid')
265
265
  .and_return([nil, YAML.load_file(body_fixture)])
266
266
  end
@@ -281,7 +281,7 @@ describe GandiV5::Email::Mailbox do
281
281
 
282
282
  describe '.list' do
283
283
  let(:body_fixture) do
284
- File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Mailbox', 'list.yaml'))
284
+ File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Mailbox', 'list.yml'))
285
285
  end
286
286
 
287
287
  describe 'With default values' do
@@ -28,7 +28,7 @@ describe GandiV5::Email::Slot do
28
28
 
29
29
  describe '#refresh' do
30
30
  before :each do
31
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Slot', 'get.yaml'))
31
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Slot', 'fetch.yml'))
32
32
  expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/slots/example.com/123')
33
33
  .and_return([nil, YAML.load_file(body_fixture)])
34
34
  subject.refresh
@@ -151,7 +151,7 @@ describe GandiV5::Email::Slot do
151
151
  subject { described_class.fetch 'example.com', 123 }
152
152
 
153
153
  before :each do
154
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Slot', 'get.yaml'))
154
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Slot', 'fetch.yml'))
155
155
  expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/slots/example.com/123')
156
156
  .and_return([nil, YAML.load_file(body_fixture)])
157
157
  end
@@ -171,7 +171,7 @@ describe GandiV5::Email::Slot do
171
171
  subject { described_class.list 'example.com' }
172
172
 
173
173
  before :each do
174
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Slot', 'list.yaml'))
174
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Email_Slot', 'list.yml'))
175
175
  expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/email/slots/example.com')
176
176
  .and_return([nil, YAML.load_file(body_fixture)])
177
177
  end
@@ -7,7 +7,7 @@ describe GandiV5::LiveDNS::Domain do
7
7
 
8
8
  describe '#refresh' do
9
9
  before :each do
10
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Domain', 'get.yaml'))
10
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Domain', 'fetch.yml'))
11
11
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/domains/example.com')
12
12
  .and_return([nil, YAML.load_file(body_fixture)])
13
13
  subject.refresh
@@ -252,7 +252,7 @@ describe GandiV5::LiveDNS::Domain do
252
252
  subject { described_class.list }
253
253
 
254
254
  before :each do
255
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Domain', 'list.yaml'))
255
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Domain', 'list.yml'))
256
256
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/domains')
257
257
  .and_return([nil, YAML.load_file(body_fixture)])
258
258
  end
@@ -266,7 +266,7 @@ describe GandiV5::LiveDNS::Domain do
266
266
  subject { described_class.fetch 'example.com' }
267
267
 
268
268
  before :each do
269
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Domain', 'get.yaml'))
269
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Domain', 'fetch.yml'))
270
270
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/domains/example.com')
271
271
  .and_return([nil, YAML.load_file(body_fixture)])
272
272
  end
@@ -39,7 +39,7 @@ describe GandiV5::LiveDNS::Zone::Snapshot do
39
39
  end
40
40
 
41
41
  it '.list' do
42
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone_Snapshot', 'list.yaml'))
42
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone_Snapshot', 'list.yml'))
43
43
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots')
44
44
  .and_return([nil, YAML.load_file(body_fixture)])
45
45
  expect(described_class.list('zone-uuid')).to eq('snapshot-uuid' => Time.new(2016, 12, 16, 16, 51, 26, 0))
@@ -49,7 +49,7 @@ describe GandiV5::LiveDNS::Zone::Snapshot do
49
49
  subject { described_class.fetch 'zone-uuid', 'snapshot-uuid' }
50
50
 
51
51
  before :each do
52
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone_Snapshot', 'fetch.yaml'))
52
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone_Snapshot', 'fetch.yml'))
53
53
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/zones/zone-uuid/snapshots/snapshot-uuid')
54
54
  .and_return([nil, YAML.load_file(body_fixture)])
55
55
  end
@@ -306,7 +306,7 @@ describe GandiV5::LiveDNS::Zone do
306
306
  subject { described_class.list }
307
307
 
308
308
  before :each do
309
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone', 'list.yaml'))
309
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone', 'list.yml'))
310
310
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/zones')
311
311
  .and_return([nil, YAML.load_file(body_fixture)])
312
312
  end
@@ -328,7 +328,7 @@ describe GandiV5::LiveDNS::Zone do
328
328
  subject { described_class.fetch 'zone-uuid' }
329
329
 
330
330
  before :each do
331
- body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone', 'get.yaml'))
331
+ body_fixture = File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_LiveDNS_Zone', 'fetch.yml'))
332
332
  expect(GandiV5).to receive(:get).with('https://dns.api.gandi.net/api/v5/zones/zone-uuid')
333
333
  .and_return([nil, YAML.load_file(body_fixture)])
334
334
  end
@@ -3,11 +3,48 @@
3
3
  describe GandiV5::Organization do
4
4
  let(:body_fixtures) { File.expand_path(File.join('spec', 'fixtures', 'bodies', 'GandiV5_Organization')) }
5
5
 
6
+ describe '.list' do
7
+ describe 'With default values' do
8
+ subject { described_class.list }
9
+
10
+ before :each do
11
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/organization/organizations', params: {})
12
+ .and_return([nil, YAML.load_file(File.join(body_fixtures, 'list.yml'))])
13
+ end
14
+
15
+ its('count') { should eq 1 }
16
+ its('first.uuid') { should eq 'organization-uuid' }
17
+ its('first.name') { should eq 'FirstLast' }
18
+ its('first.first_name') { should eq 'First' }
19
+ its('first.last_name') { should eq 'Last' }
20
+ end
21
+
22
+ describe 'Passes optional query params' do
23
+ it 'name' do
24
+ expect(GandiV5).to receive(:get).with(
25
+ 'https://api.gandi.net/v5/organization/organizations',
26
+ params: { '~name' => '5' }
27
+ )
28
+ .and_return([nil, []])
29
+ expect(described_class.list(name: '5')).to eq []
30
+ end
31
+
32
+ %i[type permission sort_by].each do |param|
33
+ it param.to_s do
34
+ headers = { param => 5 }
35
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/organization/organizations', params: headers)
36
+ .and_return([nil, []])
37
+ expect(described_class.list(**headers)).to eq []
38
+ end
39
+ end
40
+ end
41
+ end
42
+
6
43
  describe '.fetch' do
7
44
  subject { described_class.fetch }
8
45
  before :each do
9
46
  expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/organization/user-info')
10
- .and_return([nil, YAML.load_file(File.join(body_fixtures, 'get.yaml'))])
47
+ .and_return([nil, YAML.load_file(File.join(body_fixtures, 'fetch.yml'))])
11
48
  end
12
49
 
13
50
  its('uuid') { should eq 'organization-uuid' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gandi_v5
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gauld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-22 00:00:00.000000000 Z
11
+ date: 2019-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -44,20 +44,34 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: zeitwerk
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.1'
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: coveralls
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - "~>"
52
66
  - !ruby/object:Gem::Version
53
- version: '0.7'
67
+ version: '0.8'
54
68
  type: :development
55
69
  prerelease: false
56
70
  version_requirements: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - "~>"
59
73
  - !ruby/object:Gem::Version
60
- version: '0.7'
74
+ version: '0.8'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: guard
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -258,14 +272,14 @@ dependencies:
258
272
  requirements:
259
273
  - - "~>"
260
274
  - !ruby/object:Gem::Version
261
- version: '3.5'
275
+ version: '3.6'
262
276
  type: :development
263
277
  prerelease: false
264
278
  version_requirements: !ruby/object:Gem::Requirement
265
279
  requirements:
266
280
  - - "~>"
267
281
  - !ruby/object:Gem::Version
268
- version: '3.5'
282
+ version: '3.6'
269
283
  description:
270
284
  email:
271
285
  - robert@robertgauld.co.uk
@@ -279,63 +293,13 @@ files:
279
293
  - ".rubocop.yml"
280
294
  - ".travis.yml"
281
295
  - CHANGELOG.md
296
+ - FUNDING.yml
282
297
  - Gemfile
283
298
  - Guardfile
284
299
  - LICENSE.md
285
300
  - README.md
286
301
  - Rakefile
287
302
  - bin/console
288
- - doc/GandiV5.html
289
- - doc/GandiV5/Billing.html
290
- - doc/GandiV5/Billing/Info.html
291
- - doc/GandiV5/Billing/Info/Prepaid.html
292
- - doc/GandiV5/Data.html
293
- - doc/GandiV5/Data/ClassMethods.html
294
- - doc/GandiV5/Data/Converter.html
295
- - doc/GandiV5/Data/Converter/ArrayOf.html
296
- - doc/GandiV5/Data/Converter/Symbol.html
297
- - doc/GandiV5/Data/Converter/Time.html
298
- - doc/GandiV5/Domain.html
299
- - doc/GandiV5/Domain/AutoRenew.html
300
- - doc/GandiV5/Domain/Availability.html
301
- - doc/GandiV5/Domain/Availability/Product.html
302
- - doc/GandiV5/Domain/Availability/Product/Period.html
303
- - doc/GandiV5/Domain/Availability/Product/Price.html
304
- - doc/GandiV5/Domain/Availability/Tax.html
305
- - doc/GandiV5/Domain/Contact.html
306
- - doc/GandiV5/Domain/Contract.html
307
- - doc/GandiV5/Domain/Dates.html
308
- - doc/GandiV5/Domain/RenewalInformation.html
309
- - doc/GandiV5/Domain/RestoreInformation.html
310
- - doc/GandiV5/Domain/SharingSpace.html
311
- - doc/GandiV5/Domain/TLD.html
312
- - doc/GandiV5/Email.html
313
- - doc/GandiV5/Email/Mailbox.html
314
- - doc/GandiV5/Email/Mailbox/Responder.html
315
- - doc/GandiV5/Email/Offer.html
316
- - doc/GandiV5/Email/Slot.html
317
- - doc/GandiV5/Error.html
318
- - doc/GandiV5/Error/GandiError.html
319
- - doc/GandiV5/LiveDNS.html
320
- - doc/GandiV5/LiveDNS/Domain.html
321
- - doc/GandiV5/LiveDNS/RecordSet.html
322
- - doc/GandiV5/LiveDNS/Zone.html
323
- - doc/GandiV5/LiveDNS/Zone/Snapshot.html
324
- - doc/GandiV5/Organization.html
325
- - doc/_index.html
326
- - doc/class_list.html
327
- - doc/css/common.css
328
- - doc/css/full_list.css
329
- - doc/css/style.css
330
- - doc/file.README.html
331
- - doc/file_list.html
332
- - doc/frames.html
333
- - doc/index.html
334
- - doc/js/app.js
335
- - doc/js/full_list.js
336
- - doc/js/jquery.js
337
- - doc/method_list.html
338
- - doc/top-level-namespace.html
339
303
  - gandi_v5.gemspec
340
304
  - lib/gandi_v5.rb
341
305
  - lib/gandi_v5/billing.rb
@@ -356,11 +320,13 @@ files:
356
320
  - lib/gandi_v5/domain/contact.rb
357
321
  - lib/gandi_v5/domain/contract.rb
358
322
  - lib/gandi_v5/domain/dates.rb
323
+ - lib/gandi_v5/domain/live_dns.rb
359
324
  - lib/gandi_v5/domain/renewal_information.rb
360
325
  - lib/gandi_v5/domain/restore_information.rb
361
326
  - lib/gandi_v5/domain/sharing_space.rb
362
327
  - lib/gandi_v5/domain/tld.rb
363
328
  - lib/gandi_v5/email.rb
329
+ - lib/gandi_v5/email/forward.rb
364
330
  - lib/gandi_v5/email/mailbox.rb
365
331
  - lib/gandi_v5/email/mailbox/responder.rb
366
332
  - lib/gandi_v5/email/offer.rb
@@ -369,6 +335,7 @@ files:
369
335
  - lib/gandi_v5/error/gandi_error.rb
370
336
  - lib/gandi_v5/live_dns.rb
371
337
  - lib/gandi_v5/live_dns/domain.rb
338
+ - lib/gandi_v5/live_dns/has_zone_records.rb
372
339
  - lib/gandi_v5/live_dns/record_set.rb
373
340
  - lib/gandi_v5/live_dns/zone.rb
374
341
  - lib/gandi_v5/live_dns/zone/snapshot.rb
@@ -379,26 +346,31 @@ files:
379
346
  - spec/features/livedns_domain_spec.rb
380
347
  - spec/features/livedns_zone_spec.rb
381
348
  - spec/features/mailbox_spec.rb
382
- - spec/fixtures/bodies/GandiV5_Billing/info.yaml
383
- - spec/fixtures/bodies/GandiV5_Domain/fetch_contacts.yaml
384
- - spec/fixtures/bodies/GandiV5_Domain/get.yaml
385
- - spec/fixtures/bodies/GandiV5_Domain/list.yaml
386
- - spec/fixtures/bodies/GandiV5_Domain/renewal_info.yaml
387
- - spec/fixtures/bodies/GandiV5_Domain/restore_info.yaml
388
- - spec/fixtures/bodies/GandiV5_Domain_Availability/fetch.yaml
389
- - spec/fixtures/bodies/GandiV5_Domain_TLD/fetch.yaml
390
- - spec/fixtures/bodies/GandiV5_Domain_TLD/list.yaml
391
- - spec/fixtures/bodies/GandiV5_Email_Mailbox/get.yaml
392
- - spec/fixtures/bodies/GandiV5_Email_Mailbox/list.yaml
393
- - spec/fixtures/bodies/GandiV5_Email_Slot/get.yaml
394
- - spec/fixtures/bodies/GandiV5_Email_Slot/list.yaml
395
- - spec/fixtures/bodies/GandiV5_LiveDNS_Domain/get.yaml
396
- - spec/fixtures/bodies/GandiV5_LiveDNS_Domain/list.yaml
397
- - spec/fixtures/bodies/GandiV5_LiveDNS_Zone/get.yaml
398
- - spec/fixtures/bodies/GandiV5_LiveDNS_Zone/list.yaml
399
- - spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/fetch.yaml
400
- - spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/list.yaml
401
- - spec/fixtures/bodies/GandiV5_Organization/get.yaml
349
+ - spec/fixtures/bodies/GandiV5_Billing/info.yml
350
+ - spec/fixtures/bodies/GandiV5_Domain/fetch.yml
351
+ - spec/fixtures/bodies/GandiV5_Domain/fetch_contacts.yml
352
+ - spec/fixtures/bodies/GandiV5_Domain/fetch_glue_records.yml
353
+ - spec/fixtures/bodies/GandiV5_Domain/fetch_livedns.yml
354
+ - spec/fixtures/bodies/GandiV5_Domain/fetch_name_servers.yml
355
+ - spec/fixtures/bodies/GandiV5_Domain/fetch_renewal_info.yml
356
+ - spec/fixtures/bodies/GandiV5_Domain/fetch_restore_info.yml
357
+ - spec/fixtures/bodies/GandiV5_Domain/list.yml
358
+ - spec/fixtures/bodies/GandiV5_Domain_Availability/fetch.yml
359
+ - spec/fixtures/bodies/GandiV5_Domain_TLD/fetch.yml
360
+ - spec/fixtures/bodies/GandiV5_Domain_TLD/list.yml
361
+ - spec/fixtures/bodies/GandiV5_Email_Forward/list.yml
362
+ - spec/fixtures/bodies/GandiV5_Email_Mailbox/fetch.yml
363
+ - spec/fixtures/bodies/GandiV5_Email_Mailbox/list.yml
364
+ - spec/fixtures/bodies/GandiV5_Email_Slot/fetch.yml
365
+ - spec/fixtures/bodies/GandiV5_Email_Slot/list.yml
366
+ - spec/fixtures/bodies/GandiV5_LiveDNS_Domain/fetch.yml
367
+ - spec/fixtures/bodies/GandiV5_LiveDNS_Domain/list.yml
368
+ - spec/fixtures/bodies/GandiV5_LiveDNS_Zone/fetch.yml
369
+ - spec/fixtures/bodies/GandiV5_LiveDNS_Zone/list.yml
370
+ - spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/fetch.yml
371
+ - spec/fixtures/bodies/GandiV5_LiveDNS_Zone_Snapshot/list.yml
372
+ - spec/fixtures/bodies/GandiV5_Organization/fetch.yml
373
+ - spec/fixtures/bodies/GandiV5_Organization/list.yml
402
374
  - spec/fixtures/vcr/Domain_features/List_domains.yml
403
375
  - spec/fixtures/vcr/Domain_features/Renew_domain.yml
404
376
  - spec/fixtures/vcr/LiveDNS_Domain_features/List_domains.yml
@@ -425,11 +397,13 @@ files:
425
397
  - spec/units/gandi_v5/domain/contact_spec.rb
426
398
  - spec/units/gandi_v5/domain/contract_spec.rb
427
399
  - spec/units/gandi_v5/domain/dates_spec.rb
400
+ - spec/units/gandi_v5/domain/live_dns_spec.rb
428
401
  - spec/units/gandi_v5/domain/renewal_information_spec.rb
429
402
  - spec/units/gandi_v5/domain/restore_information_spec.rb
430
403
  - spec/units/gandi_v5/domain/sharing_space_spec.rb
431
404
  - spec/units/gandi_v5/domain/tld_spec.rb
432
405
  - spec/units/gandi_v5/domain_spec.rb
406
+ - spec/units/gandi_v5/email/forward_spec.rb
433
407
  - spec/units/gandi_v5/email/mailbox/responder_spec.rb
434
408
  - spec/units/gandi_v5/email/mailbox_spec.rb
435
409
  - spec/units/gandi_v5/email/offer_spec.rb