hetznercloud 4.0.0 → 4.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02d5a5deece2643c61fcf5c87f1bd3e73bf6db419b7288666ab870adb707c560
4
- data.tar.gz: 4c6d40149f85309daa7b385416e83ae8510214cbd372ea51e242de9d57afcbeb
3
+ metadata.gz: 0e9575422834c710e68322d4d3d9d738521d1a45d8924f90eee7b64da43e47ed
4
+ data.tar.gz: 4edab154b29f3c5d3a43d55bdf5d9282418d470105d272446283e564b2f3ee12
5
5
  SHA512:
6
- metadata.gz: 34d0c3b479ff7808b0be9ccf2bffaecaffadf6c8be47a0b1a414c24bc917fdfb18db77db96ddacfeba05589ece4225d39754c96c907197807b9eef86b06ba75e
7
- data.tar.gz: 31be3717b08139ab78c6633a40694e6a908ef15090b3968bf1790a996a7e4e9381e9a67d0b0db01b4dfce588cbeb0f454ecb686db32875b2866c57bfb52e6a9e
6
+ metadata.gz: 5009c504916ca8404c11bd855377e101121fd77e7a53517f4f1b740d540ac36815a47b710429520ddb93458db29e43311444655196931f6a88c3c1dd7bd49461
7
+ data.tar.gz: 8af42a4fe808cd090033913f1bb5b3d73eca8066da3ace50e470df6355a90b93981e7fe6167679f7b877b572fb26c2d7b5772b3ac15bd633f0a844353ab343a8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Added
6
+
7
+ ### Changed
8
+
9
+ ### Removed
10
+
11
+ ### Fixed
12
+
13
+ ## HCloud v4.1.0 (2025-09-02)
14
+
15
+ ### Added
16
+
17
+ - Add `category` attribute to `ServerType`
18
+
19
+ ### Changed
20
+
21
+ - Allow certain `create` and `delete` methods to return a `HCloud::Action` instance instead of a resource, as returned by the API (e.g. Storage Box API)
22
+
3
23
  ## HCloud v4.0.0 (2025-07-26)
4
24
 
5
25
  ### Added
@@ -9,12 +9,17 @@ module HCloud
9
9
  def delete
10
10
  raise Errors::MissingIDError unless id
11
11
 
12
- client
12
+ response = client
13
13
  .delete("#{resource_path}/#{id}")
14
14
 
15
15
  @deleted = true
16
16
 
17
- self
17
+ # Return the resource instance
18
+ return self unless response.is_a?(Hash) && response.key?(:action)
19
+
20
+ # Some resources return an action instead of the resource itself (e.g. Storage Box API)
21
+ # Return an Action instance
22
+ Action.new response[:action]
18
23
  end
19
24
 
20
25
  def deleted?
data/lib/hcloud/http.rb CHANGED
@@ -73,14 +73,16 @@ module HCloud
73
73
  response = http
74
74
  .delete(url_for(path))
75
75
 
76
- return if response.status.success?
77
-
78
76
  raise Errors::ServerError, response if response.status.server_error?
79
77
 
78
+ return if response.status.success? && response.body.empty?
79
+
80
80
  data = response
81
81
  .parse(:json)
82
82
  .deep_symbolize_keys
83
83
 
84
+ return data if response.status.success?
85
+
84
86
  raise Errors.const_get(data.dig(:error, :code).camelize), data[:error]
85
87
  end
86
88
 
@@ -25,6 +25,7 @@ module HCloud
25
25
  attribute :id, :integer
26
26
  attribute :name
27
27
  attribute :description
28
+ attribute :category
28
29
 
29
30
  attribute :architecture
30
31
  attribute :cores, :integer
@@ -32,7 +32,7 @@ module HCloud
32
32
  # storage_box = HCloud::StorageBox.create(name: "my_storage_box", storage_box_type: "bx20", location: "fsn1", password: "my_password")
33
33
  # # => #<HCloud::Action id: 1, ...>
34
34
  #
35
- # Note: this endpoint returns an Action rather than the created resource itself
35
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself
36
36
  #
37
37
  # == Update storage box
38
38
  #
@@ -44,9 +44,13 @@ module HCloud
44
44
  #
45
45
  # storage_box = HCloud::StorageBox.find(1)
46
46
  # storage_box.delete
47
+ # # => #<HCloud::Action id: 1, ...>
48
+ #
47
49
  # storage_box.deleted?
