Class: BlockScore::Fingerprint

Inherits:
Object
  • Object
show all
Defined in:
lib/blockscore/fingerprint.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource, body) ⇒ Fingerprint

Returns a new instance of Fingerprint.



3
4
5
6
# File 'lib/blockscore/fingerprint.rb', line 3

def initialize(resource, body)
  @resource = resource
  @body = Util.parse_json(body)
end

Instance Method Details

#dataObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/blockscore/fingerprint.rb', line 8

def data
  @data ||= begin
    if watchlist_search?
      body[:matches]
    elsif resource_index?
      body[:data]
    else
      body
    end
  end
end

#resourceObject



20
21
22
23
24
25
26
# File 'lib/blockscore/fingerprint.rb', line 20

def resource
  if watchlist_search? || watchlist_hits?
    'watchlist_hit'
  else
    @resource
  end
end