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

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Mock

Returns a new instance of Mock.



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

def initialize(options)
  @serverlove_uuid = options[:serverlove_uuid] || Fog.credentials[:serverlove_uuid]
  @serverlove_api_key = options[:serverlove_api_key] || Fog.credentials[:serverlove_api_key]
end

Instance Method Details

#create_image(options = {}) ⇒ Object



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

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



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

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



49
50
51
# File 'lib/fog/serverlove/compute.rb', line 49

def request(options)
  raise "Not implemented"
end