gandi_v5 0.7.0 → 0.8.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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +44 -0
  3. data/CHANGELOG.md +13 -0
  4. data/README.md +1 -0
  5. data/gandi_v5.gemspec +2 -2
  6. data/lib/gandi_v5/domain.rb +5 -3
  7. data/lib/gandi_v5/live_dns/domain.rb +2 -2
  8. data/lib/gandi_v5/sharing_space.rb +27 -0
  9. data/lib/gandi_v5/simple_hosting.rb +12 -0
  10. data/lib/gandi_v5/simple_hosting/instance.rb +242 -0
  11. data/lib/gandi_v5/simple_hosting/instance/application.rb +44 -0
  12. data/lib/gandi_v5/simple_hosting/instance/database.rb +19 -0
  13. data/lib/gandi_v5/simple_hosting/instance/language.rb +22 -0
  14. data/lib/gandi_v5/simple_hosting/instance/upgrade.rb +21 -0
  15. data/lib/gandi_v5/simple_hosting/instance/virtual_host.rb +187 -0
  16. data/lib/gandi_v5/simple_hosting/instance/virtual_host/linked_dns_zone.rb +74 -0
  17. data/lib/gandi_v5/version.rb +1 -1
  18. data/spec/.rubocop.yml +50 -3
  19. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance/fetch.yml +80 -0
  20. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance/list.yml +38 -0
  21. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance_VirtualHost/fetch.yml +26 -0
  22. data/spec/fixtures/bodies/GandiV5_SimpleHosting_Instance_VirtualHost/list.yml +18 -0
  23. data/spec/units/gandi_v5/domain_spec.rb +1 -1
  24. data/spec/units/gandi_v5/sharing_space_spec.rb +4 -0
  25. data/spec/units/gandi_v5/simple_hosting/instance/application_spec.rb +37 -0
  26. data/spec/units/gandi_v5/simple_hosting/instance/database_spec.rb +4 -0
  27. data/spec/units/gandi_v5/simple_hosting/instance/language_spec.rb +4 -0
  28. data/spec/units/gandi_v5/simple_hosting/instance/upgrade_spec.rb +4 -0
  29. data/spec/units/gandi_v5/simple_hosting/instance/virtual_host/linked_dns_zone_spec.rb +50 -0
  30. data/spec/units/gandi_v5/simple_hosting/instance/virtual_host_spec.rb +199 -0
  31. data/spec/units/gandi_v5/simple_hosting/instance_spec.rb +182 -0
  32. data/spec/units/gandi_v5/simple_hosting_spec.rb +9 -0
  33. metadata +28 -8
  34. data/lib/gandi_v5/domain/sharing_space.rb +0 -29
  35. data/spec/units/gandi_v5/domain/sharing_space_spec.rb +0 -4
@@ -0,0 +1,38 @@
1
+ ---
2
+ - available_upgrade: true
3
+ created_at: 2020-01-02T12:34:56+00
4
+ database:
5
+ name: database name
6
+ status: database status
7
+ version: database version
8
+ datacenter:
9
+ code: FR-SD5
10
+ name: SD5
11
+ region: FR
12
+ expire_at: 2021-01-02T12:34:56+00
13
+ id: instance-uuid
14
+ language:
15
+ name: ruby
16
+ single_application: true
17
+ status: great
18
+ version: "2.7"
19
+ name: instance name
20
+ sharing_space:
21
+ id: sharing-space-uuid
22
+ name: sharing space name
23
+ size: s+
24
+ snapshot_enabled: true
25
+ status: active
26
+ storage:
27
+ additional:
28
+ unit: GB
29
+ value: 10
30
+ base:
31
+ unit: GB
32
+ value: 20
33
+ total:
34
+ unit: GB
35
+ value: 30
36
+ autorenew:
37
+ duration: 1
38
+ duration_type: m
@@ -0,0 +1,26 @@
1
+ ---
2
+ created_at: 2020-01-02T12:34:56+00
3
+ fqdn: vh.example.com
4
+ is_a_test_vhost: false
5
+ linked_dns_zone:
6
+ allow_alteration: true
7
+ cname: cn
8
+ domain: example.com
9
+ ipv4: 1.2.3.4
10
+ ipv6: 1:2::3:4
11
+ is_alterable: true
12
+ is_root: true
13
+ key: www
14
+ txt: abcd1234
15
+ last_checked_status: unknown
16
+ last_checked_at: 2020-02-03T23:45:56+00
17
+ status: running
18
+ application:
19
+ name: app-name
20
+ status: being_created
21
+ parameters: {}
22
+ certificates:
23
+ - href: example.com
24
+ id: cert-id
25
+ pending: true
26
+ https_strategy: redirect_HTTP_to_HTTPS
@@ -0,0 +1,18 @@
1
+ ---
2
+ - created_at: 2020-01-02T12:34:56+00
3
+ fqdn: vh.example.com
4
+ is_a_test_vhost: false
5
+ linked_dns_zone:
6
+ allow_alteration: true
7
+ last_checked_status: unknown
8
+ last_checked_at: 2020-02-03T23:45:56+00
9
+ status: running
10
+ application:
11
+ name: app-name
12
+ status: being_created
13
+ parameters: {}
14
+ certificates:
15
+ - href: example.com
16
+ id: cert-id
17
+ pending: true
18
+ https_strategy: redirect_HTTP_to_HTTPS
@@ -45,7 +45,7 @@ describe GandiV5::Domain do
45
45
  end
