lib/fog/cloudatcost/requests/console.rb in fog-cloudatcost-0.2.3 vs lib/fog/cloudatcost/requests/console.rb in fog-cloudatcost-0.4.0

- old
+ new

@@ -1,29 +1,34 @@ +# frozen_string_literal: true + module Fog module Compute class CloudAtCost class Real def console(id) - body = { :sid => "#{id}" } + body = { sid: id.to_s } request( - :expects => [200], - :method => 'POST', - :path => 'api/v1/console.php', - :body => body, + expects: [200], + method: 'POST', + path: 'api/v1/console.php', + body: body ) end end class Mock - def console(id, hostname) - response = Excon::Response.new - response.status = 200 - response.body = { + def console(_id, _hostname) + console_url = + 'http:\/\/panel.cloudatcost.com:12345\/console.html?servername=123456&hostname=1.1.1.1'\ + '&sshkey=123456&sha1hash=aBcDeFgG' + response = Excon::Response.new + response.status = 200 + response.body = { 'server_id' => Fog::Mock.random_numbers(1).to_i, 'api' => 'v1', 'status' => 'ok', - 'console' => 'http:\/\/panel.cloudatcost.com:12345\/console.html?servername=123456&hostname=1.1.1.1&sshkey=123456&sha1hash=aBcDeFgG', - 'time' => 12312323, + 'console' => console_url, + 'time' => 12_312_323 } response end end end