leaseweb-rest-api 1.1.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +4 -4
- data/.rubocop.yml +4 -1
- data/{readme.md → README.md} +17 -25
- data/leaseweb-rest-api.gemspec +6 -8
- data/lib/leaseweb-rest-api.rb +139 -230
- metadata +11 -45
- data/lib/hash-to-uri-conversion.rb +0 -32
- data/spec/lib/leaseweb-rest-api_spec.rb +0 -648
- data/spec/spec_helper.rb +0 -17
- data/test/id_rsa +0 -54
- data/test/id_rsa.pub.pem +0 -14
metadata
CHANGED
@@ -1,59 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leaseweb-rest-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Leaseweb Product Owners
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.18.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: webmock
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
26
|
+
version: 0.18.0
|
55
27
|
description: Leaseweb REST API client for Ruby.
|
56
|
-
email:
|
28
|
+
email: productowners@leaseweb.com
|
57
29
|
executables: []
|
58
30
|
extensions: []
|
59
31
|
extra_rdoc_files: []
|
@@ -63,18 +35,13 @@ files:
|
|
63
35
|
- ".rubocop.yml"
|
64
36
|
- Gemfile
|
65
37
|
- LICENSE.txt
|
38
|
+
- README.md
|
66
39
|
- Rakefile
|
67
40
|
- leaseweb-rest-api.gemspec
|
68
|
-
- lib/hash-to-uri-conversion.rb
|
69
41
|
- lib/leaseweb-rest-api.rb
|
70
|
-
- readme.md
|
71
|
-
- spec/lib/leaseweb-rest-api_spec.rb
|
72
|
-
- spec/spec_helper.rb
|
73
|
-
- test/id_rsa
|
74
|
-
- test/id_rsa.pub.pem
|
75
42
|
homepage: https://github.com/LeaseWeb/leaseweb-rest-api
|
76
43
|
licenses:
|
77
|
-
- Apache
|
44
|
+
- Apache-2.0
|
78
45
|
metadata: {}
|
79
46
|
post_install_message:
|
80
47
|
rdoc_options: []
|
@@ -91,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
58
|
- !ruby/object:Gem::Version
|
92
59
|
version: '0'
|
93
60
|
requirements: []
|
94
|
-
|
95
|
-
rubygems_version: 2.6.11
|
61
|
+
rubygems_version: 3.1.2
|
96
62
|
signing_key:
|
97
63
|
specification_version: 4
|
98
64
|
summary: Leaseweb REST API client for Ruby
|
@@ -1,32 +0,0 @@
|
|
1
|
-
class HashToURIConversion
|
2
|
-
def to_params(hash)
|
3
|
-
params = hash.map { |k, v| normalize_param(k, v) }.join
|
4
|
-
params.chop! # trailing &
|
5
|
-
params
|
6
|
-
end
|
7
|
-
|
8
|
-
def normalize_param(key, value)
|
9
|
-
param = ''
|
10
|
-
stack = []
|
11
|
-
|
12
|
-
if value.is_a?(Array)
|
13
|
-
param << value.each_with_index.map { |element, i| normalize_param("#{key}[#{i}]", element) }.join
|
14
|
-
elsif value.is_a?(Hash)
|
15
|
-
stack << [key, value]
|
16
|
-
else
|
17
|
-
param << "#{key}=#{URI.encode(value.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}&"
|
18
|
-
end
|
19
|
-
|
20
|
-
stack.each do |parent, hash|
|
21
|
-
hash.each do |k, v|
|
22
|
-
if v.is_a?(Hash)
|
23
|
-
stack << ["#{parent}[#{k}]", v]
|
24
|
-
else
|
25
|
-
param << normalize_param("#{parent}[#{k}]", v)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
param
|
31
|
-
end
|
32
|
-
end
|
@@ -1,648 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require_relative '../../lib/leaseweb-rest-api'
|
3
|
-
|
4
|
-
describe LeasewebAPI do
|
5
|
-
let(:apikey) { 'e17b534d-3af6-4208-89e6-e43798b3c30f' }
|
6
|
-
let(:privateKey) { File.expand_path('./test/id_rsa') }
|
7
|
-
let(:password) { 'cdcHRt+,zVuZWtV2a7PkixZTn' }
|
8
|
-
let(:request_headers) do
|
9
|
-
{ 'X-Lsw-Auth' => apikey }
|
10
|
-
end
|
11
|
-
|
12
|
-
subject do
|
13
|
-
api = LeasewebAPI.new
|
14
|
-
api.apiKeyAuth(apikey)
|
15
|
-
api.readPrivateKey(privateKey, password)
|
16
|
-
api
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#getDomains' do
|
20
|
-
let(:response) { '{}' }
|
21
|
-
|
22
|
-
it 'returns a list of all the domains assigned to the account' do
|
23
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/domains')
|
24
|
-
.with(headers: request_headers)
|
25
|
-
.to_return(status: 200, body: response, headers: {})
|
26
|
-
|
27
|
-
subject.getDomains
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#getDomain' do
|
32
|
-
let(:response) { '{}' }
|
33
|
-
|
34
|
-
it 'returns a representation of a domain resource' do
|
35
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/domains/example.com')
|
36
|
-
.with(headers: request_headers)
|
37
|
-
.to_return(status: 200, body: response, headers: {})
|
38
|
-
|
39
|
-
subject.getDomain('example.com')
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#updateDomain' do
|
44
|
-
let(:response) { '{}' }
|
45
|
-
|
46
|
-
it 'updates a domain' do
|
47
|
-
body = 'ttl=86400'
|
48
|
-
|
49
|
-
stub_request(:put, 'https://api.leaseweb.com/v1/domains/example.com')
|
50
|
-
.with(headers: request_headers, body: body)
|
51
|
-
.to_return(status: 200, body: response, headers: {})
|
52
|
-
|
53
|
-
subject.updateDomain('example.com', 86_400)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#getDNSRecords' do
|
58
|
-
let(:response) { '{}' }
|
59
|
-
|
60
|
-
it 'returns a representation of a specific dnsRecords of a domain' do
|
61
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/domains/example.com/dnsRecords')
|
62
|
-
.with(headers: request_headers)
|
63
|
-
.to_return(status: 200, body: response, headers: {})
|
64
|
-
|
65
|
-
subject.getDNSRecords('example.com')
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe '#createDNSRecords' do
|
70
|
-
let(:response) { '{}' }
|
71
|
-
|
72
|
-
it 'creates a new dns record' do
|
73
|
-
body = 'host=example.com&content=123.123.123.123&type=MX&priority=10'
|
74
|
-
|
75
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/domains/example.com/dnsRecords')
|
76
|
-
.with(headers: request_headers, body: body)
|
77
|
-
.to_return(status: 200, body: response, headers: {})
|
78
|
-
|
79
|
-
subject.createDNSRecords('example.com', 'example.com', '123.123.123.123', 'MX', 10)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe '#getDNSRecord' do
|
84
|
-
let(:response) { '{}' }
|
85
|
-
|
86
|
-
it 'returns a representation of a specific dnsRecord of a domain' do
|
87
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/domains/example.com/dnsRecords/123')
|
88
|
-
.with(headers: request_headers)
|
89
|
-
.to_return(status: 200, body: response, headers: {})
|
90
|
-
|
91
|
-
subject.getDNSRecord('example.com', 123)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe '#updateDNSRecord' do
|
96
|
-
let(:response) { '{}' }
|
97
|
-
|
98
|
-
it 'updates a dns record' do
|
99
|
-
body = 'id=123&host=example.com&content=10.10.10.10&type=MX&priority=20'
|
100
|
-
|
101
|
-
stub_request(:put, 'https://api.leaseweb.com/v1/domains/example.com/dnsRecords/123')
|
102
|
-
.with(headers: request_headers, body: body)
|
103
|
-
.to_return(status: 200, body: response, headers: {})
|
104
|
-
|
105
|
-
subject.updateDNSRecord('example.com', '123', 'example.com', '10.10.10.10', 'MX', '20')
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe '#deleteDNSRecord' do
|
110
|
-
let(:response) { '{}' }
|
111
|
-
|
112
|
-
it 'deletes a dns record for a domain' do
|
113
|
-
stub_request(:delete, 'https://api.leaseweb.com/v1/domains/example.com/dnsRecords/123')
|
114
|
-
.with(headers: request_headers)
|
115
|
-
.to_return(status: 200, body: response, headers: {})
|
116
|
-
|
117
|
-
subject.deleteDNSRecord('example.com', '123')
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe '#getRescueImages' do
|
122
|
-
let(:response) do
|
123
|
-
'{"rescueImages":[{"rescueImage":{"id":121,"name":"FreeBSD Rescue 2.1 (amd64)"}},{"rescueImage":{"id":122,"name":"FreeBSD Rescue 2.1 (x86)"}},{"rescueImage":{"id":137,"name":"Rescue 2.1 (amd64)"}},{"rescueImage":{"id":138,"name":"Rescue 2.1 (x86)"}}]}'
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'returns all your available rescue images' do
|
127
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/rescueImages')
|
128
|
-
.with(headers: request_headers)
|
129
|
-
.to_return(status: 200, body: response, headers: {})
|
130
|
-
|
131
|
-
subject.getRescueImages
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe '#getBareMetals' do
|
136
|
-
let(:response) do
|
137
|
-
'{"bareMetals":[{"bareMetal":{"reference":null,"bareMetalId":"114916","serverName":"LSPG003","serverType":"Bare Metal"}},{"bareMetal":{"reference":null,"bareMetalId":"198969","serverName":"LSPG001","serverType":"Bare Metal"}},{"bareMetal":{"reference":null,"bareMetalId":"198970","serverName":"LSPG002","serverType":"Bare Metal"}}]}'
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'returns the id of all your Bare Metal servers' do
|
141
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals')
|
142
|
-
.with(headers: request_headers)
|
143
|
-
.to_return(status: 200, body: response, headers: {})
|
144
|
-
|
145
|
-
subject.getBareMetals
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe '#getBareMetal' do
|
150
|
-
let(:response) do
|
151
|
-
'{"bareMetal":{"reference":null,"location":{"site":"SFO-12","cabinet":"0209","rackspace":"-","combinationLock":"-"},"server":{"ram":"16GB","kvm":"No","serverType":"Preinstalled SFO12.300.0209 DL120 G7","processorType":"Intel Quad-Core Xeon E3-1230","processorSpeed":"3200 Mhz","numberOfCpus":1,"numberOfCores":4,"hardDisks":" 2x1TB ","hardwareRaid":"No"},"network":{"dataPack":"Connectivity - see other packs","ipsFreeOfCharge":"1","ipsAssigned":1,"excessIpsPrice":"0.00","dataPackExcess":{"type":"","value":"0.00","unit":""},"macAddresses":{"mac":["C8:CB:B8:C5:17:0C","C8:CB:B8:C5:17:0D"]}},"extras":{"extra":{"service":"Private network: 100Mbps"}},"bareMetalId":"114916","serverName":"LSPG003","serverType":"Bare Metal","serverHostingPack":{"reference":null,"bareMetalId":"114916","serverName":"LSPG003","serverType":"Bare Metal","startDate":"Jul 1, 2012","endDate":"","contractTerm":"3 month(s)"},"serverSpecifications":[],"serviceLevelAgreement":{"sla":"Basic - 24x7x24"},"datacenterAccessCards":{"accessCards":["0",[]]}}}'
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'returns the data of your Bare Metal server' do
|
155
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916')
|
156
|
-
.with(headers: request_headers)
|
157
|
-
.to_return(status: 200, body: response, headers: {})
|
158
|
-
|
159
|
-
subject.getBareMetal(114_916)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
describe '#updateBareMetal' do
|
164
|
-
let(:response) { '{}' }
|
165
|
-
|
166
|
-
it 'updates a bareMetal' do
|
167
|
-
body = 'reference=test'
|
168
|
-
|
169
|
-
stub_request(:put, 'https://api.leaseweb.com/v1/bareMetals/114916')
|
170
|
-
.with(headers: request_headers, body: body)
|
171
|
-
.to_return(status: 200, body: response, headers: {})
|
172
|
-
|
173
|
-
subject.updateBareMetal(114_916, 'test')
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe '#getSwitchPort' do
|
178
|
-
let(:response) do
|
179
|
-
'{"switchPort":{"status":"open","serverId":"114916","serverName":"LSPG003","switchNode":1}}'
|
180
|
-
end
|
181
|
-
|
182
|
-
it 'returns the switchport status of your Bare Metal server' do
|
183
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/switchPort')
|
184
|
-
.with(headers: request_headers)
|
185
|
-
.to_return(status: 200, body: response, headers: {})
|
186
|
-
|
187
|
-
subject.getSwitchPort(114_916)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe '#postSwitchPortOpen' do
|
192
|
-
let(:response) { '{}' }
|
193
|
-
|
194
|
-
it 'opens the switch port of your Bare Metal server' do
|
195
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/bareMetals/114916/switchPort/open')
|
196
|
-
.with(headers: request_headers)
|
197
|
-
.to_return(status: 200, body: response, headers: {})
|
198
|
-
|
199
|
-
subject.postSwitchPortOpen(114_916)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
describe '#postSwitchPortClose' do
|
204
|
-
let(:response) { '{}' }
|
205
|
-
|
206
|
-
it 'closes the switch port of your Bare Metal server' do
|
207
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/bareMetals/114916/switchPort/close')
|
208
|
-
.with(headers: request_headers)
|
209
|
-
.to_return(status: 200, body: response, headers: {})
|
210
|
-
|
211
|
-
subject.postSwitchPortClose(114_916)
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
describe '#getPowerStatus' do
|
216
|
-
let(:response) do
|
217
|
-
'{"powerStatus":{"status":"on","serverId":"114916","serverName":"LSPG003"}}'
|
218
|
-
end
|
219
|
-
|
220
|
-
it 'returns the power status of your Bare Metal server' do
|
221
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/powerStatus')
|
222
|
-
.with(headers: request_headers)
|
223
|
-
.to_return(status: 200, body: response, headers: {})
|
224
|
-
|
225
|
-
subject.getPowerStatus(114_916)
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
describe '#getIPs' do
|
230
|
-
let(:response) do
|
231
|
-
'{"ips":[{"ip":{"ip":"209.58.131.10","reverseLookup":"","ipDetails":{"gateway":"209.58.131.62","mask":"255.255.255.192"},"nullRouted":false,"billingInformation":{"price":"0.00","startDate":"Jun 1, 2015","endDate":null},"serverId":"114916","serverType":"Bare Metal","serverName":"LSPG003"}}]}'
|
232
|
-
end
|
233
|
-
|
234
|
-
it 'returns the ips of your Bare Metal server' do
|
235
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/ips')
|
236
|
-
.with(headers: request_headers)
|
237
|
-
.to_return(status: 200, body: response, headers: {})
|
238
|
-
|
239
|
-
subject.getIPs(114_916)
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
describe '#getIP' do
|
244
|
-
let(:response) do
|
245
|
-
'{"ip":{"ip":"209.58.131.10","reverseLookup":"","ipDetails":{"gateway":"209.58.131.62","mask":"255.255.255.192"},"nullRouted":false,"billingInformation":{"price":"0.00","startDate":"Jun 1, 2015","endDate":null},"serverId":"114916","serverType":"Bare Metal","serverName":"LSPG003"}}'
|
246
|
-
end
|
247
|
-
|
248
|
-
it 'returns information about the ip of your Bare Metal server' do
|
249
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/ips/209.58.131.10')
|
250
|
-
.with(headers: request_headers)
|
251
|
-
.to_return(status: 200, body: response, headers: {})
|
252
|
-
|
253
|
-
subject.getIP(114_916, '209.58.131.10')
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
describe '#updateIP' do
|
258
|
-
let(:response) { '{}' }
|
259
|
-
|
260
|
-
it 'updates information of the ip of your Bare Metal server' do
|
261
|
-
stub_request(:put, 'https://api.leaseweb.com/v1/bareMetals/114916/ips/209.58.131.10')
|
262
|
-
.with(headers: request_headers)
|
263
|
-
.to_return(status: 200, body: response, headers: {})
|
264
|
-
|
265
|
-
subject.updateIP(114_916, '209.58.131.10', 'modified-by-api.leaseweb.com', 1)
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
describe '#getNetworkUsage' do
|
270
|
-
let(:response) do
|
271
|
-
'{"bandwidth":{"measurement":{"node":{"in":"-","out":"-","total":"10.91 Kbps"},"total":"10.91 Kbps","average":"10.91 Kbps"},"overusage":"0 bps","serverId":114916,"serverName":"LSPG003","interval":{"from":"09-05-2015","to":"08-06-2015"},"monthlyThreshold":"0 Mbps"},"dataTraffic":{"measurement":{"node":{"in":"3.5 GB","out":"523.81 MB","total":"4.02 GB"},"total":"4.02 GB"},"overusage":"0 B","serverId":114916,"serverName":"LSPG003","interval":{"from":"09-05-2015","to":"08-06-2015"},"monthlyThreshold":"0 GB"}}'
|
272
|
-
end
|
273
|
-
|
274
|
-
it 'returns network usage details of a bareMetal server' do
|
275
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/networkUsage')
|
276
|
-
.with(headers: request_headers)
|
277
|
-
.to_return(status: 200, body: response, headers: {})
|
278
|
-
|
279
|
-
subject.getNetworkUsage(114_916)
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
describe '#getNetworkUsageBandWidth' do
|
284
|
-
let(:response) do
|
285
|
-
'{"bandwidth":{"measurement":{"node":{"in":"-","out":"-","total":"10.91 Kbps"},"total":"10.91 Kbps","average":"10.91 Kbps"},"overusage":"0 bps","serverId":114916,"serverName":"LSPG003","interval":{"from":"09-05-2015","to":"08-06-2015"},"monthlyThreshold":"0 Mbps"},"dataTraffic":{"measurement":{"node":{"in":"3.5 GB","out":"523.81 MB","total":"4.02 GB"},"total":"4.02 GB"},"overusage":"0 B","serverId":114916,"serverName":"LSPG003","interval":{"from":"09-05-2015","to":"08-06-2015"},"monthlyThreshold":"0 GB"}}'
|
286
|
-
end
|
287
|
-
|
288
|
-
it 'returns network usage details of a bareMetal server' do
|
289
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/networkUsage/bandWidth?dateFrom=06-04-2015&dateTo=06-05-2015')
|
290
|
-
.with(headers: request_headers)
|
291
|
-
.to_return(status: 200, body: response, headers: {})
|
292
|
-
|
293
|
-
subject.getNetworkUsageBandWidth(114_916, '06-04-2015', '06-05-2015', 'json')
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
describe '#getNetworkUsageDataTraffic' do
|
298
|
-
let(:response) do
|
299
|
-
'{"dataTraffic":{"measurement":{"node":{"in":"370.71 MB","out":"98.07 MB","total":"468.78 MB"},"total":"468.78 MB"},"overusage":"0 B","serverId":198969,"serverName":"LSPG001","interval":{"from":"06-04-2015","to":"06-05-2015"},"monthlyThreshold":"0 GB"}}'
|
300
|
-
end
|
301
|
-
|
302
|
-
it 'returns network usage details of a bareMetal server' do
|
303
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/networkUsage/dataTraffic?dateFrom=06-04-2015&dateTo=06-05-2015')
|
304
|
-
.with(headers: request_headers)
|
305
|
-
.to_return(status: 200, body: response, headers: {})
|
306
|
-
|
307
|
-
subject.getNetworkUsageDataTraffic(114_916, '06-04-2015', '06-05-2015', 'json')
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
describe '#postReboot' do
|
312
|
-
let(:response) { '{}' }
|
313
|
-
|
314
|
-
it 'performs a reboot of the server' do
|
315
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/bareMetals/114916/reboot')
|
316
|
-
.with(headers: request_headers)
|
317
|
-
.to_return(status: 200, body: response, headers: {})
|
318
|
-
|
319
|
-
subject.postReboot(114_916)
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
describe '#installServer' do
|
324
|
-
let(:response) { '{}' }
|
325
|
-
|
326
|
-
it 'performs a re-installation of the server' do
|
327
|
-
body = 'osId=1899'
|
328
|
-
|
329
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/bareMetals/114916/install')
|
330
|
-
.with(headers: request_headers, body: body)
|
331
|
-
.to_return(status: 200, body: response, headers: {})
|
332
|
-
|
333
|
-
subject.installServer(114_916, 1899)
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
describe '#postResqueMode' do
|
338
|
-
let(:response) { '{}' }
|
339
|
-
|
340
|
-
it 'Launches the rescue mode for this bare metal server' do
|
341
|
-
body = 'osId=121'
|
342
|
-
|
343
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/bareMetals/114916/rescueMode')
|
344
|
-
.with(headers: request_headers, body: body)
|
345
|
-
.to_return(status: 200, body: response, headers: {})
|
346
|
-
|
347
|
-
subject.postResqueMode(114_916, 121)
|
348
|
-
end
|
349
|
-
end
|
350
|
-
|
351
|
-
describe '#getRootPassword' do
|
352
|
-
let(:response) do
|
353
|
-
'{"dataTraffic":{"measurement":{"node":{"in":"370.71 MB","out":"98.07 MB","total":"468.78 MB"},"total":"468.78 MB"},"overusage":"0 B","serverId":198969,"serverName":"LSPG001","interval":{"from":"06-04-2015","to":"06-05-2015"},"monthlyThreshold":"0 GB"}}'
|
354
|
-
end
|
355
|
-
|
356
|
-
it 'returns the root password of the server' do
|
357
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/rootPassword')
|
358
|
-
.with(headers: request_headers)
|
359
|
-
.to_return(status: 200, body: response, headers: {})
|
360
|
-
|
361
|
-
subject.getRootPassword(114_916, 'json')
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
describe '#getInstallationStatus' do
|
366
|
-
let(:response) do
|
367
|
-
'{"installationStatus":{"code":1000,"description":"Installing","serverPackId":"114916","serverName":"LSPG003"}}'
|
368
|
-
end
|
369
|
-
|
370
|
-
it 'returns the installation status of the server' do
|
371
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/installationStatus')
|
372
|
-
.with(headers: request_headers)
|
373
|
-
.to_return(status: 200, body: response, headers: {})
|
374
|
-
|
375
|
-
subject.getInstallationStatus(114_916)
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
describe '#getLeases' do
|
380
|
-
let(:response) do
|
381
|
-
'{"_metadata":{"totalCount":1,"limit":10,"offset":0},"leases":[{"ip":"209.58.131.10","pop":"SFO-12","mac":"C8:CB:B8:C5:17:0C","scope":"209.58.131.0","options":[{"name":"Bootfile Name","optionId":"67","policyName":null,"type":"String","userClass":"","value":"undionly.kpxe","vendorClass":""},{"name":"DNS Servers","optionId":"6","policyName":null,"type":"IPv4Address","userClass":"","value":"209.58.128.22,209.58.135.185","vendorClass":""},{"name":"Boot Server Host Name","optionId":"66","policyName":null,"type":"String","userClass":"","value":"209.58.128.13","vendorClass":""},{"name":"Bootfile Name","optionId":"67","policyName":null,"type":"String","userClass":"gPXE","value":"http:\\/\\/95.211.51.8\\/server\\/getPxeConfig\\/serverId\\/58898\\/key\\/86504289080a3a914ac53912ea55336f","vendorClass":""}]}]}'
|
382
|
-
end
|
383
|
-
|
384
|
-
it 'returns a list of DHCP Leases for every MAC Address for a given bare metal' do
|
385
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/leases')
|
386
|
-
.with(headers: request_headers)
|
387
|
-
.to_return(status: 200, body: response, headers: {})
|
388
|
-
|
389
|
-
subject.getLeases(114_916)
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
describe '#setLease' do
|
394
|
-
let(:response) { '{}' }
|
395
|
-
|
396
|
-
it 'Creates a new DHCP lease' do
|
397
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/bareMetals/114916/leases')
|
398
|
-
.with(headers: request_headers)
|
399
|
-
.to_return(status: 200, body: response, headers: {})
|
400
|
-
|
401
|
-
subject.setLease(114_916, 'http://example.com/boot.ipxe')
|
402
|
-
end
|
403
|
-
end
|
404
|
-
|
405
|
-
describe '#getLease' do
|
406
|
-
let(:response) do
|
407
|
-
'{"ip":"209.58.131.10","pop":"SFO-12","mac":"C8:CB:B8:C5:17:0C","scope":"209.58.131.0","options":[{"name":"Bootfile Name","optionId":"67","policyName":null,"type":"String","userClass":"","value":"undionly.kpxe","vendorClass":""},{"name":"DNS Servers","optionId":"6","policyName":null,"type":"IPv4Address","userClass":"","value":"209.58.128.22,209.58.135.185","vendorClass":""},{"name":"Boot Server Host Name","optionId":"66","policyName":null,"type":"String","userClass":"","value":"209.58.128.13","vendorClass":""},{"name":"Bootfile Name","optionId":"67","policyName":null,"type":"String","userClass":"gPXE","value":"http:\\/\\/95.211.51.8\\/server\\/getPxeConfig\\/serverId\\/58898\\/key\\/86504289080a3a914ac53912ea55336f","vendorClass":""}]}'
|
408
|
-
end
|
409
|
-
|
410
|
-
it 'returns a DHCP Lease for every MAC Address for a bare metal with specific MAC address' do
|
411
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/bareMetals/114916/leases/C8:CB:B8:C5:17:0C')
|
412
|
-
.with(headers: request_headers)
|
413
|
-
.to_return(status: 200, body: response, headers: {})
|
414
|
-
|
415
|
-
subject.getLease(114_916, 'C8:CB:B8:C5:17:0C')
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
describe '#deleteLease' do
|
420
|
-
let(:response) { '{}' }
|
421
|
-
|
422
|
-
it 'deletes a DHCP lease for a specific mac address' do
|
423
|
-
stub_request(:delete, 'https://api.leaseweb.com/v1/bareMetals/114916/leases/C8:CB:B8:C5:17:0C')
|
424
|
-
.with(headers: request_headers)
|
425
|
-
.to_return(status: 200, body: response, headers: {})
|
426
|
-
|
427
|
-
subject.deleteLease(114_916, 'C8:CB:B8:C5:17:0C')
|
428
|
-
end
|
429
|
-
end
|
430
|
-
|
431
|
-
describe '#getPrivateNetworks' do
|
432
|
-
let(:response) do
|
433
|
-
'{"meta":{"first_page":1,"last_page":1,"previous_page":null,"current_page":1,"next_page":null,"total_results":1,"results_per_page":50},"results":[{"id":157,"name":""}]}'
|
434
|
-
end
|
435
|
-
|
436
|
-
it 'returns a list of all your privatenetworks' do
|
437
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/privateNetworks')
|
438
|
-
.with(headers: request_headers)
|
439
|
-
.to_return(status: 200, body: response, headers: {})
|
440
|
-
|
441
|
-
subject.getPrivateNetworks
|
442
|
-
end
|
443
|
-
end
|
444
|
-
|
445
|
-
describe '#createPrivateNetworks' do
|
446
|
-
let(:response) { '{}' }
|
447
|
-
|
448
|
-
it 'Creates a new private network' do
|
449
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/privateNetworks')
|
450
|
-
.with(headers: request_headers)
|
451
|
-
.to_return(status: 200, body: response, headers: {})
|
452
|
-
|
453
|
-
subject.createPrivateNetworks
|
454
|
-
end
|
455
|
-
end
|
456
|
-
|
457
|
-
describe '#getPrivateNetworks' do
|
458
|
-
let(:response) do
|
459
|
-
'{"meta":{"first_page":1,"last_page":1,"previous_page":null,"current_page":1,"next_page":null,"total_results":1,"results_per_page":50},"results":[{"id":157,"name":""}]}'
|
460
|
-
end
|
461
|
-
|
462
|
-
it 'returns a list of all your privatenetworks' do
|
463
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/privateNetworks')
|
464
|
-
.with(headers: request_headers)
|
465
|
-
.to_return(status: 200, body: response, headers: {})
|
466
|
-
|
467
|
-
subject.getPrivateNetworks
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
|
-
describe '#getPrivateNetwork' do
|
472
|
-
let(:response) do
|
473
|
-
'{"id":157,"name":"","bareMetals":[{"id":198969,"status":"CONFIGURED","dataCenter":"SFO-12","CIDR":"10.29.0.32\\/27","broadcast":"10.29.0.63","gateway":"10.29.0.62","netmask":"255.255.255.224","portSpeed":100},{"id":198970,"status":"CONFIGURED","dataCenter":"SFO-12","CIDR":"10.29.0.32\\/27","broadcast":"10.29.0.63","gateway":"10.29.0.62","netmask":"255.255.255.224","portSpeed":100},{"id":114916,"status":"CONFIGURED","dataCenter":"SFO-12","CIDR":"10.29.0.32\\/27","broadcast":"10.29.0.63","gateway":"10.29.0.62","netmask":"255.255.255.224","portSpeed":100}]}'
|
474
|
-
end
|
475
|
-
|
476
|
-
it 'returns information about your private network and servers' do
|
477
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/privateNetworks/157')
|
478
|
-
.with(headers: request_headers)
|
479
|
-
.to_return(status: 200, body: response, headers: {})
|
480
|
-
|
481
|
-
subject.getPrivateNetwork(157)
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
describe '#updatePrivateNetwork' do
|
486
|
-
let(:response) { '{}' }
|
487
|
-
|
488
|
-
it 'updates the name of your private network' do
|
489
|
-
body = 'name=test'
|
490
|
-
|
491
|
-
stub_request(:put, 'https://api.leaseweb.com/v1/privateNetworks/157')
|
492
|
-
.with(headers: request_headers, body: body)
|
493
|
-
.to_return(status: 200, body: response, headers: {})
|
494
|
-
|
495
|
-
subject.updatePrivateNetwork(157, 'test')
|
496
|
-
end
|
497
|
-
end
|
498
|
-
|
499
|
-
describe '#deletePrivateNetwork' do
|
500
|
-
let(:response) { '{}' }
|
501
|
-
|
502
|
-
it 'deletes a private network' do
|
503
|
-
stub_request(:delete, 'https://api.leaseweb.com/v1/privateNetworks/157')
|
504
|
-
.with(headers: request_headers)
|
505
|
-
.to_return(status: 200, body: response, headers: {})
|
506
|
-
|
507
|
-
subject.deletePrivateNetwork(157)
|
508
|
-
end
|
509
|
-
end
|
510
|
-
|
511
|
-
describe '#createPrivateNetworks' do
|
512
|
-
let(:response) { '{}' }
|
513
|
-
|
514
|
-
it 'add a server to your private network' do
|
515
|
-
body = 'bareMetalId=114916'
|
516
|
-
|
517
|
-
stub_request(:post, 'https://api.leaseweb.com/v1/privateNetworks/157/bareMetals')
|
518
|
-
.with(headers: request_headers, body: body)
|
519
|
-
.to_return(status: 200, body: response, headers: {})
|
520
|
-
|
521
|
-
subject.createPrivateNetworksBareMetals(157, 114_916)
|
522
|
-
end
|
523
|
-
end
|
524
|
-
|
525
|
-
describe '#deletePrivateNetworksBareMetals' do
|
526
|
-
let(:response) { '{}' }
|
527
|
-
|
528
|
-
it 'delete server from your private network' do
|
529
|
-
stub_request(:delete, 'https://api.leaseweb.com/v1/privateNetworks/157/bareMetals/114916')
|
530
|
-
.with(headers: request_headers)
|
531
|
-
.to_return(status: 200, body: response, headers: {})
|
532
|
-
|
533
|
-
subject.deletePrivateNetworksBareMetals(157, 114_916)
|
534
|
-
end
|
535
|
-
end
|
536
|
-
|
537
|
-
describe '#getOperatingSystems' do
|
538
|
-
let(:response) do
|
539
|
-
'{"operatingSystems":[{"operatingSystem":{"id":664,"name":"CentOS 5 (i386)"}},{"operatingSystem":{"id":665,"name":"CentOS 5 (x86_64)"}},{"operatingSystem":{"id":867,"name":"CentOS 6 (i386)"}},{"operatingSystem":{"id":868,"name":"CentOS 6 (x86_64)"}},{"operatingSystem":{"id":1899,"name":"CentOS 7 (x86_64)"}},{"operatingSystem":{"id":921,"name":"CloudLinux 6.4 (i386)"}},{"operatingSystem":{"id":920,"name":"CloudLinux 6.4 (x86_64)"}},{"operatingSystem":{"id":532,"name":"Debian 6.0 (amd64)"}},{"operatingSystem":{"id":531,"name":"Debian 6.0 (x86)"}},{"operatingSystem":{"id":1566,"name":"Debian 7.0 (x86)"}},{"operatingSystem":{"id":1567,"name":"Debian 7.0 (x86_64)"}},{"operatingSystem":{"id":2142,"name":"Debian 8.0 (x86_64)"}},{"operatingSystem":{"id":873,"name":"ESXi 5.0 (x86_64)"}},{"operatingSystem":{"id":1039,"name":"ESXi 5.1 (x86_64)"}},{"operatingSystem":{"id":1864,"name":"ESXi 5.5 (x86_64)"}},{"operatingSystem":{"id":2143,"name":"ESXi 6.0 (x86_64)"}},{"operatingSystem":{"id":1953,"name":"FreeBSD 10.1 (amd64)"}},{"operatingSystem":{"id":1901,"name":"FreeBSD 10.1 (i386)"}},{"operatingSystem":{"id":764,"name":"FreeBSD 8.4 (amd64)"}},{"operatingSystem":{"id":765,"name":"FreeBSD 8.4 (x86)"}},{"operatingSystem":{"id":927,"name":"FreeBSD 9.3 (amd64)"}},{"operatingSystem":{"id":926,"name":"FreeBSD 9.3 (i386)"}},{"operatingSystem":{"id":946,"name":"Ubuntu 12.04 (amd64)"}},{"operatingSystem":{"id":945,"name":"Ubuntu 12.04 (x86)"}},{"operatingSystem":{"id":1789,"name":"Ubuntu 14.04 (amd64)"}},{"operatingSystem":{"id":1790,"name":"Ubuntu 14.04 (x86)"}},{"operatingSystem":{"id":672,"name":"Windows 2008 R2 Enterprise (x64)"}},{"operatingSystem":{"id":175,"name":"Windows 2008 R2 Standard (x64)"}},{"operatingSystem":{"id":539,"name":"Windows 2008 R2 Standard (2 CPU) (x64)"}},{"operatingSystem":{"id":165,"name":"Windows 2008 R2 Web (x64)"}},{"operatingSystem":{"id":538,"name":"Windows 2008 R2 Web (2 CPU) (x64)"}},{"operatingSystem":{"id":1610,"name":"Windows Server 2012 Datacenter (1 CPU) (x64)"}},{"operatingSystem":{"id":1611,"name":"Windows Server 2012 Datacenter (2 CPU) (x64)"}},{"operatingSystem":{"id":2002,"name":"Windows Server 2012 R2 Datacenter (1 CPU) (x64)"}},{"operatingSystem":{"id":2003,"name":"Windows Server 2012 R2 Datacenter (2 CPU) (x64)"}},{"operatingSystem":{"id":2000,"name":"Windows Server 2012 R2 Standard (1 CPU) (x64)"}},{"operatingSystem":{"id":2001,"name":"Windows Server 2012 R2 Standard (2 CPU) (x64)"}},{"operatingSystem":{"id":1603,"name":"Windows Server 2012 Standard (1 CPU) (x64)"}},{"operatingSystem":{"id":1604,"name":"Windows Server 2012 Standard (2 CPU) (x64)"}}]}'
|
540
|
-
end
|
541
|
-
|
542
|
-
it 'returns the list of available operatingSystems for installation' do
|
543
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/operatingSystems')
|
544
|
-
.with(headers: request_headers)
|
545
|
-
.to_return(status: 200, body: response, headers: {})
|
546
|
-
|
547
|
-
subject.getOperatingSystems
|
548
|
-
end
|
549
|
-
end
|
550
|
-
|
551
|
-
describe '#getOperatingSystem' do
|
552
|
-
let(:response) do
|
553
|
-
'{"operatingSystem":{"id":1899,"name":"CentOS 7 (x86_64)"}}'
|
554
|
-
end
|
555
|
-
|
556
|
-
it 'returns the details of an operating system for installation' do
|
557
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/operatingSystems/1899')
|
558
|
-
.with(headers: request_headers)
|
559
|
-
.to_return(status: 200, body: response, headers: {})
|
560
|
-
|
561
|
-
subject.getOperatingSystem(1899)
|
562
|
-
end
|
563
|
-
end
|
564
|
-
|
565
|
-
describe '#getControlPanels' do
|
566
|
-
let(:response) do
|
567
|
-
'{"controlPanels":[{"controlPanel":{"id":1868,"name":"Plesk 12 (10 Domains Linux)"}},{"controlPanel":{"id":1875,"name":"Plesk 12 (30 Domains Linux)"}},{"controlPanel":{"id":1878,"name":"Plesk 12 (Unlimited Domains Linux)"}}]}'
|
568
|
-
end
|
569
|
-
|
570
|
-
it 'returns the details of an operating system for installation' do
|
571
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/operatingSystems/1899/controlPanels')
|
572
|
-
.with(headers: request_headers)
|
573
|
-
.to_return(status: 200, body: response, headers: {})
|
574
|
-
|
575
|
-
subject.getControlPanels(1899)
|
576
|
-
end
|
577
|
-
end
|
578
|
-
|
579
|
-
describe '#getControlPanel' do
|
580
|
-
let(:response) do
|
581
|
-
'{"controlPanel":{"id":1868,"name":"Plesk 12 (10 Domains Linux)"}}'
|
582
|
-
end
|
583
|
-
|
584
|
-
it 'returns the details of available control panels for installation on a particular operating system' do
|
585
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/operatingSystems/1899/controlPanels/1868')
|
586
|
-
.with(headers: request_headers)
|
587
|
-
.to_return(status: 200, body: response, headers: {})
|
588
|
-
|
589
|
-
subject.getControlPanel(1899, 1868)
|
590
|
-
end
|
591
|
-
end
|
592
|
-
|
593
|
-
describe '#getPartitionSchema' do
|
594
|
-
let(:response) do
|
595
|
-
'{"partitionSchema":{"limit":7,"disks":{"disk":["\\/dev\\/sda","\\/dev\\/hda","\\/dev\\/cciss\\/c0d0"]},"suggestion":{"disk":"\\/dev\\/sda","bootable":0,"hdd":{"partition":[{"index":0,"size":"500","type":"ext2","mountpoint":"\\/boot"},{"index":1,"size":"4096","type":"swap","mountpoint":""},{"index":2,"size":"2048","type":"ext4","mountpoint":"\\/tmp"},{"index":3,"size":"*","type":"ext4","mountpoint":"\\/"}]}},"filesystemTypes":{"type":["ext2","ext3","ext4","xfs","swap"]}}}'
|
596
|
-
end
|
597
|
-
|
598
|
-
it 'returns the list of available partition schema\'s for installation' do
|
599
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/operatingSystems/1899/partitionSchema?serverPackId=114916')
|
600
|
-
.with(headers: request_headers)
|
601
|
-
.to_return(status: 200, body: response, headers: {})
|
602
|
-
|
603
|
-
subject.getPartitionSchema(1899, 114_916)
|
604
|
-
end
|
605
|
-
end
|
606
|
-
|
607
|
-
describe '#getIps' do
|
608
|
-
let(:response) do
|
609
|
-
'{"ips":[{"ip":{"ip":"209.58.131.10","reverseLookup":"","ipDetails":{"gateway":"209.58.131.62","mask":"255.255.255.192"},"nullRouted":false,"billingInformation":{"price":"0.00","startDate":"Jun 1, 2015","endDate":null},"serverId":"114916","serverType":"Bare Metal","serverName":"LSPG003"}},{"ip":{"ip":"209.58.128.85","reverseLookup":"","ipDetails":{"gateway":"209.58.128.126","mask":"255.255.255.192"},"nullRouted":false,"billingInformation":{"price":"0.00","startDate":"Mar 1, 2015","endDate":null},"serverId":"198969","serverType":"Bare Metal","serverName":"LSPG001"}},{"ip":{"ip":"209.58.128.148","reverseLookup":"","ipDetails":{"gateway":"209.58.128.190","mask":"255.255.255.192"},"nullRouted":false,"billingInformation":{"price":"0.00","startDate":"Mar 1, 2015","endDate":null},"serverId":"198970","serverType":"Bare Metal","serverName":"LSPG002"}}]}'
|
610
|
-
end
|
611
|
-
|
612
|
-
it 'returns all IPs associated to the account' do
|
613
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/ips')
|
614
|
-
.with(headers: request_headers)
|
615
|
-
.to_return(status: 200, body: response, headers: {})
|
616
|
-
|
617
|
-
subject.getIps
|
618
|
-
end
|
619
|
-
end
|
620
|
-
|
621
|
-
describe '#getIps' do
|
622
|
-
let(:response) do
|
623
|
-
'{"ip":{"ip":"209.58.131.10","reverseLookup":"","ipDetails":{"gateway":"209.58.131.62","mask":"255.255.255.192"},"nullRouted":false,"billingInformation":{"price":"0.00","startDate":"Jun 1, 2015","endDate":null},"serverId":"114916","serverType":"Bare Metal","serverName":"LSPG003"}}'
|
624
|
-
end
|
625
|
-
|
626
|
-
it 'returns information about the IP' do
|
627
|
-
stub_request(:get, 'https://api.leaseweb.com/v1/ips/209.58.131.10')
|
628
|
-
.with(headers: request_headers)
|
629
|
-
.to_return(status: 200, body: response, headers: {})
|
630
|
-
|
631
|
-
subject.getIp('209.58.131.10')
|
632
|
-
end
|
633
|
-
end
|
634
|
-
|
635
|
-
describe '#updateIp' do
|
636
|
-
let(:response) { '{}' }
|
637
|
-
|
638
|
-
it 'Updates information about the IP' do
|
639
|
-
body = 'reverseLookup=modified-by-api.leaseweb.com&nullRouted=1'
|
640
|
-
|
641
|
-
stub_request(:put, 'https://api.leaseweb.com/v1/ips/209.58.131.10')
|
642
|
-
.with(headers: request_headers, body: body)
|
643
|
-
.to_return(status: 200, body: response, headers: {})
|
644
|
-
|
645
|
-
subject.updateIp('209.58.131.10', 'modified-by-api.leaseweb.com', 1)
|
646
|
-
end
|
647
|
-
end
|
648
|
-
end
|