Sha256: 9bf23047cbdef5ddf183ba748a7d17db0b952d6783c7686985bad4fedacf6126

Contents?: true

Size: 1015 Bytes

Versions: 46

Compression:

Stored size: 1015 Bytes

Contents

#
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
module Fog
  module Compute
    class Softlayer

      class Mock

        def update_key_pair(id, opts)
          response = Excon::Response.new
          response.status = 200

          key_pair, index = @key_pairs.each_with_index.map { |kp, i| [kp, i] if kp['id'] == id }.compact.flatten

          if key_pair.nil?
            response.status = 404
            response.body = {
                "error" => "Unable to find object with id of '#{id}'.",
                "code" => "SoftLayer_Exception_ObjectNotFound"
            }
          else

            @key_pairs[index] = key_pair.merge(opts)
            response.body = true
          end
          response
        end
      end

      class Real
        def update_key_pair(id, opts)
          request(:security_ssh_key, id, :body => opts, :http_method => :put)
        end
      end

    end
  end
end

Version data entries

46 entries across 44 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/compute/update_key_pair.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/compute/update_key_pair.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.1.4 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.1.3 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.1.2 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.1.1 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.1.0 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.0.3 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.0.2 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.0.1 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-1.0.0 lib/fog/softlayer/requests/compute/update_key_pair.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.7 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.6 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.5 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.4 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.3 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.2 lib/fog/softlayer/requests/compute/update_key_pair.rb
fog-softlayer-0.4.2.pre lib/fog/softlayer/requests/compute/update_key_pair.rb