hetznercloud 4.0.0 → 4.2.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: 497195f54e986218ca478ec89a00fed2eeaf967e4f7cc1051b025de52290783b
4
+ data.tar.gz: 6d0a810bfba0851a4f0957602080868259376b26f69130b743a419db644805c8
5
5
  SHA512:
6
- metadata.gz: 34d0c3b479ff7808b0be9ccf2bffaecaffadf6c8be47a0b1a414c24bc917fdfb18db77db96ddacfeba05589ece4225d39754c96c907197807b9eef86b06ba75e
7
- data.tar.gz: 31be3717b08139ab78c6633a40694e6a908ef15090b3968bf1790a996a7e4e9381e9a67d0b0db01b4dfce588cbeb0f454ecb686db32875b2866c57bfb52e6a9e
6
+ metadata.gz: 52d6b19d64d69acd995e18f73a6fade7a85008512a13f66cd1f6ae6efc333556038f3e1768ce9ca4c86b9a742fe51ed22f9924a9475fc23256a3b487cc9b1949
7
+ data.tar.gz: 6c32560938c2ec270218386ed537a82745d71f040088cd72bbfe6a6bd37c0caa8265f038ac73ec430cca7818c37d18f6286e5482e3521a284d734806708ec1fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Added
6
+
7
+ ### Changed
8
+
9
+ ### Removed
10
+
11
+ ### Fixed
12
+
13
+ ## HCloud v4.2.0 (2025-09-24)
14
+
15
+ ### Added
16
+
17
+ - Add `locations` attribute to `ServerType`
18
+
19
+ ### Changed
20
+
21
+ - Add deprecation warning for `ServerType#deprecation`
22
+
23
+ ## HCloud v4.1.0 (2025-09-02)
24
+
25
+ ### Added
26
+
27
+ - Add `category` attribute to `ServerType`
28
+
29
+ ### Changed
30
+
31
+ - 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)
32
+
3
33
  ## HCloud v4.0.0 (2025-07-26)
4
34
 
5
35
  ### 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?
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HCloud
4
+ class ServerTypeLocation < Entity
5
+ attribute :id, :integer
6
+ attribute :name
7
+ attribute :deprecation, :deprecation
8
+ end
9
+ end
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
 
@@ -133,6 +133,7 @@ ActiveModel::Type.register(:server, HCloud::ResourceType.Type("HCloud::Server"))
133
133
  ActiveModel::Type.register(:server_backup_price, HCloud::ResourceType.Type("HCloud::ServerBackupPrice"))
134
134
  ActiveModel::Type.register(:server_protection, HCloud::ResourceType.Type("HCloud::ServerProtection"))
135
135
  ActiveModel::Type.register(:server_type, HCloud::ResourceType.Type("HCloud::ServerType"))
136
+ ActiveModel::Type.register(:server_type_location, HCloud::ResourceType.Type("HCloud::ServerTypeLocation"))
136
137
  ActiveModel::Type.register(:server_type_price, HCloud::ResourceType.Type("HCloud::ServerTypePrice"))
137
138
  ActiveModel::Type.register(:service, HCloud::ResourceType.Type("HCloud::Service"))
138
139
  ActiveModel::Type.register(:service_http, HCloud::ResourceType.Type("HCloud::ServiceHTTP"))
@@ -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
@@ -36,7 +37,9 @@ module HCloud
36
37
 
37
38
  attribute :prices, :price, array: true, default: -> { [] }
38
39
 
39
- attribute :deprecation, :deprecation
40
+ attribute :locations, :server_type_location, array: true, default: -> { [] }
41
+
42
+ attribute :deprecation, :deprecation, deprecated: true
40
43
 
41
44
  attribute :deprecated, :boolean, deprecated: true
42
45
 
@@ -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 = 2
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.2.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-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -128,6 +128,7 @@ files:
128
128
  - lib/hcloud/entities/rule.rb
129
129
  - lib/hcloud/entities/server_backup_price.rb
130
130
  - lib/hcloud/entities/server_protection.rb
131
+ - lib/hcloud/entities/server_type_location.rb
131
132
  - lib/hcloud/entities/server_type_price.rb
132
133
  - lib/hcloud/entities/service.rb
133
134
  - lib/hcloud/entities/service_http.rb