Sha256: 680e4afa5da3ce3264b05a59572f5d3246277bed7a4c7299a25476fb4f1c7565

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require 'fog/compute/models/ecloud/internet_service'

module Fog
  module Ecloud
    class Compute
      class InternetServices < Fog::Ecloud::Collection

        model Fog::Ecloud::Compute::InternetService

        attribute :href, :aliases => :Href

        def all
          check_href! :message => "the Internet Services for the Vdc you want to enumerate"
          if internet_service_data = connection.get_internet_services(href).body[:InternetService]
            load(Array[internet_service_data].flatten.find_all {|i| i[:IsBackupService] == "false" })
          end
        end

        # Optimize later, no need to get_internet_services again?
        def get(uri)
          internet_services = connection.get_internet_services(href).body[:InternetService]
          internet_services = [ internet_services ] if internet_services.is_a?(Hash)
          if data = internet_services.detect { |service| service[:Href] == uri }
            new(data)
          end
        rescue Fog::Errors::NotFound
          nil
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/compute/models/ecloud/internet_services.rb
fog-0.8.1 lib/fog/compute/models/ecloud/internet_services.rb
fog-0.8.0 lib/fog/compute/models/ecloud/internet_services.rb
fog-0.7.2 lib/fog/compute/models/ecloud/internet_services.rb
fog-0.7.1 lib/fog/compute/models/ecloud/internet_services.rb
fog-0.7.0 lib/fog/compute/models/ecloud/internet_services.rb
fog-0.6.0 lib/fog/compute/models/ecloud/internet_services.rb