<commit_before>require 'fog/core/collection'
require 'fog/opennebula/models/compute/network'

module Fog
  module Compute
    class OpenNebula
      class Networks < Fog::Collection
        model Fog::Compute::OpenNebula::Network

        def all(filter={})
          self.get_by_filter(filter)
        end

        def get(id)
          self.all({:id => id}).first
        end

        def get_by_filter(filter)
          load(service.list_networks(filter))
        end

      end
    end
  end
end
<commit_msg>[opennebula] added get_by_name for network model<commit_after>require 'fog/core/collection'
require 'fog/opennebula/models/compute/network'

module Fog
  module Compute
    class OpenNebula
      class Networks < Fog::Collection
        model Fog::Compute::OpenNebula::Network

        def all(filter={})
          self.get_by_filter(filter)
        end

        def get(id)
          data = service.list_networks({:id => id})
          load(data).first
        rescue Fog::Compute::OpenNebula::NotFound
          nil
        end

        def get_by_name(name)
          data = service.list_networks({:name => name})
          load(data)
        rescue Fog::Compute::OpenNebula::NotFound
          nil
        end

        def get_by_filter(filter)
          load(service.list_networks(filter))
        end

      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09347181008902077, 'fraction_numerical': 0.0, 'mean_word_length': 2.1666666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4759891', 'n_tokens_mistral': 423, 'n_tokens_neox': 411, 'n_words': 84}