Class: Fog::Compute::RackspaceV2::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/rackspace/compute_v2.rb,
lib/fog/rackspace/requests/compute_v2/create_image.rb

Instance Method Summary collapse

Instance Method Details

#create_image(server_id, options = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/rackspace/requests/compute_v2/create_image.rb', line 36

def create_image(server_id, options = {})
  response = Excon::Response.new
  response.status = 202

  now = Time.now
  data = {
    'created'   => now,
    'id'        => Fog::Mock.random_numbers(6).to_i,
    'name'      => options['name'] || '',
    'serverId'  => server_id,
    'status'    => 'SAVING',
    'updated'   => now.to_s,
  }

  self.data[:last_modified][:images][data['id']] = now
  self.data[:images][data['id']] = data
  response.body = { 'image' => data.reject {|key, value| !['id', 'name', 'serverId', 'status', 'updated'].include?(key)} }
  response
end

#request(params) ⇒ Object



56
57
58
# File 'lib/fog/rackspace/compute_v2.rb', line 56

def request(params)
  Fog::Mock.not_implemented
end