Module: Tigre::AnalysisComponents

Included in:
Url
Defined in:
lib/tigre-client/common/analysis_components.rb

Instance Method Summary collapse

Instance Method Details

#add_analysis(digest_hash, params_hash = {}) ⇒ Object

required

digest_hash => Hash
  :digest => String,  The digest type
  :value  => String,  The digest value

optional params

params_hash => Hash
  :dbts => Hash {:key1 => value, :key2 => value} where the key is what the name of the 
           attribute is and the value should be a boolean
  :mutex_name_list => String (comma seperated) => I.E 'foo,bar,baz'
  :mutex_name_list => Array => ['foo', 'bar', 'baz']


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tigre-client/common/analysis_components.rb', line 14

def add_analysis(digest_hash, params_hash={})
  unless digest_hash[:digest] && digest_hash[:value]
    raise 'Missing parameter :digest or :value'
  end
  
  if params_hash
    update_data = {}
    if params_hash[:mutex_name_list]
      params_hash[:mutex_name_list] = package_array_list(params_hash[:mutex_name_list])
    end
    
    update_data["metadatas"] = params_hash
  end

  Tigre.put_connection("/#{get_klass}/#{digest_hash[:digest]}/value/#{digest_hash[:value]}/analysis", update_data)
end

#get_analyses(hash) ⇒ Object

required params

hash   => Hash
  :digest => String,  The digest type
  :value  => String,  The digest value


35
36
37
38
39
40
41
# File 'lib/tigre-client/common/analysis_components.rb', line 35

def get_analyses(hash)
  unless hash[:digest] && hash[:value]
    raise 'Missing parameter :digest or :value'
  end
  
  Tigre.get_connection("/#{get_klass}/#{hash[:digest]}/value/#{hash[:value]}/analyses")
end