Sha256: 6c031e25c1b1696ad0d1833608ea586147d795e86618e372a046b458ea817061

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 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 ServiceError => e
          raise e unless e.status_code == 404
          nil
        end
      end
    end
  end
end

Version data entries

4 entries across 2 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/associations.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/associations.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/associations.rb
fog-ecloud-0.3.0 lib/fog/compute/ecloud/models/associations.rb