Sha256: 3843993b49157976cb3f63e2b2cc4a20dfc641be6bf9722073f4df2b3e894b93
Contents?: true
Size: 1.27 KB
Versions: 89
Compression:
Stored size: 1.27 KB
Contents
module Fog module Compute class Clodo class Real # Bye new IP-address for specified server # ==== Paramaters # * server_id<~Integer> - Id of server to bye IP for # # ==== Returns # * response<~Excon::Response> # def add_ip_address(server_id) request( :expects => [204], :method => 'PUT', :path => "servers/#{server_id}/ips" ) end end class Mock def add_ip_address(server_id) raise Excon::Errors::BadRequest.new( "Invalid image ID" ) unless server_id > 0 data = { 'primary_ip' => false, 'isp' => false, 'ip' => "66.6.#{rand(255)}.#{rand(255)}" } raise Excon::Errors::BadRequest unless self.data[:servers][server_id] raise Excon::Errors::BadRequest.new "No addresses" unless self.data[:servers][server_id]['addresses'] self.data[:servers][server_id]['addresses']['public'] << data response = Excon::Response.new response.status = 204 response end end end end end
Version data entries
89 entries across 89 versions & 16 rubygems