Sha256: f6ff9af0969285eea82a2c4fa87e699eaa3842478e86906bb62e647f7b88b1fe
Contents?: true
Size: 1.18 KB
Versions: 7
Compression:
Stored size: 1.18 KB
Contents
module Fog module Compute class DigitalOcean # noinspection RubyStringKeysInHashInspection class Real def create_ssh_key(name, public_key) create_options = { :name => name, :public_key => public_key, } encoded_body = Fog::JSON.encode(create_options) request( :expects => [201], :headers => { 'Content-Type' => "application/json; charset=UTF-8", }, :method => 'POST', :path => '/v2/account/keys', :body => encoded_body, ) end end # noinspection RubyStringKeysInHashInspection class Mock def create_ssh_key(name, public_key) response = Excon::Response.new response.status = 201 data[:ssh_keys] << { "id" => Fog::Mock.random_numbers(6).to_i, "fingerprint" => (["00"] * 16).join(':'), "public_key" => public_key, "name" => name } response.body ={ 'ssh_key' => data[:ssh_keys].last } response end end end end end
Version data entries
7 entries across 5 versions & 2 rubygems