Sha256: dc1e32f2c35ba1998ad7c1fbd727aa41650c2639f841344fe9b06fa7f69a5c06

Contents?: true

Size: 778 Bytes

Versions: 6

Compression:

Stored size: 778 Bytes

Contents

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

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

        model Fog::Compute::Ecloud::Association

        def all
          data = service.get_associations(href).body
          if data[:Associations]
            data = data[:Associations]
            if data.is_a?(String) && data.empty?
              data = []
            elsif data.is_a?(Hash)
              data = data[:Association]
            end
          end
          load(data)
        end

        def get(uri)
          if data = service.get_association(uri)
            new(data.body)
          end
        rescue Fog::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/associations.rb
fog-ecloud-0.2.0 lib/fog/compute/ecloud/models/associations.rb
fog-ecloud-0.1.3 lib/fog/compute/ecloud/models/associations.rb
fog-ecloud-0.1.2 lib/fog/compute/ecloud/models/associations.rb
fog-ecloud-0.1.1 lib/fog/compute/ecloud/models/associations.rb
fog-ecloud-0.1.0 lib/fog/compute/ecloud/models/associations.rb