Sha256: 1c3bd0feaa149d498122225220031aa56892a1c42de616a16598e3479fad06fe
Contents?: true
Size: 1.37 KB
Versions: 31
Compression:
Stored size: 1.37 KB
Contents
class Ey::Core::Client class Real def create_address(params={}) request( :method => :post, :path => "/addresses", :params => params, ) end end # Real class Mock def create_address(params={}) request_id = self.uuid resource_id = self.serial_id provider_id = params["provider"] self.find(:providers, provider_id) resource = params["address"].dup ip_address = resource["provisioned_id"] || self.ip_address resource.merge!( "id" => resource_id, "provisioned_id" => ip_address, "ip_address" => ip_address, "resource_url" => "/addresses/#{resource_id}", "provider" => url_for("/providers/#{provider_id}") ) request = { "id" => request_id, "type" => "provision_address", "successful" => "true", "started_at" => Time.now, "finished_at" => nil, "resource" => [:addresses, resource_id, resource], } self.data[:requests][request_id] = request response_hash = request.dup response_hash.delete("resource") response( :body => {"request" => response_hash}, :status => 201, :headers => { "Content-Type" => "application/json; charset=utf8" } ) end end # Mock end # Ey::Core::Client
Version data entries
31 entries across 31 versions & 1 rubygems