Skip to content

Commit

Permalink
[ecloud] improvements and some mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Howe & Josh Lane authored and Eugene Howe committed Jan 4, 2013
1 parent 4e047e9 commit 853755d
Show file tree
Hide file tree
Showing 107 changed files with 2,799 additions and 676 deletions.
4 changes: 2 additions & 2 deletions lib/fog/core/collection.rb
Expand Up @@ -103,10 +103,10 @@ def new(attributes = {})
raise(ArgumentError.new("Initialization parameters must be an attributes hash, got #{attributes.class} #{attributes.inspect}"))
end
model.new(
attributes.merge(
{
:collection => self,
:connection => connection
)
}.merge(attributes)
)
end

Expand Down
24 changes: 19 additions & 5 deletions lib/fog/ecloud.rb
Expand Up @@ -2,16 +2,30 @@

module Fog
module Ecloud
ECLOUD_OPTIONS = [:ecloud_authentication_method]

extend Fog::Provider

service(:compute, 'ecloud/compute', 'Compute')

end
end
def self.keep(hash, *keys)
{}.tap do |kept|
keys.each{|k| kept[k]= hash[k] if hash.key?(k)}
end
end

module Fog
module Ecloud
ECLOUD_OPTIONS = [:ecloud_authentication_method]
def self.slice(hash, *keys)
hash.dup.tap do |sliced|
keys.each{|k| sliced.delete(k)}
end
end

def self.ip_address
4.times.map{ Fog::Mock.random_numbers(3) }.join(".")
end

def self.mac_address
6.times.map{ Fog::Mock.random_numbers(2) }.join(":")
end
end
end

0 comments on commit 853755d

Please sign in to comment.