upcloud_api 1.1.0 → 1.2.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7a0f11616b14245cfb8ab6eb7a58edc3792146a
4
- data.tar.gz: 3fc23c6461352fdff08eda2bbb4dbf2c9f1797bf
3
+ metadata.gz: becf22140f3d61a6e08668562b19df3bb9b5f585
4
+ data.tar.gz: 7bc9ed1e86f489a6ce958c036816e921f3693651
5
5
  SHA512:
6
- metadata.gz: 89047aa5d535b92ca244874c6a2ec382ab40ddfd521526b0e571204b6ed8d0436edbffd2bebcc839651f80b52495e007ac07fb1575de3d09183b54a043286a56
7
- data.tar.gz: 441dde9f2241d9dcfeea9ff31f00a8dacfad885be27c98c19d895f89e42fd3d66b7a6a605468596cb6fcc5f1e2cd128eb391b0f4c2f3cc515c8631450ee63319
6
+ metadata.gz: 58e8408ae341460b75a896047f72f156cc577704947f95630b167c3be28451fc80740d1863b6197907ac8373bdacf4a533ec7d3afc618a77acb6c791699a459e
7
+ data.tar.gz: fec1c2166a467f1cc58b67c1a696479fa67c5accf31f64866f76a9d28edbcb97f89ddd6e44fc8d65cfb444f9bf71492364ac17fe757b06f57760dcad1ca179a1
@@ -1,3 +1,3 @@
1
1
  class UpcloudApi
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0-rc1"
3
3
  end
data/lib/upcloud_api.rb CHANGED
@@ -152,7 +152,10 @@ class UpcloudApi
152
152
  # @param server_uuid UUID of the server
153
153
  # @param type Type of the shutdown. Available types are :hard and :soft. Defaults to :soft.
154
154
  # @param timeout Time after server will be hard stopped if it didn’t close cleanly. Only affects :soft type.
155
- def start_server server_uuid, type: :soft, timeout: nil
155
+ # @param asynchronous If false, this call will wait until the server has really stopped.
156
+ #
157
+ # Raises Timeout::Error in case server does not shut down in 300 seconds in non-asynchronous mode.
158
+ def stop_server server_uuid, type: :soft, timeout: nil, asynchronous: false
156
159
  data = {
157
160
  "stop_server" => {
158
161
  "stop_type" => type.to_s
@@ -164,7 +167,14 @@ class UpcloudApi
164
167
 
165
168
  response = post "server/#{server_uuid}/stop", json
166
169
 
167
- response
170
+ return response if asynchronous
171
+
172
+ Timeout 300 do
173
+ loop do
174
+ details = server_details server_uuid
175
+ return response if details["server"]["state"] == "stopped"
176
+ end
177
+ end
168
178
  end
169
179
 
170
180
  # Restarts down a server that is currently running
@@ -180,7 +190,7 @@ class UpcloudApi
180
190
  # @param timeout Time after server will be hard stopped if it didn’t close cleanly. Only affects :soft type.
181
191
  # @param timeout_action What will happen when timeout happens. :destroy hard stops the server and :ignore makes
182
192
  # server if timeout happens. Default is :ignore.
183
- def start_server server_uuid, type: :soft, timeout: nil, timeout_action: :ignore
193
+ def restart_server server_uuid, type: :soft, timeout: nil, timeout_action: :ignore
184
194
  data = {
185
195
  "stop_server" => {
186
196
  "stop_type" => type.to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upcloud_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samu Voutilainen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-07 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -48,9 +48,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - ">"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 1.3.1
54
54
  requirements: []
55
55
  rubyforge_project:
56
56
  rubygems_version: 2.4.6