Sha256: f6b6233e354ee61d22c37cf0b3abe9d80919b0c2949c938874e3f133bf9ca16a

Contents?: true

Size: 1.41 KB

Versions: 25

Compression:

Stored size: 1.41 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real

        def get_flavor_details(flavor_ref)
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => "flavors/#{flavor_ref}.json"
          )
        end

      end

      class Mock

        def get_flavor_details(flavor_ref)
          response = Excon::Response.new
          flavor = {
            '1' => { 'id' => '1', 'name' => '256 server', 'ram' => 256, 'disk' => 10, 'links' => [] },
            '2' => { 'id' => '2', 'name' => '512 server', 'ram' => 512, 'disk' => 20, 'links' => [] },
            '3' => { 'id' => '3', 'name' => '1GB server', 'ram' => 1024, 'disk' => 40, 'links' => [] },
            '4' => { 'id' => '4', 'name' => '2GB server', 'ram' => 2048, 'disk' => 80, 'links' => [] },
            '5' => { 'id' => '5', 'name' => '4GB server', 'ram' => 4096, 'disk' => 160, 'links' => [] },
            '6' => { 'id' => '6', 'name' => '8GB server', 'ram' => 8192, 'disk' => 320, 'links' => [] },
            '7' => { 'id' => '7', 'name' => '15.5GB server', 'ram' => 15872, 'disk' => 620, 'links' => [] }
          }[flavor_ref]
          if flavor
            response.status = 200
            response.body = {
              'flavor' => flavor
            }
            response
          else
            raise Fog::Compute::OpenStack::NotFound
          end
        end

      end
    end
  end
end

Version data entries

25 entries across 25 versions & 8 rubygems

Version Path
rackspace-fog-1.4.2 lib/rackspace-fog/openstack/requests/compute/get_flavor_details.rb
fog-1.4.0 lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
michiels-fog-1.3.1 lib/fog/openstack/requests/compute/get_flavor_details.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
fog-1.3.1 lib/fog/openstack/requests/compute/get_flavor_details.rb
fog-1.3.0 lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
fog-1.2.0 lib/fog/openstack/requests/compute/get_flavor_details.rb
ktheory-fog-1.1.2 lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb
fog-1.1.2 lib/fog/openstack/requests/compute/get_flavor_details.rb
fog_tractical-1.1.4 lib/fog/openstack/requests/compute/get_flavor_details.rb
fog_tractical-1.1.3 lib/fog/openstack/requests/compute/get_flavor_details.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb