lib/hcloud/entry_loader.rb in hcloud-1.0.2 vs lib/hcloud/entry_loader.rb in hcloud-1.0.3
- old
+ new
@@ -51,11 +51,11 @@
define_method(:destroy) { prepare_request(method: :delete) }
end
def protectable(*args)
define_method(:change_protection) do |**kwargs|
- kwargs.keys.each do |key|
+ kwargs.each_key do |key|
next if args.map(&:to_s).include? key.to_s
raise ArgumentError, "#{key} not an allowed protection mode (allowed: #{args})"
end
prepare_request('actions/change_protection', j: kwargs)
@@ -92,10 +92,15 @@
end
end
attr_accessor :response
- def initialize(client = nil, **kwargs)
+ def initialize(client = nil, kwargs = {})
+ if client.is_a?(Hash)
+ kwargs = client
+ client = nil
+ end
+
@client = client
_load(kwargs)
end
def inspect