hetznercloud 1.7.2 → 2.1.0

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
  SHA256:
3
- metadata.gz: 7a3bc8bc5dfc3e5154ae94a877dbdc8c355c93b027f986ca3725c0866bece1f8
4
- data.tar.gz: 6b43309988c2d4839fec5b9698381f263cff0a3789f6b4caaefae4d810b5ad2d
3
+ metadata.gz: c90b55b1202ba500b10d67653c2c0bf7d4af7b2045f257a58d973da7d73501db
4
+ data.tar.gz: f752ab64cb5d2208aed1cae8d5312aafee5314a54d27929e67f38978439d7b36
5
5
  SHA512:
6
- metadata.gz: dd662a4a50655993945562054fa50ea8f3773df37098aee24e67357874682214c35a1bfbcb373e577d1478f9ffb877de0cee9d2cbe7afeacd0e3be5fefa89ff0
7
- data.tar.gz: b68871da40e599c2b91388d020065c57aba4cd6b037cccaeeca4a9dd43d18071a39cf7b01c7ba0531c6c80ff2460bca82e5d7335499ed3feb5f7e128e6a64654
6
+ metadata.gz: 99a1bd26d8f9e2f4f0c4bfffdc3f01233cd5e3616594c15144a3c3f6ee3f268f6fd47c18c57a8073118d8630832d15ace0c89c8af355a31602eb7d78221ce6c9
7
+ data.tar.gz: 9db2511d57761816e5a02051f0c9e3ab817074056c05ce33d079ad0dfb34173da239f97cf14342dd9c8986ce65770b621c2568d762ef8647d8dc1335b573ca80
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## HCloud v2.1.0 (2024-07-28)
4
+
5
+ - Add `included_traffic` attribute to `ServerType#prices` and `LoadBalancerType#prices`
6
+ - Add `price_per_tb_traffic` attribute to `ServerType#prices` and `LoadBalancerType#prices`
7
+ - Add deprecation warning for `Pricing#traffic`
8
+ - Add deprecation warning for `ServerType#included_traffic`
9
+ - Fix crash on prices when using `Pricing` API
10
+
11
+ ## HCloud v2.0.0 (2024-01-10)
12
+
13
+ - Remove `deprecated` attribute from `ISO`
14
+
3
15
  ## HCloud v1.7.2 (2023-10-16)
4
16
 
5
17
  - Add `deprecation` attribute to `ISO`
data/Gemfile CHANGED
@@ -14,6 +14,7 @@ group :development, :test do
14
14
  gem "rubocop", require: false
15
15
  gem "rubocop-performance", require: false
16
16
  gem "rubocop-rspec", require: false
17
+ gem "simplecov", require: false
17
18
  gem "timecop", require: false
18
19
  gem "webmock", require: false
19
20
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HCloud
2
2
 
