Sha256: 349367a8d3e4568ac8532a7a0a9f58624d62e630e8c40a34f7fde34ea908d1d5
Contents?: true
Size: 848 Bytes
Versions: 1
Compression:
Stored size: 848 Bytes
Contents
require 'json' module NSISam class FakeClient def initialize @storage = {} end def store(data) key = Time.now.to_i.to_s @storage[key] = JSON.load(data.to_json) {'key' => key, 'checksum' => 0} end def get(key, expected_checksum=nil) if @storage.has_key?(key) {'data' => @storage[key]} else raise NSISam::Errors::Client::KeyNotFoundError end end def delete(key) if @storage.has_key?(key) @storage.delete key {'deleted' => true} else raise NSISam::Errors::Client::KeyNotFoundError end end def update(key, value) if @storage.has_key?(key) @storage[key] = value {'key' => key, 'checksum' => 0} else raise NSISam::Errors::Client::KeyNotFoundError end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nsisam-0.5.4 | lib/nsisam/fake_client.rb |