Sha256: ee7fa97f748ca4f35e61dc0a7f475688db3bcc02fef675ad704380c87c6e3916

Contents?: true

Size: 862 Bytes

Versions: 6

Compression:

Stored size: 862 Bytes

Contents

require File.expand_path("../group", __FILE__)

module Fog
  module Compute
    class Ecloud
      class Groups < Fog::Ecloud::Collection
        identity :href

        model Fog::Compute::Ecloud::Group

        def all
          data = service.get_groups(href).body
          data = if data == ""
                   ""
                 else
                   data[:Groups] ? data[:Groups][:Group] : data
                 end
          if data == "" || !data.is_a?(Array) && data[:type] == "application/vnd.tmrk.cloud.layoutRow"
            nil
          else
            load(data)
          end
        end

        def get(uri)
          data = service.get_group(uri).body
          if data == ""
            nil
          else
            new(data)
          end
        rescue Excon::Errors::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-ecloud-0.1.1/lib/fog/compute/ecloud/models/groups.rb
fog-ecloud-0.2.0 lib/fog/compute/ecloud/models/groups.rb
fog-ecloud-0.1.3 lib/fog/compute/ecloud/models/groups.rb
fog-ecloud-0.1.2 lib/fog/compute/ecloud/models/groups.rb
fog-ecloud-0.1.1 lib/fog/compute/ecloud/models/groups.rb
fog-ecloud-0.1.0 lib/fog/compute/ecloud/models/groups.rb