Module: Ey::Core::Mock::Util
- Included in:
- Client::Mock, Client::Mock
- Defined in:
- lib/ey-core/mock/util.rb
Instance Method Summary collapse
- #api_token ⇒ Object
- #deep_dup(object) ⇒ Object
- #ip_address ⇒ Object
- #normalize_hash(hash) ⇒ Object
- #uuid ⇒ Object
Instance Method Details
#api_token ⇒ Object
19 20 21 |
# File 'lib/ey-core/mock/util.rb', line 19 def api_token SecureRandom.hex(20) end |
#deep_dup(object) ⇒ Object
7 8 9 |
# File 'lib/ey-core/mock/util.rb', line 7 def deep_dup(object) Marshal.load(Marshal.dump(object)) end |
#ip_address ⇒ Object
15 16 17 |
# File 'lib/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/ey-core/mock/util.rb', line 3 def normalize_hash(hash) JSON.load(JSON.dump(hash)) end |
#uuid ⇒ Object
11 12 13 |
# File 'lib/ey-core/mock/util.rb', line 11 def uuid SecureRandom.uuid end |