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.
42 43 44 45 |
# File 'lib/fog/serverlove/compute.rb', line 42 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
47 48 49 |
# File 'lib/fog/serverlove/compute.rb', line 47 def request() raise "Not implemented" end |