Module: Ey::Core::Mock::Util

Included in:
Client::Mock, Client::Mock
Defined in:
lib/vendor/core/ey-core/mock/util.rb

Instance Method Summary collapse

Instance Method Details

#api_tokenObject



19
20
21
# File 'lib/vendor/core/ey-core/mock/util.rb', line 19

def api_token
  SecureRandom.hex(20)
end

#deep_dup(object) ⇒ Object



7
8
9
# File 'lib/vendor/core/ey-core/mock/util.rb', line 7

def deep_dup(object)
  Marshal.load(Marshal.dump(object))
end

#ip_addressObject



15
16
17
# File 'lib/vendor/core/ey-core/mock/util.rb', line 15

def ip_address
  Array.new(4){rand(256)}.join('.')
end

#normalize_hash(hash) ⇒ Object



3
4
5
# File 'lib/vendor/core/ey-core/mock/util.rb', line 3

def normalize_hash(hash)
  JSON.load(JSON.dump(hash))
end

#uuidObject



11
12
13
# File 'lib/vendor/core/ey-core/mock/util.rb', line 11

def uuid
  [8,4,4,4,12].map{|i| Cistern::Mock.random_hex(i)}.join("-")
end