<commit_before>require File.expand_path("../ssh_key", __FILE__)

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

        model Fog::Compute::Ecloud::SshKey

        def all
          data = service.get_ssh_keys(href).body[:SshKey]
          load(data)
        end

        def get(uri)
          if data = service.get_ssh_key(uri).body
            new(data)
          end
        rescue Fog::Errors::NotFound
          nil
        end

        def create(options = {})
          # Make sure we only pass what we should
          new_options           = {}
          new_options[:name]    = options[:name] unless options[:name].nil?
          new_options[:default] = options[:default] || false
          new_options[:uri]     = href + "/action/createSshKey"

          data = service.ssh_key_create(new_options)
          object = service.ssh_keys.new(data)
          object
        end

        def environment_id
          href.scan(/\d+/)[0]
        end
      end<commit_msg>Changed error from Fog to Excon to reflect what's actually thrown.<commit_after>require File.expand_path("../ssh_key", __FILE__)

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

        model Fog::Compute::Ecloud::SshKey

        def all
          data = service.get_ssh_keys(href).body[:SshKey]
          load(data)
        end

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

        def create(options = {})
          # Make sure we only pass what we should
          new_options           = {}
          new_options[:name]    = options[:name] unless options[:name].nil?
          new_options[:default] = options[:default] || false
          new_options[:uri]     = href + "/action/createSshKey"

          data = service.ssh_key_create(new_options)
          object = service.ssh_keys.new(data)
          object
        end

        def environment_id
          href.scan(/\d+/)[0]
        end
      end
{'fraction_non_alphanumeric': 0.09799346710219319, 'fraction_numerical': 0.0009332711152589828, 'mean_word_length': 1.7844155844155845, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4029875', 'n_tokens_mistral': 627, 'n_tokens_neox': 605, 'n_words': 139}