46
46
 
47
47
  describe 'Passes optional query params' do
48
- %i[fqdn sort_by tld].each do |param|
48
+ %i[fqdn sort_by tld resellee_id].each do |param|
49
49
  it param.to_s do
50
50
  expect(GandiV5).to receive(:paginated_get).with(url, (1..), 100, params: { param => 5 })
51
51
  expect(described_class.list(param => 5)).to eq []
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SharingSpace do
4
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance::Application do
4
+ describe 'Helper methods' do
5
+ context 'being_created' do
6
+ subject { described_class.new status: :being_created }
7
+ its('being_created?') { should be true }
8
+ its('cancelled?') { should be false }
9
+ its('running?') { should be false }
10
+ its('error?') { should be false }
11
+ end
12
+
13
+ context 'cancelled' do
14
+ subject { described_class.new status: :cancelled }
15
+ its('being_created?') { should be false }
16
+ its('cancelled?') { should be true }
17
+ its('running?') { should be false }
18
+ its('error?') { should be false }
19
+ end
20
+
21
+ context 'running' do
22
+ subject { described_class.new status: :running }
23
+ its('being_created?') { should be false }
24
+ its('cancelled?') { should be false }
25
+ its('running?') { should be true }
26
+ its('error?') { should be false }
27
+ end
28
+
29
+ context 'error' do
30
+ subject { described_class.new status: :error }
31
+ its('being_created?') { should be false }
32
+ its('cancelled?') { should be false }
33
+ its('running?') { should be false }
34
+ its('error?') { should be true }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance::Database do
4
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance::Language do
4
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance::Upgrade do
4
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance::VirtualHost::LinkedDnsZone do
4
+ describe 'Helper methods' do
5
+ context 'altered' do
6
+ subject { described_class.new status: :altered }
7
+ its('altered?') { should be true }
8
+ its('livedns_conflict?') { should be false }
9
+ its('livedns_done?') { should be false }
10
+ its('livedns_error?') { should be false }
11
+ its('unknown?') { should be false }
12
+ end
13
+
14
+ context 'altered' do
15
+ subject { described_class.new status: :livedns_conflict }
16
+ its('altered?') { should be false }
17
+ its('livedns_conflict?') { should be true }
18
+ its('livedns_done?') { should be false }
19
+ its('livedns_error?') { should be false }
20
+ its('unknown?') { should be false }
21
+ end
22
+
23
+ context 'livedns_done' do
24
+ subject { described_class.new status: :livedns_done }
25
+ its('altered?') { should be false }
26
+ its('livedns_conflict?') { should be false }
27
+ its('livedns_done?') { should be true }
28
+ its('livedns_error?') { should be false }
29
+ its('unknown?') { should be false }
30
+ end
31
+
32
+ context 'livedns_error' do
33
+ subject { described_class.new status: :livedns_error }
34
+ its('altered?') { should be false }
35
+ its('livedns_conflict?') { should be false }
36
+ its('livedns_done?') { should be false }
37
+ its('livedns_error?') { should be true }
38
+ its('unknown?') { should be false }
39
+ end
40
+
41
+ context 'unknown' do
42
+ subject { described_class.new status: :unknown }
43
+ its('altered?') { should be false }
44
+ its('livedns_conflict?') { should be false }
45
+ its('livedns_done?') { should be false }
46
+ its('livedns_error?') { should be false }
47
+ its('unknown?') { should be true }
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,199 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance::VirtualHost do
4
+ let :body_list do
5
+ YAML.load_file(
6
+ File.expand_path(
7
+ File.join('spec', 'fixtures', 'bodies', 'GandiV5_SimpleHosting_Instance_VirtualHost', 'list.yml')
8
+ )
9
+ )
10
+ end
11
+ let :body_fetch do
12
+ YAML.load_file(
13
+ File.expand_path(
14
+ File.join('spec', 'fixtures', 'bodies', 'GandiV5_SimpleHosting_Instance_VirtualHost', 'fetch.yml')
15
+ )
16
+ )
17
+ end
18
+
19
+ subject do
20
+ described_class.new instance_uuid: 'instance-uuid', fqdn: 'vh.example.com'
21
+ end
22
+
23
+ it '#refresh' do
24
+ url = 'https://api.gandi.net/v5/simplehosting/instances/instance-uuid/vhosts/vh.example.com'
25
+ expect(GandiV5).to receive(:get).with(url)
26
+ .and_return([nil, body_fetch])
27
+ subject.refresh
28
+ expect(subject.linked_dns_zone.cname).to_not be nil
29
+ end
30
+
31
+ describe 'Helper methods' do
32
+ describe 'Status' do
33
+ context 'being_created' do
34
+ subject { described_class.new status: :being_created }
35
+ its('being_created?') { should be true }
36
+ its('running?') { should be false }
37
+ its('being_deleted?') { should be false }
38
+ its('locked?') { should be false }
39
+ its('waiting_ownership?') { should be false }
40
+ its('ownership_validated?') { should be false }
41
+ its('validation_failed?') { should be false }
42
+ end
43
+ context 'running' do
44
+ subject { described_class.new status: :running }
45
+ its('being_created?') { should be false }
46
+ its('running?') { should be true }
47
+ its('being_deleted?') { should be false }
48
+ its('locked?') { should be false }
49
+ its('waiting_ownership?') { should be false }
50
+ its('ownership_validated?') { should be false }
51
+ its('validation_failed?') { should be false }
52
+ end
53
+ context 'being_deleted' do
54
+ subject { described_class.new status: :being_deleted }
55
+ its('being_created?') { should be false }
56
+ its('running?') { should be false }
57
+ its('being_deleted?') { should be true }
58
+ its('locked?') { should be false }
59
+ its('waiting_ownership?') { should be false }
60
+ its('ownership_validated?') { should be false }
61
+ its('validation_failed?') { should be false }
62
+ end
63
+ context 'locked' do
64
+ subject { described_class.new status: :locked }
65
+ its('being_created?') { should be false }
66
+ its('running?') { should be false }
67
+ its('being_deleted?') { should be false }
68
+ its('locked?') { should be true }
69
+ its('waiting_ownership?') { should be false }
70
+ its('ownership_validated?') { should be false }
71
+ its('validation_failed?') { should be false }
72
+ end
73
+ context 'waiting_ownership' do
74
+ subject { described_class.new status: :waiting_ownership }
75
+ its('being_created?') { should be false }
76
+ its('running?') { should be false }
77
+ its('being_deleted?') { should be false }
78
+ its('locked?') { should be false }
79
+ its('waiting_ownership?') { should be true }
80
+ its('ownership_validated?') { should be false }
81
+ its('validation_failed?') { should be false }
82
+ end
83
+ context 'ownership_validated' do
84
+ subject { described_class.new status: :ownership_validated }
85
+ its('being_created?') { should be false }
86
+ its('running?') { should be false }
87
+ its('being_deleted?') { should be false }
88
+ its('locked?') { should be false }
89
+ its('waiting_ownership?') { should be false }
90
+ its('ownership_validated?') { should be true }
91
+ its('validation_failed?') { should be false }
92
+ end
93
+ context 'validation_failed' do
94
+ subject { described_class.new status: :validation_failed }
95
+ its('being_created?') { should be false }
96
+ its('running?') { should be false }
97
+ its('being_deleted?') { should be false }
98
+ its('locked?') { should be false }
99
+ its('waiting_ownership?') { should be false }
100
+ its('ownership_validated?') { should be false }
101
+ its('validation_failed?') { should be true }
102
+ end
103
+ end
104
+
105
+ describe 'HTTP(S)' do
106
+ context 'HTTP_only' do
107
+ subject { described_class.new https_strategy: :http_only }
108
+ its('http_only?') { should be true }
109
+ its('http_and_https?') { should be false }
110
+ its('redirect_http_to_https?') { should be false }
111
+ its('http?') { should be true }
112
+ its('https?') { should be false }
113
+ end
114
+ context 'HTTP_and_HTTPS' do
115
+ subject { described_class.new https_strategy: :http_and_https }
116
+ its('http_only?') { should be false }
117
+ its('http_and_https?') { should be true }
118
+ its('redirect_http_to_https?') { should be false }
119
+ its('http?') { should be true }
120
+ its('https?') { should be true }
121
+ end
122
+ context 'redirect_HTTP_to_HTTPS' do
123
+ subject { described_class.new https_strategy: :redirect_http_to_https }
124
+ its('http_only?') { should be false }
125
+ its('http_and_https?') { should be false }
126
+ its('redirect_http_to_https?') { should be true }
127
+ its('http?') { should be false }
128
+ its('https?') { should be false }
129
+ end
130
+ end
131
+ end
132
+
133
+ describe '.list' do
134
+ subject { described_class.list('instance-uuid') }
135
+ let(:url) { 'https://api.gandi.net/v5/simplehosting/instances/instance-uuid/vhosts' }
136
+
137
+ describe 'With default parameters' do
138
+ before :each do
139
+ expect(GandiV5).to receive(:paginated_get).with(url, (1..), 100, params: {})
140
+ .and_yield(body_list)
141
+ end
142
+
143
+ its('count') { should eq 1 }
144
+ its('first.created_at') { should eq Time.new(2020, 1, 2, 12, 34, 56, 0) }
145
+ its('first.fqdn') { should eq 'vh.example.com' }
146
+ its('first.is_a_test_virtual_host') { should be false }
147
+ its('first.linked_dns_zone.allow_alteration') { should be true }
148
+ its('first.linked_dns_zone.status') { should eq :unknown }
149
+ its('first.linked_dns_zone.last_checked_at') { should eq Time.new(2020, 2, 3, 23, 45, 56, 0) }
150
+ its('first.status') { should eq :running }
151
+ its('first.application.name') { should eq 'app-name' }
152
+ its('first.application.status') { should eq :being_created }
153
+ its('first.application.parameters') { should eq({}) }
154
+ its('first.certificates') { should eq({ 'cert-id' => true }) }
155
+ its('first.https_strategy') { should eq :redirect_http_to_https }
156
+ end
157
+
158
+ describe 'Passes optional query params' do
159
+ %i[fqdn status sort_by].each do |param|
160
+ it param do
161
+ expect(GandiV5).to receive(:paginated_get).with(url, (1..), 100, params: { param => 'value' })
162
+ .and_return([nil, []])
163
+ described_class.list('instance-uuid', param => 'value')
164
+ end
165
+ end
166
+ end
167
+ end
168
+
169
+ describe '.fetch' do
170
+ subject { described_class.fetch 'instance-uuid', 'vh.example.com' }
171
+
172
+ before :each do
173
+ url = 'https://api.gandi.net/v5/simplehosting/instances/instance-uuid/vhosts/vh.example.com'
174
+ expect(GandiV5).to receive(:get).with(url)
175
+ .and_return([nil, body_fetch])
176
+ end
177
+
178
+ its('created_at') { should eq Time.new(2020, 1, 2, 12, 34, 56, 0) }
179
+ its('fqdn') { should eq 'vh.example.com' }
180
+ its('is_a_test_virtual_host') { should be false }
181
+ its('linked_dns_zone.allow_alteration') { should be true }
182
+ its('linked_dns_zone.cname') { should eq 'cn' }
183
+ its('linked_dns_zone.domain') { should eq 'example.com' }
184
+ its('linked_dns_zone.ipv4') { should eq '1.2.3.4' }
185
+ its('linked_dns_zone.ipv6') { should eq '1:2::3:4' }
186
+ its('linked_dns_zone.is_alterable') { should be true }
187
+ its('linked_dns_zone.is_root') { should be true }
188
+ its('linked_dns_zone.key') { should eq 'www' }
189
+ its('linked_dns_zone.txt') { should eq 'abcd1234' }
190
+ its('linked_dns_zone.status') { should eq :unknown }
191
+ its('linked_dns_zone.last_checked_at') { should eq Time.new(2020, 2, 3, 23, 45, 56, 0) }
192
+ its('status') { should eq :running }
193
+ its('application.name') { should eq 'app-name' }
194
+ its('application.status') { should eq :being_created }
195
+ its('application.parameters') { should eq({}) }
196
+ its('certificates') { should eq({ 'cert-id' => true }) }
197
+ its('https_strategy') { should eq :redirect_http_to_https }
198
+ end
199
+ end
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe GandiV5::SimpleHosting::Instance do
4
+ let :body_list do
5
+ YAML.load_file(
6
+ File.expand_path(
7
+ File.join('spec', 'fixtures', 'bodies', 'GandiV5_SimpleHosting_Instance', 'list.yml')
8
+ )
9
+ )
10
+ end
11
+ let :body_fetch do
12
+ YAML.load_file(
13
+ File.expand_path(
14
+ File.join('spec', 'fixtures', 'bodies', 'GandiV5_SimpleHosting_Instance', 'fetch.yml')
15
+ )
16
+ )
17
+ end
18
+
19
+ subject do
20
+ described_class.new uuid: 'instance-uuid'
21
+ end
22
+
23
+ describe 'Actions' do
24
+ let(:url) { 'https://api.gandi.net/v5/simplehosting/instances/instance-uuid/action' }
25
+
26
+ %i[restart console reset_database_password].each do |action|
27
+ it ".#{action}" do
28
+ expect(GandiV5).to receive(:post).with(url, "{\"action\":\"#{action}\"}")
29
+ .and_return([nil, 'Confirmation message'])
30
+ expect(subject.send(action)).to eq 'Confirmation message'
31
+ end
32
+ end
33
+ end
34
+
35
+ it '#refresh' do
36
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/simplehosting/instances/instance-uuid')
37
+ .and_return([nil, body_fetch])
38
+ subject.refresh
39
+ expect(subject.access_information).to_not be nil
40
+ end
41
+
42
+ describe 'Helper methods' do
43
+ describe 'Status' do
44
+ context 'waiting_bill' do
45
+ subject { described_class.new status: :waiting_bill }
46
+ its('waiting_bill?') { should be true }
47
+ its('being_created?') { should be false }
48
+ its('active?') { should be false }
49
+ its('paused?') { should be false }
50
+ its('locked?') { should be false }
51
+ its('being_deleted?') { should be false }
52
+ end
53
+ context 'being_created' do
54
+ subject { described_class.new status: :being_created }
55
+ its('waiting_bill?') { should be false }
56
+ its('being_created?') { should be true }
57
+ its('active?') { should be false }
58
+ its('paused?') { should be false }
59
+ its('locked?') { should be false }
60
+ its('being_deleted?') { should be false }
61
+ end
62
+ context 'active' do
63
+ subject { described_class.new status: :active }
64
+ its('waiting_bill?') { should be false }
65
+ its('being_created?') { should be false }
66
+ its('active?') { should be true }
67
+ its('paused?') { should be false }
68
+ its('locked?') { should be false }
69
+ its('being_deleted?') { should be false }
70
+ end
71
+ context 'paused' do
72
+ subject { described_class.new status: :paused }
73
+ its('waiting_bill?') { should be false }
74
+ its('being_created?') { should be false }
75
+ its('active?') { should be false }
76
+ its('paused?') { should be true }
77
+ its('locked?') { should be false }
78
+ its('being_deleted?') { should be false }
79
+ end
80
+ context 'locked' do
81
+ subject { described_class.new status: :locked }
82
+ its('waiting_bill?') { should be false }
83
+ its('being_created?') { should be false }
84
+ its('active?') { should be false }
85
+ its('paused?') { should be false }
86
+ its('locked?') { should be true }
87
+ its('being_deleted?') { should be false }
88
+ end
89
+ context 'being_deleted' do
90
+ subject { described_class.new status: :being_deleted }
91
+ its('waiting_bill?') { should be false }
92
+ its('being_created?') { should be false }
93
+ its('active?') { should be false }
94
+ its('paused?') { should be false }
95
+ its('locked?') { should be false }
96
+ its('being_deleted?') { should be true }
97
+ end
98
+ end
99
+ end
100
+
101
+ describe '.list' do
102
+ subject { described_class.list }
103
+ let(:url) { 'https://api.gandi.net/v5/simplehosting/instances' }
104
+
105
+ describe 'With default parameters' do
106
+ before :each do
107
+ expect(GandiV5).to receive(:paginated_get).with(url, (1..), 100, params: {})
108
+ .and_yield(body_list)
109
+ end
110
+
111
+ its('count') { should eq 1 }
112
+ its('first.created_at') { should eq Time.new(2020, 1, 2, 12, 34, 56) }
113
+ its('first.database.name') { should eq 'database name' }
114
+ its('first.database.status') { should eq 'database status' }
115
+ its('first.database.version') { should eq 'database version' }
116
+ its('first.data_center') { should eq 'FR-SD5' }
117
+ its('first.expire_at') { should eq Time.new(2021, 1, 2, 12, 34, 56) }
118
+ its('first.uuid') { should eq 'instance-uuid' }
119
+ its('first.language.name') { should eq 'ruby' }
120
+ its('first.language.single_application') { should be true }
121
+ its('first.language.status') { should eq 'great' }
122
+ its('first.language.version') { should eq '2.7' }
123
+ its('first.name') { should eq 'instance name' }
124
+ its('first.sharing_space.uuid') { should eq 'sharing-space-uuid' }
125
+ its('first.sharing_space.name') { should eq 'sharing space name' }
126
+ its('first.size') { should eq 's+' }
127
+ its('first.snapshot_enabled') { should be true }
128
+ its('first.status') { should eq 'active' }
129
+ its('first.storage') { should eq({ base: '20 GB', additional: '10 GB', total: '30 GB' }) }
130
+ its('first.auto_renew') { should eq '1 m' }
131
+ end
132
+
133
+ describe 'Passes optional query params' do
134
+ %i[sharing_id name fqdn size status sort_by].each do |param|
135
+ it param do
136
+ expect(GandiV5).to receive(:paginated_get).with(url, (1..), 100, params: { param => 'value' })
137
+ .and_return([nil, []])
138
+ described_class.list(param => 'value')
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ describe '.fetch' do
145
+ subject { described_class.fetch 'instance-uuid' }
146
+
147
+ before :each do
148
+ expect(GandiV5).to receive(:get).with('https://api.gandi.net/v5/simplehosting/instances/instance-uuid')
149
+ .and_return([nil, body_fetch])
150
+ end
151
+
152
+ its('access_information') { should be_a Hash }
153
+ its('created_at') { should eq Time.new(2020, 1, 2, 12, 34, 56, 0) }
154
+ its('database.name') { should eq 'database name' }
155
+ its('database.status') { should eq 'database status' }
156
+ its('database.version') { should eq 'database version' }
157
+ its('data_center') { should eq 'FR-SD5' }
158
+ its('expire_at') { should eq Time.new(2021, 1, 2, 12, 34, 56, 0) }
159
+ its('uuid') { should eq 'instance-uuid' }
160
+ its('is_trial') { should be false }
161
+ its('language.name') { should eq 'ruby' }
162
+ its('language.single_application') { should be true }
163
+ its('language.status') { should eq 'great' }
164
+ its('language.version') { should eq '2.7' }
165
+ its('name') { should eq 'instance name' }
166
+ its('sharing_space.uuid') { should eq 'sharing-space-uuid' }
167
+ its('sharing_space.name') { should eq 'sharing space name' }
168
+ its('size') { should eq 's+' }
169
+ its('snapshot_enabled') { should be true }
170
+ its('status') { should eq 'active' }
171
+ its('storage') { should eq({ base: '20 GB', additional: '10 GB', total: '30 GB' }) }
172
+ its('virtual_hosts.first.fqdn') { should eq 'vhost1.example.com' }
173
+ its('auto_renew') { should eq '1 m' }
174
+ its('compatible_applications.first.name') { should eq 'compatable name' }
175
+ its('compatible_applications.first.parameters') { should be_a Hash }
176
+ its('password_updated_at') { should eq Time.new(2020, 6, 2, 12, 34, 56, 0) }
177
+ its('upgrade_to.first.name') { should eq 'upgrade to name' }
178
+ its('upgrade_to.first.status') { should eq 'upgrade to status' }
179
+ its('upgrade_to.first.type') { should eq 'database' }
180
+ its('upgrade_to.first.version') { should eq 'upgrade to version' }
181
+ end
182
+ end