48
50
  # # => true
49
51
  #
52
+ # Note: this method returns a {HCloud::Action} instance rather than the deleted resource itself
53
+ #
50
54
  # == List storage box contents
51
55
  #
52
56
  # storage_box = HCloud::StorageBox.find(1)
@@ -34,7 +34,7 @@ module HCloud
34
34
  # snapshot.created?
35
35
  # # => false
36
36
  #
37
- # Note: this endpoint returns an Action rather than the created resource itself, as the snapshot is created asynchronously.
37
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself, as the snapshot is created asynchronously.
38
38
  # Reload the snapshot to check if it was created successfully.
39
39
  #
40
40
  # snapshot.reload
@@ -44,12 +44,12 @@ module HCloud
44
44
  # snapshot = storage_box.snapshots.create(description: "my_snapshot")
45
45
  # # => #<HCloud::Action id: 1, ...>
46
46
  #
47
- # Note: this endpoint returns an Action rather than the created resource itself
47
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself
48
48
  #
49
49
  # snapshot = HCloud::StorageBox::Snapshot.create(storage_box: 1, description: "my_snapshot")
50
50
  # # => #<HCloud::Action id: 1, ...>
51
51
  #
52
- # Note: this endpoint returns an Action rather than the created resource itself
52
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself
53
53
  #
54
54
  # == Update snapshot
55
55
  #
@@ -63,9 +63,13 @@ module HCloud
63
63
  # storage_box = HCloud::StorageBox.find(1)
64
64
  # snapshot = storage_box.snapshots.find(1)
65
65
  # snapshot.delete
66
+ # # => #<HCloud::Action id: 1, ...>
67
+ #
66
68
  # snapshot.deleted?
67
69
  # # => true
68
70
  #
71
+ # Note: this method returns a {HCloud::Action} instance rather than the deleted resource itself
72
+ #
69
73
  class StorageBoxSnapshot < Resource
70
74
  subresource_of :storage_box
71
75
 
@@ -30,7 +30,7 @@ module HCloud
30
30
  # subaccount.created?
31
31
  # # => false
32
32
  #
33
- # Note: this endpoint returns an Action rather than the created resource itself, as the subaccount is created asynchronously.
33
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself, as the subaccount is created asynchronously.
34
34
  # Reload the subaccount to check if it was created successfully.
35
35
  #
36
36
  # subaccount.reload
@@ -40,12 +40,12 @@ module HCloud
40
40
  # subaccount = storage_box.subaccounts.create(password: "my_password", description: "my_subaccount", home_directory: "backup/", access_settings: { samba_enabled: false, ssh_enabled: true, webdav_enabled: false, readonly: false, reachable_externally: false })
41
41
  # # => #<HCloud::Action id: 1, ...>
42
42
  #
43
- # Note: this endpoint returns an Action rather than the created resource itself
43
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself
44
44
  #
45
45
  # subaccount = HCloud::StorageBox::Subaccount.create(storage_box: 1, password: "my_password", description: "my_subaccount", home_directory: "backup/", access_settings: { samba_enabled: false, ssh_enabled: true, webdav_enabled: false, readonly: false, reachable_externally: false })
46
46
  # # => #<HCloud::Action id: 1, ...>
47
47
  #
48
- # Note: this endpoint returns an Action rather than the created resource itself
48
+ # Note: this method returns a {HCloud::Action} instance rather than the created resource itself
49
49
  #
50
50
  # == Update subaccount
51
51
  #
@@ -59,9 +59,13 @@ module HCloud
59
59
  # storage_box = HCloud::StorageBox.find(1)
60
60
  # subaccount = storage_box.subaccounts.find(1)
61
61
  # subaccount.delete
62
+ # # => #<HCloud::Action id: 1, ...>
63
+ #
62
64
  # subaccount.deleted?
63
65
  # # => true
64
66
  #
67
+ # Note: this method returns a {HCloud::Action} instance rather than the deleted resource itself
68
+ #
65
69
  # = Resource-specific actions
66
70
  # == Reset password
67
71
  #
@@ -4,7 +4,7 @@ module HCloud
4
4
  # @!visibility private
5
5
  module Version
6
6
  MAJOR = 4
7
- MINOR = 0
7
+ MINOR = 1
8
8
  PATCH = 0
9
9
  PRE = nil
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hetznercloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-26 00:00:00.000000000 Z
11
+ date: 2025-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel