class Fog::Compute::DigitalOceanV2::Mock

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

noinspection RubyStringKeysInHashInspection

Public Class Methods

data() click to toggle source
# File lib/fog/digitalocean/compute_v2.rb, line 55
def self.data
  @data ||= Hash.new do |hash, key|
    hash[key] = {
      :servers  => [],
      :ssh_keys => []
    }
  end
end
new(options={}) click to toggle source
# File lib/fog/digitalocean/compute_v2.rb, line 64
def initialize(options={})
  @digitalocean_token = options[:digitalocean_token]
end

Public Instance Methods

change_kernel(id, kernel) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/change_kernel.rb, line 23
def change_kernel(id, kernel)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "change_kernel",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
convert_to_snapshot(id, name) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/convert_to_snapshot.rb, line 23
def convert_to_snapshot(id, name)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id' => 46592838,
      'status' => 'completed',
      'type' => 'convert_to_snapshot',
      'started_at' => '2015-03-24T19:02:47Z',
      'completed_at' => '2015-03-24T19:02:47Z',
      'resource_id' => 11060029,
      'resource_type' => 'image',
      'region' => null,
      'region_slug' => null
    }
  }
  response
end
create_server(name, size, image, region, options = {}) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/create_server.rb, line 44
def create_server(name,
                  size,
                  image,
                  region,
                  options = {})

  response        = Excon::Response.new
  response.status = 202

  response.body = {
    'droplet' => {
      'id'           => 3164494,
      'name'         => name,
      'memory'       => 512,
      'vcpus'        => 1,
      'disk'         => 20,
      'locked'       => true,
      'status'       => 'new',
      'kernel'       => {
        'id'      => 2233,
        'name'    => 'Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic',
        'version' => '3.13.0-37-generic'
      },
      'created_at'   => '2014-11-14T16:36:31Z',
      'features'     => %w(virtio),
      'backup_ids'   => [],
      'snapshot_ids' => [],
      'image'        => {},
      'size'         => {},
      'size_slug'    => '512mb',
      'networks'     => {},
      'region'       => {}
    },
    'links'   => {
      'actions' => [
        {
          'id'   => 36805096,
          'rel'  => "create",
          'href' => "https://api.digitalocean.com/v2/actions/36805096"
        }
      ]
    }
  }

  response
end
create_ssh_key(name, public_key) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/create_ssh_key.rb, line 29
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
data() click to toggle source
# File lib/fog/digitalocean/compute_v2.rb, line 68
def data
  self.class.data[@digitalocean_token]
end
delete_server(server_id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/destroy_server.rb, line 24
def delete_server(server_id)
  destroy_server(server_id)
end
delete_ssh_key(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/delete_ssh_key.rb, line 20
def delete_ssh_key(id)
  self.data[:ssh_keys].select! do |key|
    key["id"] != id
  end

  response        = Excon::Response.new
  response.status = 204
  response
end
destroy_server(_) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/destroy_server.rb, line 27
def destroy_server(_)
  response        = Excon::Response.new
  response.status = 204
  response
end
disable_backups(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/disable_backups.rb, line 23
def disable_backups(id)
  response        = Excon::Response.new
  response.status = 201
  response.body   = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "disable_backups",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
enable_ipv6(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/enable_ipv6.rb, line 23
def enable_ipv6(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "enable_ipv6",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
enable_private_networking(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/enable_private_networking.rb, line 23
def enable_private_networking(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "enable_private_networking",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
get_droplet_action(droplet_id, action) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/get_droplet_action.rb, line 15
def get_droplet_action(droplet_id, action)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "change_kernel",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
get_server_details(_) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/get_image_details.rb, line 16
def get_server_details(_)
  response        = Excon::Response.new
  response.status = 200

  response.body = {
    'image' =>
    {
      'id' => 7555620,
      'name' => 'Nifty New Snapshot',
      'distribution' => 'Ubuntu',
      'slug' => null,
      'public' => false,
      'regions' => [
        'nyc2',
        'nyc2'
        ],
        'created_at' => '2014-11-04T22:23:02Z',
        'min_disk_size' => 20
      }
    }

  response
end
get_ssh_key(_) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/get_ssh_key.rb, line 16
def get_ssh_key(_)
  response        = Excon::Response.new
  response.status = 200

  response.body = {
    'ssh_key' => {
      'id'          => 512190,
      'fingerprint' => '3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa',
      'public_key'  => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example',
      'name'        => 'My SSH Public Key'
    }
  }

  response
end
list_droplet_actions(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/list_droplet_actions.rb, line 15
def list_droplet_actions(id)
  response        = Excon::Response.new
  response.status = 201
  response.body   = {
    'actions' => [
      'action' => {
        'id'            => Fog::Mock.random_numbers(1).to_i,
        'status'        => "in-progress",
        'type'          => "change_kernel",
        'started_at'    => "2014-11-14T16:31:00Z",
        'completed_at'  => null,
        'resource_id'   => id,
        'resource_type' => "droplet",
        'region'        => "nyc3",
        'region_slug'   => "nyc3"
      }
    ]
  }
  response
end
list_flavors() click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/list_flavors.rb, line 16
def list_flavors
  response        = Excon::Response.new
  response.status = 200
  response.body   = {

    'sizes' => [
      {
        'slug'          => '512mb',
        'memory'        => 512,
        'vcpus'         => 1,
        'disk'          => 20,
        'transfer'      => 1.0,
        'price_monthly' => 5.0,
        'price_hourly'  => 0.00744,
        'regions'       => %w(nyc1 sgp1 ams1 ams2 sfo1 nyc2 lon1 nyc3 ams3),
        'available'     => true
      },
      {
        'slug'          => '1gb',
        'memory'        => 1024,
        'vcpus'         => 1,
        'disk'          => 30,
        'transfer'      => 2.0,
        'price_monthly' => 10.0,
        'price_hourly'  => 0.01488,
        'regions'       => %w(nyc2 sgp1 ams1 sfo1 lon1 nyc3 ams3 ams2 nyc1),
        'available'     => true
      },
      {
        'slug'          => '2gb',
        'memory'        => 2048,
        'vcpus'         => 2,
        'disk'          => 40,
        'transfer'      => 3.0,
        'price_monthly' => 20.0,
        'price_hourly'  => 0.02976,
        'regions'       => %w(nyc2 sfo1 ams1 sgp1 ams2 lon1 nyc3 ams3 nyc1),
        'available'     => true
      },
      {
        'slug'          => '4gb',
        'memory'        => 4096,
        'vcpus'         => 2,
        'disk'          => 60,
        'transfer'      => 4.0,
        'price_monthly' => 40.0,
        'price_hourly'  => 0.05952,
        'regions'       => %w(nyc2 sfo1 ams1 sgp1 ams2 lon1 nyc3 ams3 nyc1),
        'available'     => true
      },
      {
        'slug'          => '8gb',
        'memory'        => 8192,
        'vcpus'         => 4,
        'disk'          => 80,
        'transfer'      => 5.0,
        'price_monthly' => 80.0,
        'price_hourly'  => 0.11905,
        'regions'       => %w(nyc2 sfo1 sgp1 ams1 ams2 nyc1 lon1 nyc3 ams3),
        'available'     => true
      },
      {
        'slug'          => '16gb',
        'memory'        => 16384,
        'vcpus'         => 8,
        'disk'          => 160,
        'transfer'      => 6.0,
        'price_monthly' => 160.0,
        'price_hourly'  => 0.2381,
        'regions'       => %w(sgp1 nyc1 sfo1 ams2 nyc3 lon1 nyc2 ams1 ams3),
        'available'     => true
      },
      {
        'slug'          => '32gb',
        'memory'        => 32768,
        'vcpus'         => 12,
        'disk'          => 320,
        'transfer'      => 7.0,
        'price_monthly' => 320.0,
        'price_hourly'  => 0.47619,
        'regions'       => %w(nyc2 sgp1 ams2 nyc1 sfo1 lon1 ams3 nyc3),
        'available'     => true
      },
      {
        'slug'          => '48gb',
        'memory'        => 49152,
        'vcpus'         => 16,
        'disk'          => 480,
        'transfer'      => 8.0,
        'price_monthly' => 480.0,
        'price_hourly'  => 0.71429,
        'regions'       => %w(sgp1 ams2 sfo1 nyc1 lon1 nyc2 ams3 nyc3),
        'available'     => true
      },
      {
        'slug'          => '64gb',
        'memory'        => 65536,
        'vcpus'         => 20,
        'disk'          => 640,
        'transfer'      => 9.0,
        'price_monthly' => 640.0,
        'price_hourly'  => 0.95238,
        'regions'       => %w(sgp1 nyc1 nyc2 sfo1 lon1 ams3 ams2 nyc3),
        'available'     => true
      }
    ],
    'links' => {},
    'meta'  => {'total' => 9}
  }

  response
end
list_images(filters = {}) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/list_images.rb, line 16
def list_images(filters = {})
  response        = Excon::Response.new
  response.status = 200
  response.body   = {

    'images' => [
      {
        'id'            => 7555620,
        'name'          => 'Nifty New Snapshot',
        'distribution'  => 'Ubuntu',
        'slug'          => nil,
        'public'        => false,
        'regions'       => %w(nyc2 nyc3),
        'created_at'    => '2014-11-04T22:23:02Z',
        'type'          => 'snapshot',
        'min_disk_size' => 20,
      }
    ],
    'links'  => {
      'pages' => {
        'last' => 'https://api.digitalocean.com/v2/images?page=56&per_page=1',
        'next' => 'https://api.digitalocean.com/v2/images?page=2&per_page=1'
      }
    },
    'meta'   => {
      'total' => 56
    }
  }

  response
end
list_regions(filters = {}) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/list_regions.rb, line 16
def list_regions(filters = {})
  response        = Excon::Response.new
  response.status = 200
  response.body   = {
    'regions' => [
      {
        'name'      => 'New York 1',
        'slug'      => 'nyc1',
        'sizes'     => [],
        'features'  => %w(virtio backups),
        'available' => false
      },
      {
        'name'      => 'Amsterdam 1',
        'slug'      => 'ams1',
        'sizes'     => [],
        'features'  => %w(virtio backups),
        'available' => false
      },
      {
        'name'      => 'San Francisco 1',
        'slug'      => 'sfo1',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio backups metadata),
        'available' => true
      },
      {
        'name'      => 'New York 2',
        'slug'      => 'nyc2',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio private_networking backups),
        'available' => true
      },
      {
        'name'      => 'Amsterdam 2',
        'slug'      => 'ams2',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio private_networking backups metadata),
        'available' => true
      },
      {
        'name'      => 'Singapore 1',
        'slug'      => 'sgp1',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio private_networking backups ipv6 metadata),
        'available' => true
      },
      {
        'name'      => 'London 1',
        'slug'      => 'lon1',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio private_networking backups ipv6 metadata),
        'available' => true
      },
      {
        'name'      => 'New York 3',
        'slug'      => 'nyc3',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio private_networking backups ipv6 metadata),
        'available' => true
      },
      {
        'name'      => 'Amsterdam 3',
        'slug'      => 'ams3',
        'sizes'     => %w(32gb 16gb 2gb 1gb 4gb 8gb 512mb 64gb 48gb),
        'features'  => %w(virtio private_networking backups ipv6 metadata),
        'available' => true
      }
    ],
    'links'   => {},
    'meta'    => {'total' => 9}
  }

  response
end
list_servers(filters = {}) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/list_servers.rb, line 16
def list_servers(filters = {})
  response = Excon::Response.new
  response.status = 200
  response.body = {
      "status" => "OK",
      "droplets"  => self.data[:servers]
  }
  response
end
list_ssh_keys() click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/list_ssh_keys.rb, line 16
def list_ssh_keys
  response = Excon::Response.new
  response.status = 200
  response.body = {
    "ssh_keys" => data[:ssh_keys],
    "links" => {},
    "meta" => {
      "total" => data[:ssh_keys].count
    }
  }
  response
end
password_reset(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/password_reset.rb, line 23
def password_reset(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "password_reset",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
power_cycle(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/power_cycle.rb, line 23
def power_cycle(id)
  response        = Excon::Response.new
  response.status = 201
  response.body   = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "power_cycle",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
power_off(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/power_off.rb, line 23
def power_off(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "power_off",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
power_on(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/power_on.rb, line 23
def power_on(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "power_on",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
reboot_server(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/reboot_server.rb, line 23
def reboot_server(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "reboot",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
rebuild(id, image) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/rebuild.rb, line 23
def rebuild(id, image)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "rebuild",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
rename(id, name) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/rename.rb, line 23
def rename(id, name)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "rename",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
reset_data() click to toggle source
# File lib/fog/digitalocean/compute_v2.rb, line 72
def reset_data
  self.class.data.delete(@digitalocean_token)
end
resize(id, resize_disk, size) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/resize.rb, line 27
def resize(id, resize_disk, size)
  response        = Excon::Response.new
  response.status = 201
  response.body   = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "resize",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
restore(id, image) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/restore.rb, line 23
def restore(id, image)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "restore",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
shutdown(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/shutdown.rb, line 23
def shutdown(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "shutdown",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
snapshot(id, name) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/snapshot.rb, line 23
def snapshot(id, name)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "snapshot",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end
transfer_image(id, name) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/transfer_image.rb, line 23
def transfer_image(id, name)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id' => 36805527,
      'status' => 'in-progress',
      'type' => 'transfer',
      'started_at' => '2014-11-14T16:42:45Z',
      'completed_at' => null,
      'resource_id' => 7938269,
      'resource_type' => 'image',
      'region' => 'nyc3',
      'region_slug' => 'nyc3'
    }
  }
  response
end
update_ssh_key(key_id, name) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/update_ssh_key.rb, line 28
def update_ssh_key(key_id, name)
  response        = Excon::Response.new
  response.status = 200

  response.body ={
    'ssh_key' => {
      'id'          => 512190,
      'fingerprint' => "3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa",
      'public_key'  => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example",
      'name'        => "My SSH Public Key"
    }
  }

  response
end
upgrade(id) click to toggle source
# File lib/fog/digitalocean/requests/compute_v2/upgrade.rb, line 23
def upgrade(id)
  response         = Excon::Response.new
  response.status  = 201
  response.body    = {
    'action' => {
      'id'            => Fog::Mock.random_numbers(1).to_i,
      'status'        => "in-progress",
      'type'          => "upgrade",
      'started_at'    => "2014-11-14T16:31:00Z",
      'completed_at'  => null,
      'resource_id'   => id,
      'resource_type' => "droplet",
      'region'        => "nyc3",
      'region_slug'   => "nyc3"
    }
  }
  response
end