Sha256: f414d2b8c472bb7cedbfcbd02fe82892934e28f216f7384807481d382a38f1dc
Contents?: true
Size: 844 Bytes
Versions: 2
Compression:
Stored size: 844 Bytes
Contents
class FakeDefensio def initialize @documents = {} end def post_document(data) content = data[:content] || data['content'] classification, spaminess = content[1..-2].split(',') signature = "#{rand}#{content}".hash @documents[signature] = { 'api-version' => '2.0', 'status' => 'success', 'message' => '', 'signature' => signature, 'allow' => (classification == 'innocent'), 'classification' => classification, 'spaminess' => spaminess.to_f, 'profanity-match' => false } [200, @documents[signature]] end def get_document(signature) if @documents.has_key?(signature) [200, @documents[signature]] else [404, 'api-version' => '2.0', 'status' => 'failure', 'message' => 'document not found' ] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
defender-2.0.0 | spec/fake_defensio.rb |
defender-2.0.0beta1 | spec/fake_defensio.rb |