hetznercloud 4.4.0 → 5.0.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -0
- data/lib/hcloud/concerns/creatable.rb +13 -11
- data/lib/hcloud/concerns/subresource.rb +23 -14
- data/lib/hcloud/http.rb +8 -8
- data/lib/hcloud/resource.rb +2 -2
- data/lib/hcloud/resources/rrset.rb +4 -0
- data/lib/hcloud/resources/storage_box_subaccount.rb +2 -2
- data/lib/hcloud/version.rb +2 -2
- data/lib/http/features/request/compressed_body.rb +1 -1
- data/lib/http/features/response/brotli_inflater.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9175bc0a11981b096914d3a80869743db98d5691916f277c8eedb09f9c69b1e3
|
|
4
|
+
data.tar.gz: 7f1c35152b43e268bb3c39bbd57abb57f6010ad2ab5fd460c545064a5c11b593
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bd92e7f000bdbbaad9065e3e8204d5bcb1d5a49b7d4b96fb56f9162101cd082bd810e4d0acbd51fbb42d3dee4e97b3c66a59f14c995badae3bac5c3354a49e9
|
|
7
|
+
data.tar.gz: '02896e1f2f35c3e3e5bb4179de52d3e711d6be7721b1b3726c269b1651a3bf3a41a79f0a327298eabdf65337647a62d06f63ae86d4c57b1ee5f10c1c89e0f464'
|
data/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
### Fixed
|
|
12
12
|
|
|
13
|
+
## HCloud v5.0.0 (2026-01-15)
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Add `name` attribute to `HCloud::StorageBoxSubaccount`
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Rework RRSet resource handler
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
- Remove support for Ruby 3.0 and 3.1
|
|
26
|
+
|
|
13
27
|
## HCloud v4.4.0 (2025-11-25)
|
|
14
28
|
|
|
15
29
|
### Added
|
data/Gemfile
CHANGED
|
@@ -8,28 +8,30 @@ module HCloud
|
|
|
8
8
|
included do # rubocop:disable Metrics/BlockLength
|
|
9
9
|
attribute :created, :datetime
|
|
10
10
|
|
|
11
|
-
def create
|
|
11
|
+
def create # rubocop:disable Metrics/AbcSize
|
|
12
12
|
response = client
|
|
13
13
|
.post(resource_path, creatable_params)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
resource_key = resource_name.to_sym
|
|
16
|
+
|
|
17
|
+
if response.key?(resource_key)
|
|
18
|
+
# Set the attributes from the response
|
|
19
|
+
assign_attributes(response[resource_key].merge(response.slice(:root_password)))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Some resources return an action instead of the resource itself
|
|
16
23
|
if response.key?(:action)
|
|
17
24
|
# Set the ID from the action response
|
|
18
|
-
self.id
|
|
25
|
+
self.id ||= response
|
|
19
26
|
.dig(:action, :resources)
|
|
20
27
|
.find { |r| r[:type] == [resource_class&.resource_name, resource_name].compact.join("_") }
|
|
21
28
|
.fetch(:id)
|
|
22
29
|
|
|
23
30
|
# Return an Action instance
|
|
24
|
-
Action.new
|
|
25
|
-
else
|
|
26
|
-
# Set the attributes from the response
|
|
27
|
-
assign_attributes response[resource_name.to_sym]
|
|
28
|
-
.merge!(response.slice(:root_password))
|
|
29
|
-
|
|
30
|
-
# Return the resource instance
|
|
31
|
-
self
|
|
31
|
+
return Action.new(response[:action])
|
|
32
32
|
end
|
|
33
|
+
|
|
34
|
+
self
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def created?
|
|
@@ -5,6 +5,12 @@ module HCloud
|
|
|
5
5
|
module Subresource
|
|
6
6
|
extend ActiveSupport::Concern
|
|
7
7
|
|
|
8
|
+
delegate :resource_path, to: :class
|
|
9
|
+
|
|
10
|
+
def instance_path
|
|
11
|
+
resource_path(id: id)
|
|
12
|
+
end
|
|
13
|
+
|
|
8
14
|
included do
|
|
9
15
|
# For super resources
|
|
10
16
|
class_attribute :subresource_names
|
|
@@ -15,7 +21,7 @@ module HCloud
|
|
|
15
21
|
class_attribute :resource_class
|
|
16
22
|
end
|
|
17
23
|
|
|
18
|
-
class_methods do
|
|
24
|
+
class_methods do # rubocop:disable Metrics/BlockLength
|
|
19
25
|
def inherited(subclass)
|
|
20
26
|
super
|
|
21
27
|
|
|
@@ -35,27 +41,30 @@ module HCloud
|
|
|
35
41
|
|
|
36
42
|
# For subresources
|
|
37
43
|
def subresource_of(name, type = name)
|
|
44
|
+
raise ArgumentError, "Resource already a subresource of #{resource_class}" if resource_class.present?
|
|
45
|
+
|
|
38
46
|
self.resource_class = ActiveModel::Type
|
|
39
47
|
.lookup(type)
|
|
40
48
|
.resource_class
|
|
41
49
|
|
|
42
|
-
attribute name, :integer
|
|
50
|
+
attribute name, :integer # TODO: override that returns the resource class instance instead of the ID?
|
|
43
51
|
|
|
44
|
-
#
|
|
45
|
-
|
|
52
|
+
# Nested resources (e.g. /storage_boxes/123/subaccounts)
|
|
53
|
+
define_method(:resource_path) do |id: nil|
|
|
54
|
+
super_instance = public_send(resource_class.resource_name)
|
|
55
|
+
|
|
56
|
+
return super() if super_instance.blank?
|
|
46
57
|
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
if super_instance.respond_to?(:instance_path)
|
|
59
|
+
[super_instance.instance_path, super(id: id)].join
|
|
60
|
+
else
|
|
61
|
+
[resource_class.resource_path(id: super_instance), super(id: id)].join
|
|
62
|
+
end
|
|
63
|
+
end
|
|
49
64
|
end
|
|
50
|
-
end
|
|
51
65
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# Nested resources (e.g. /storage_boxes/123/subaccounts)
|
|
55
|
-
"/#{resource_class.resource_name.pluralize}/#{id}/#{resource_name.pluralize}"
|
|
56
|
-
else
|
|
57
|
-
# Top-level resources (e.g. /servers)
|
|
58
|
-
"/#{resource_name.pluralize}"
|
|
66
|
+
def resource_path(id: nil)
|
|
67
|
+
["", resource_name.pluralize, id].compact.join("/")
|
|
59
68
|
end
|
|
60
69
|
end
|
|
61
70
|
end
|
data/lib/hcloud/http.rb
CHANGED
|
@@ -107,16 +107,16 @@ module HCloud
|
|
|
107
107
|
def transform_params(params)
|
|
108
108
|
params
|
|
109
109
|
.transform_values do |value|
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
# Don't transform if value is single argument: { sort: :id }
|
|
111
|
+
next value unless value.respond_to?(:each)
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
value.map do |element|
|
|
114
|
+
# Don't transform if element is single argument: { sort: [:id] }
|
|
115
|
+
next element unless element.respond_to?(:each)
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
# Join elements with : { sort: [id: :asc] }
|
|
118
|
+
element.to_a.join(":")
|
|
119
|
+
end
|
|
120
120
|
end
|
|
121
121
|
.compact
|
|
122
122
|
end
|
data/lib/hcloud/resource.rb
CHANGED
|
@@ -35,8 +35,8 @@ module HCloud
|
|
|
35
35
|
id && id == other.id
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def self.attribute(name,
|
|
39
|
-
super(name,
|
|
38
|
+
def self.attribute(name, *, deprecated: false, **)
|
|
39
|
+
super(name, *, **)
|
|
40
40
|
|
|
41
41
|
define_method(name) do |**params|
|
|
42
42
|
warn "[DEPRECATION] Field \"#{name}\" on #{self.class.name} is deprecated." if deprecated
|
|
@@ -111,11 +111,11 @@ module HCloud
|
|
|
111
111
|
action :update_access_settings
|
|
112
112
|
|
|
113
113
|
def creatable_attributes
|
|
114
|
-
[:password, :home_directory, :description, :labels, :access_settings]
|
|
114
|
+
[:password, :home_directory, :name, :description, :labels, :access_settings]
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def updatable_attributes
|
|
118
|
-
[:description, :labels]
|
|
118
|
+
[:name, :description, :labels]
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
def self.resource_name
|
data/lib/hcloud/version.rb
CHANGED
|
@@ -17,10 +17,10 @@ module HTTP
|
|
|
17
17
|
module Response
|
|
18
18
|
# @!visibility private
|
|
19
19
|
class BrotliInflater < HTTP::Response::Inflater
|
|
20
|
-
def readpartial(*
|
|
20
|
+
def readpartial(*)
|
|
21
21
|
chunks = []
|
|
22
22
|
|
|
23
|
-
while (chunk = @connection.readpartial(*
|
|
23
|
+
while (chunk = @connection.readpartial(*))
|
|
24
24
|
chunks << chunk
|
|
25
25
|
end
|
|
26
26
|
|
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
|
+
version: 5.0.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:
|
|
11
|
+
date: 2026-01-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -220,7 +220,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
220
220
|
requirements:
|
|
221
221
|
- - ">="
|
|
222
222
|
- !ruby/object:Gem::Version
|
|
223
|
-
version: '3.
|
|
223
|
+
version: '3.2'
|
|
224
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
requirements:
|
|
226
226
|
- - ">="
|