lib/fog/cloudatcost/models/server.rb in fog-cloudatcost-0.2.3 vs lib/fog/cloudatcost/models/server.rb in fog-cloudatcost-0.4.0
- old
+ new
@@ -1,12 +1,14 @@
+# frozen_string_literal: true
+
require 'fog/compute/models/server'
module Fog
module Compute
class CloudAtCost
class Server < Fog::Compute::Server
- identity :sid
+ identity :sid
attribute :id
attribute :CustID
attribute :packageid
attribute :servername
attribute :label
@@ -33,23 +35,22 @@
attribute :uid
attribute :rdns
attribute :rdnsdefault
attribute :template_id
-
def new_instance?
- not persisted?
+ !persisted?
end
def save
- raise Fog::Errors::Error.new('Re-saving an existing object may create a duplicate') if persisted?
+ raise Fog::Errors::Error, 'Re-saving an existing object may create a duplicate' if persisted?
save!
end
def save!
requires :cpu, :ram, :storage, :template_id
- data = service.create_server(cpu, ram, storage, template_id)
+ service.create_server(cpu, ram, storage, template_id)
end
def destroy
perform_action :delete_server
end
@@ -87,10 +88,9 @@
def perform_action(action, *args)
requires :sid
response = service.send(action, sid, *args)
response.body
end
-
end
end
end
end