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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ab3cd637b80e65b74aab7136e5bd487ab7c435770e92e36e116cea33546f701
4
- data.tar.gz: 8d36b9867b8a2706cf03b6447d5ec45e5c69a2e9d0b0e7d13a006de0ca9d91b3
3
+ metadata.gz: 9175bc0a11981b096914d3a80869743db98d5691916f277c8eedb09f9c69b1e3
4
+ data.tar.gz: 7f1c35152b43e268bb3c39bbd57abb57f6010ad2ab5fd460c545064a5c11b593
5
5
  SHA512:
6
- metadata.gz: ef118d404a4019591158f46350e199306f3b7ae2dd839b29e5a08c31c0a130821c033c4a32f1c9ed0adb9ae5f9e1663490f52aa2f590e63b76217b987eb03996
7
- data.tar.gz: d9cea883a13f81dacb20e3b38103c30eed853b93f72e86929971a64826c10b7fcc4bcb8d4c6afacfdb369f0848b510e8aba34242fe2aec310df1b5bf13848ebe
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
@@ -14,6 +14,7 @@ group :development, :test do
14
14
  gem "debug", require: false
15
15
  gem "dotenv", require: false
16
16
  gem "ffaker", require: false
17
+ gem "iconv", require: false
17
18
  gem "rake", require: false
18
19
  gem "rspec", require: false
19
20
  gem "rubocop", require: false
@@ -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
- # Some resources return an action instead of the resource itself (e.g. Storage Box API)
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 = response
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 response[:action]
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
- # TODO: override that returns the resource class instance instead of the ID?
45
- end
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
- def resource_path
48
- "/#{resource_name.pluralize}"
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
- def resource_path
53
- if resource_class && (id = send(resource_class.resource_name)).present?
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
- # Don't transform if value is single argument: { sort: :id }
111
- next value unless value.respond_to?(:each)
110
+ # Don't transform if value is single argument: { sort: :id }
111
+ next value unless value.respond_to?(:each)
112
112
 
113
- value.map do |element|
114
- # Don't transform if element is single argument: { sort: [:id] }
115
- next element unless element.respond_to?(:each)
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
- # Join elements with : { sort: [id: :asc] }
118
- element.to_a.join(":")
119
- end
117
+ # Join elements with : { sort: [id: :asc] }
118
+ element.to_a.join(":")
119
+ end
120
120
  end
121
121
  .compact
122
122
  end
@@ -35,8 +35,8 @@ module HCloud
35
35
  id && id == other.id
36
36
  end
37
37
 
38
- def self.attribute(name, *args, deprecated: false, **kwargs)
39
- super(name, *args, **kwargs)
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
@@ -169,5 +169,9 @@ module HCloud
169
169
  def updatable_attributes
170
170
  [:labels]
171
171
  end
172
+
173
+ def self.resource_name
174
+ "rrset"
175
+ end
172
176
  end
173
177
  end
@@ -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
@@ -3,8 +3,8 @@
3
3
  module HCloud
4
4
  # @!visibility private
5
5
  module Version
6
- MAJOR = 4
7
- MINOR = 4
6
+ MAJOR = 5
7
+ MINOR = 0
8
8
  PATCH = 0
9
9
  PRE = nil
10
10
 
@@ -30,7 +30,7 @@ module HTTP
30
30
  self
31
31
  end
32
32
 
33
- def compress(&_block)
33
+ def compress(&)
34
34
  raise NotImplementedError
35
35
  end
36
36
 
@@ -17,10 +17,10 @@ module HTTP
17
17
  module Response
18
18
  # @!visibility private
19
19
  class BrotliInflater < HTTP::Response::Inflater
20
- def readpartial(*args)
20
+ def readpartial(*)
21
21
  chunks = []
22
22
 
23
- while (chunk = @connection.readpartial(*args))
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.4.0
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: 2025-11-25 00:00:00.000000000 Z
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.0'
223
+ version: '3.2'
224
224
  required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - ">="