Class: Fog::Compute::Serverlove::Mock
- Inherits:
-
Object
- Object
- Fog::Compute::Serverlove::Mock
- 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
- #create_image(options = {}) ⇒ Object
- #create_server(options = {}) ⇒ Object
-
#initialize(options) ⇒ Mock
constructor
A new instance of Mock.
- #request(options) ⇒ Object
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() @serverlove_uuid = [:serverlove_uuid] || Fog.credentials[:serverlove_uuid] @serverlove_api_key = [: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( = {}) response = Excon::Response.new response.status = 200 data = { 'drive' => Fog::Mock.random_numbers(1000000).to_s, 'name' => ['name'] || 'Test', 'size' => ['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( = {}) response = Excon::Response.new response.status = 200 data = { 'server' => Fog::Mock.random_numbers(1000000).to_s, 'name' => ['name'] || 'Test', 'cpu' => ['cpu'] || 1000, 'persistent' => ['persistent'] || false, 'vnc:password' => ['vnc:password'] || 'T35tServER!' } response.body = data response end |
#request(options) ⇒ Object
49 50 51 |
# File 'lib/fog/serverlove/compute.rb', line 49 def request() raise "Not implemented" end |