Sha256: b2ed7a5b4cb99286a031fe11cb18c3401afff97d6b0324a19ce8dc4610437edb

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

# coding: utf-8
#
# Author:: Alessio Rocchi (<alessio.rocchi@staff.aruba.it>)
# © Copyright ArubaCloud.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

require 'fog/arubacloud/service'
require 'fog/arubacloud/error'
require 'benchmark'

module Fog
  module ArubaCloud
    class Compute
      class Real
        def get_hypervisors
          body = self.body('GetHypervisors')
          response = nil
          time = Benchmark.realtime {
            response = request( body, 'GetHypervisors', "GetHypervisors Error"  )
          }
          Fog::Logger.debug("GetHypervisors time: #{time}")
          if response['Success']
            response
          else
            raise Fog::ArubaCloud::Errors::RequestError.new('Error in request.')
          end
        end # get_hypervisors
      end # Real

      class Mock
        # Due to the length of the response body, I actually decided to not implement
        # the mock method of the request. I will introduce it in the next version after structuring the mock
        # objects in a more reasonable way.
        #
        def get_hypervisors
          raise Fog::Errors::MockNotImplemented.new(
              'Mock object for get_hypervisor not present, read code comments for details.'
          )
        end # get_hypervisors
      end # Mock

    end # Compute
  end # ArubaCloud
end # Fog

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-arubacloud-0.0.6 lib/fog/arubacloud/compute/requests/get_hypervisors.rb
fog-arubacloud-0.0.5 lib/fog/arubacloud/compute/requests/get_hypervisors.rb