hetznercloud 1.5.3 → 1.6.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: e82485e18ec51b75abdfc2225e7e587faccef06aff1d05d500b8ff8b7ba22921
4
- data.tar.gz: b8a93fc80f0ab613a5dda0b31653b744bcdcd9a3e240ec0442e0b1f0698c67ac
3
+ metadata.gz: cc1e6087fa61d27ee8763b0f9f128bc26d9e162f5355a965d462136ee5a2e244
4
+ data.tar.gz: 7750141e35af391668ac9d94de7958060fc00ebdea4e0a668f89d05dec484ece
5
5
  SHA512:
6
- metadata.gz: 4ed29029191856a529ed17ffe9a596052091a06e7c2c49ed9930e0caa1b1659754036b172400dcb593d1159a7058d0362c08d5a2f33ed664306b1943db4eafb0
7
- data.tar.gz: 9d94e954c98652f5903195e400bebad25723bdccdd2ab85dbcefcd168a57dbfd0e1054f4a585f1e398b362f072e8b1072151fd44d4202f801e75514ea8915b04
6
+ metadata.gz: b99b994d194dda71ed3957786348bbe4bf0afb83872373fbb313c2ba10535fcfa7055a2ceb3f492b4f3dd7100e506175a787d11a68049b1d3cd0d4c0204daac4
7
+ data.tar.gz: fa5c8eb4c9c7c6998653a2387b3e935f1f5148e02de29bc9d1b1338b589e8d7e9403d966302f882ede4e1e3548b6350d282ba69950873b87a6ecb2bbc892423c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## HCloud v1.6.0 (2023-06-07)
4
+
5
+ - Add `deprecation` attribute to `ServerType`
6
+ - Parse `private_net` attribute on `Server` as array
7
+ - Parse `public_net.firewalls` attribute on `Server` as array of objects with status (not array of `Firewall`s)
8
+
9
+ ## HCloud v1.5.4 (2023-05-17)
10
+
11
+ - Allow defining attributes on the fly
12
+
3
13
  ## HCloud v1.5.3 (2023-05-09)
4
14
 
5
15
  - Add `included_traffic` attribute to `ServerType`
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  group :development, :test do
9
- gem "byebug", require: false
9
+ gem "debug", require: false
10
10
  gem "dotenv", require: false
11
11
  gem "ffaker", require: false
12
12
  gem "rake", require: false
