1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/digitalocean/requests/compute/create_ssh_key.rb

38 lines
843 B
Ruby

module Fog
module Compute
class DigitalOcean
class Real
def create_ssh_key( name, pub_key )
request(
:expects => [200],
:method => 'GET',
:path => 'ssh_keys/new',
:query => { 'name' => name, 'ssh_pub_key' => pub_key }
)
end
end
class Mock
def create_ssh_key( name, pub_key )
response = Excon::Response.new
response.status = 200
mock_data = {
"id" => Fog::Mock.random_numbers(1).to_i,
"name" => name,
"ssh_pub_key" => pub_key
}
response.body = {
"status" => "OK",
"ssh_key" => mock_data
}
self.data[:ssh_keys] << mock_data
response
end
end
end
end
end