Sha256: 8f08149cbd676b7cdaf2db29848d08f4186bf2a5741e9b0006b1d983cf19ae7c

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

module Fog
  module Compute
    class CloudAtCost
      class Real
        def create_server(cpu, ram, storage, template_id)
          body = { cpu: cpu.to_s, ram: ram.to_s, storage: storage.to_s, os: template_id.to_s }
          request(
            expects: [200],
            method: 'POST',
            path: 'api/v1/cloudpro/build.php',
            body: body
          )
        end
      end

      class Mock
        def create_server(_cpu, _ram, _storage, _template_id)
          response = Excon::Response.new
          response.status = 200
          response.body = {
            'result'     => 'successful',
            'api'        => 'v1',
            'action'     => 'build',
            'status'     => 'ok',
            'taskid'     => 123_123_123_123,
            'time'       => 12_312_323
          }
          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/create_server.rb