data/README.md CHANGED
@@ -10,8 +10,6 @@ Unofficial Ruby integration with the [Hetzner Cloud API](https://docs.hetzner.cl
10
10
  Add this line to your application's Gemfile:
11
11
 
12
12
  ```ruby
13
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
14
-
15
13
  gem "hetznercloud"
16
14
  ```
17
15
 
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HCloud
4
+ module DynamicAttributes
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ def method_missing(name, *args) # rubocop:disable Metrics/AbcSize
9
+ return super unless name.to_s.end_with?("=")
10
+
11
+ # Infer attribute name
12
+ attribute = name.to_s.chomp("=")
13
+
14
+ return super if attribute_names.include?(attribute)
15
+
16
+ warn "Unknown attribute: #{self.class.name}##{attribute}. Please file an issue at https://github.com/floriandejonckheere/hcloud/issues/new?title=Unknown+attribute+#{self.class.name}%23#{attribute}."
17
+
18
+ # Add definition to class singleton
19
+ self.class.attribute(name.to_s.chomp("=").to_sym, :string)
20
+
21
+ # Add definition to current instance
22
+ @attributes[name.to_s.chomp("=")] = self.class._default_attributes[name.to_s.chomp("=")].dup
23
+
24
+ # Set attribute
25
+ send(name, *args)
26
+ end
27
+
28
+ def respond_to_missing?(name, include_private = false)
29
+ name.to_s.end_with?("=") || super
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HCloud
4
+ class Deprecation < Entity
5
+ attribute :announced, :datetime
6
+ attribute :unavailable_after, :datetime
7
+ end
8
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module HCloud
4
4
  class PublicNet < Entity
5
- attribute :firewalls, :firewall, array: true, default: -> { [] }
5
+ attribute :firewalls, :public_net_firewall, array: true, default: -> { [] }
6
6
  attribute :floating_ips, :floating_ip, array: true, default: -> { [] }
7
7
  attribute :ipv4, :ipv4
8
8
  attribute :ipv6, :ipv6
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HCloud
4
+ class PublicNetFirewall < Entity
5
+ attribute :id, :integer
6
+ attribute :status
7
+
8
+ def applied?
9
+ status == "applied"
10
+ end
11
+
12
+ def pending?
13
+ status == "pending"
14
+ end
15
+ end
16
+ end
@@ -6,6 +6,7 @@ module HCloud
6
6
  include ActiveModel::AttributeAssignment
7
7
 
8
8
  include Concerns
9
+ include DynamicAttributes
9
10
 
10
11
  def initialize(attributes = {})
11
12
  super()
@@ -90,6 +90,7 @@ ActiveModel::Type.register(:certificate, HCloud::ResourceType.Type("HCloud::Cert
90
90
  ActiveModel::Type.register(:certificate_status, HCloud::ResourceType.Type("HCloud::CertificateStatus"))
91
91
  ActiveModel::Type.register(:datacenter, HCloud::ResourceType.Type("HCloud::Datacenter"))
92
92
  ActiveModel::Type.register(:datacenter_server_type, HCloud::ResourceType.Type("HCloud::DatacenterServerType"))
93
+ ActiveModel::Type.register(:deprecation, HCloud::ResourceType.Type("HCloud::Deprecation"))
93
94
  ActiveModel::Type.register(:dns_pointer, HCloud::ResourceType.Type("HCloud::DNSPointer"))
94
95
  ActiveModel::Type.register(:error, HCloud::ResourceType.Type("HCloud::Error"))
95
96
  ActiveModel::Type.register(:firewall, HCloud::ResourceType.Type("HCloud::Firewall"))
@@ -122,6 +123,7 @@ ActiveModel::Type.register(:private_net, HCloud::ResourceType.Type("HCloud::Priv
122
123
  ActiveModel::Type.register(:private_network, HCloud::ResourceType.Type("HCloud::PrivateNetwork"))
123
124
  ActiveModel::Type.register(:protection, HCloud::ResourceType.Type("HCloud::Protection"))
124
125
  ActiveModel::Type.register(:public_net, HCloud::ResourceType.Type("HCloud::PublicNet"))
126
+ ActiveModel::Type.register(:public_net_firewall, HCloud::ResourceType.Type("HCloud::PublicNetFirewall"))
125
127
  ActiveModel::Type.register(:resource, HCloud::ResourceType::GenericType)
126
128
  ActiveModel::Type.register(:route, HCloud::ResourceType.Type("HCloud::Route"))
127
129
  ActiveModel::Type.register(:rule, HCloud::ResourceType.Type("HCloud::Rule"))
@@ -116,7 +116,7 @@ module HCloud
116
116
  attribute :image, :image
117
117
 
118
118
  attribute :public_net, :public_net
119
- attribute :private_net, :private_net
119
+ attribute :private_net, :private_net, array: true, default: -> { [] }
120
120
 
121
121
  attribute :placement_group, :placement_group
122
122
 
@@ -38,6 +38,7 @@ module HCloud
38
38
  attribute :prices, :price, array: true, default: -> { [] }
39
39
 
40
40
  attribute :deprecated, :boolean
41
+ attribute :deprecation, :deprecation
41
42
 
42
43
  alias deprecated? deprecated
43
44
  end
@@ -3,8 +3,8 @@
3
3
  module HCloud
4
4
  module Version
5
5
  MAJOR = 1
6
- MINOR = 5
7
- PATCH = 3
6
+ MINOR = 6
7
+ PATCH = 0
8
8
  PRE = nil
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -12,6 +12,6 @@ module HCloud
12
12
  STRING = [VERSION, PRE].compact.join("-")
13
13
  end
14
14
 
15
- NAME = "hcloud"
15
+ NAME = "hetznercloud"
16
16
  VERSION = Version::STRING
17
17
  end
data/lib/hcloud.rb CHANGED
@@ -4,8 +4,6 @@ require "active_model"
4
4
  require "active_support/all"
5
5
  require "zeitwerk"
6
6
 
7
- require "byebug" if ENV["ENV"] == "development"
8
-
9
7
  module HCloud
10
8
  class << self
11
9
  # Code loader instance
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.5.3
4
+ version: 1.6.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-05-09 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -87,6 +87,7 @@ files:
87
87
  - lib/hcloud/concerns/concerns.rb
88
88
  - lib/hcloud/concerns/creatable.rb
89
89
  - lib/hcloud/concerns/deletable.rb
90
+ - lib/hcloud/concerns/dynamic_attributes.rb
90
91
  - lib/hcloud/concerns/labelable.rb
91
92
  - lib/hcloud/concerns/meterable.rb
92
93
  - lib/hcloud/concerns/queryable.rb
@@ -99,6 +100,7 @@ files:
99
100
  - lib/hcloud/entities/apply_to.rb
100
101
  - lib/hcloud/entities/certificate_status.rb
101
102
  - lib/hcloud/entities/datacenter_server_type.rb
103
+ - lib/hcloud/entities/deprecation.rb
102
104
  - lib/hcloud/entities/dns_pointer.rb
103
105
  - lib/hcloud/entities/error.rb
104
106
  - lib/hcloud/entities/floating_ip_price.rb
@@ -120,6 +122,7 @@ files:
120
122
  - lib/hcloud/entities/private_network.rb
121
123
  - lib/hcloud/entities/protection.rb
122
124
  - lib/hcloud/entities/public_net.rb
125
+ - lib/hcloud/entities/public_net_firewall.rb
123
126
  - lib/hcloud/entities/route.rb
124
127
  - lib/hcloud/entities/rule.rb
125
128
  - lib/hcloud/entities/server_backup_price.rb