Sha256: 860b7f17715f29472d6102971cc47d2d00756346367941240da4a0b0b6d5e1bd

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

module Fog
  module Compute
    class CloudAtCost
      class Real
        def power_off(id)
          body = { sid: id.to_s, action: 'poweroff' }
          request(
            expects: [200],
            method: 'POST',
            path: 'api/v1/powerop.php',
            body: body
          )
        end
      end

      class Mock
        def power_off(_id)
          response = Excon::Response.new
          response.status = 200
          response.body = {
            'server_id' => Fog::Mock.random_numbers(1).to_i,
            'api'        => 'v1',
            'status'     => 'ok',
            'result'     => 'successful',
            'action'     => 'poweroff',
            'time'       => 12_312_323,
            'taskid'     => 123_123_123_123
          }
          response
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-cloudatcost-0.4.0 lib/fog/cloudatcost/requests/power_off.rb