Class: Fog::Compute::Serverlove::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/compute/serverlove.rb,
lib/fog/compute/serverlove/requests/create_image.rb,
lib/fog/compute/serverlove/requests/create_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Mock

Returns a new instance of Mock.



41
42
43
44
# File 'lib/fog/compute/serverlove.rb', line 41

def initialize(options)
  @serverlove_uuid = options[:serverlove_uuid]
  @serverlove_api_key = options[:serverlove_api_key]
end

Instance Method Details

#create_image(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fog/compute/serverlove/requests/create_image.rb', line 12

def create_image(options = {})
  response = Excon::Response.new
  response.status = 200

  data = {
    "drive"     => Fog::Mock.random_numbers(1000000).to_s,
    "name"      => options["name"] || "Test",
    "size"      => options["size"] || 12345
  }

  response.body = data
  response
end

#create_server(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/compute/serverlove/requests/create_server.rb', line 12

def create_server(options = {})
  response = Excon::Response.new
  response.status = 200

  data = {
    "server"       => Fog::Mock.random_numbers(1000000).to_s,
    "name"         => options["name"] || "Test",
    "cpu"          => options["cpu"] || 1000,
    "persistent"   => options["persistent"] || false,
    "vnc:password" => options["vnc:password"] || "T35tServER!"
  }

  response.body = data
  response
end

#request(options) ⇒ Object



46
47
48
# File 'lib/fog/compute/serverlove.rb', line 46

def request(options)
  raise "Not implemented"
end