3
- ![Continuous Integration](https://github.com/floriandejonckheere/hcloud/workflows/Continuous%20Integration/badge.svg)
3
+ ![Continuous Integration](https://github.com/floriandejonckheere/hcloud/actions/workflows/ci.yml/badge.svg)
4
4
  ![Release](https://img.shields.io/github/v/release/floriandejonckheere/hcloud?label=Latest%20release)
5
5
 
6
6
  Unofficial Ruby integration with the [Hetzner Cloud API](https://docs.hetzner.cloud/).
@@ -55,7 +55,7 @@ module HCloud
55
55
 
56
56
  def count
57
57
  # Fetch total_entries if not present
58
- @count ||= (total_entries || proc.call(params.merge(page: 1)).last.dig(:pagination, :total_entries))
58
+ @count ||= total_entries || proc.call(params.merge(page: 1)).last.dig(:pagination, :total_entries)
59
59
  end
60
60
 
61
61
  def empty?
@@ -33,7 +33,7 @@ module HCloud
33
33
  attributes
34
34
  .slice(*simple_attributes.map(&:to_s))
35
35
  .transform_values { |v| v&.send_wrap { |o| o.try(:to_h) || o } || v&.send_wrap(:to_s) }
36
- .merge(nested_attributes.reduce(&:merge)&.map { |k, v| [k.to_s, Array(v).filter_map { |w| send(k)&.send_wrap(w) }.first] }.to_h)
36
+ .merge(nested_attributes.reduce(&:merge).to_h { |k, v| [k.to_s, Array(v).filter_map { |w| send(k)&.send_wrap(w) }.first] })
37
37
  .compact_blank
38
38
  end
39
39
  # rubocop:enable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
@@ -3,6 +3,6 @@
3
3
  module HCloud
4
4
  class FloatingIPPrices < Entity
5
5
  attribute :type
6
- attribute :prices, :price
6
+ attribute :prices, :price, array: true, default: -> { [] }
7
7
  end
8
8
  end
@@ -2,8 +2,10 @@
2
2
 
3
3
  module HCloud
4
4
  class Price < Entity
5
+ attribute :included_traffic, :integer
5
6
  attribute :location
6
7
  attribute :price_hourly, :amount
7
8
  attribute :price_monthly, :amount
9
+ attribute :price_per_tb_traffic, :amount
8
10
  end
9
11
  end
@@ -3,6 +3,6 @@
3
3
  module HCloud
4
4
  class PrimaryIPPrices < Entity
5
5
  attribute :type
6
- attribute :prices, :price
6
+ attribute :prices, :price, array: true, default: -> { [] }
7
7
  end
8
8
  end
data/lib/hcloud/errors.rb CHANGED
@@ -8,7 +8,7 @@ module HCloud
8
8
  def initialize(data = {})
9
9
  @data = data
10
10
 
11
- super [data[:message], full_messages&.join("\n")].compact.join("\n\n")
11
+ super([data[:message], full_messages&.join("\n")].compact.join("\n\n"))
12
12
  end
13
13
 
14
14
  def full_messages
@@ -30,6 +30,16 @@ module HCloud
30
30
  id && id == other.id
31
31
  end
32
32
 
33
+ def self.attribute(name, *args, deprecated: false, **kwargs)
34
+ super(name, *args, **kwargs)
35
+
36
+ define_method(name) do |**params|
37
+ warn "[DEPRECATION] Field \"#{name}\" on #{self.class.name} is deprecated." if deprecated
38
+
39
+ super(**params)
40
+ end
41
+ end
42
+
33
43
  def self.resource_name
34
44
  name.demodulize.underscore
35
45
  end
@@ -29,11 +29,10 @@ module HCloud
29
29
  attribute :architecture
30
30
  attribute :type
31
31
 
32
- attribute :deprecated, :datetime
33
32
  attribute :deprecation, :deprecation
34
33
 
35
34
  def deprecated?
36
- deprecated.present?
35
+ deprecation.present?
37
36
  end
38
37
  end
39
38
  end
@@ -27,7 +27,7 @@ module HCloud
27
27
 
28
28
  attribute :server_types, :server_type_price, array: true, default: -> { [] }
29
29
 
30
- attribute :traffic, :traffic_price
30
+ attribute :traffic, :traffic_price, deprecated: true
31
31
 
32
32
  attribute :vat_rate
33
33
 
@@ -30,16 +30,20 @@ module HCloud
30
30
  attribute :cores, :integer
31
31
  attribute :disk, :integer
32
32
  attribute :memory, :integer
33
- attribute :included_traffic, :integer
33
+
34
+ # FIXME: Attribute will return null on 2024-08-05
35
+ # FIXME: Attribute will be removed on 2024-11-05
36
+ attribute :included_traffic, :integer, deprecated: true
34
37
 
35
38
  attribute :cpu_type
36
39
  attribute :storage_type
37
40
 
38
41
  attribute :prices, :price, array: true, default: -> { [] }
39
42
 
40
- attribute :deprecated, :boolean
41
43
  attribute :deprecation, :deprecation
42
44
 
45
+ attribute :deprecated, :boolean, deprecated: true
46
+
43
47
  alias deprecated? deprecated
44
48
  end
45
49
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  module HCloud
4
4
  module Version
5
- MAJOR = 1
6
- MINOR = 7
7
- PATCH = 2
5
+ MAJOR = 2
6
+ MINOR = 1
7
+ PATCH = 0
8
8
  PRE = nil
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH].compact.join(".")
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: 1.7.2
4
+ version: 2.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: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2024-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -179,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
179
  requirements:
180
180
  - - ">="
181
181
  - !ruby/object:Gem::Version
182
- version: '2.7'
182
+ version: '3.0'
183
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="