class BlockScore::Fingerprint
Attributes
body[R]
Public Class Methods
new(resource, body)
click to toggle source
# File lib/blockscore/fingerprint.rb, line 3 def initialize(resource, body) @resource = resource @body = Util.parse_json(body) end
Public Instance Methods
data()
click to toggle source
# 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
resource()
click to toggle source
# File lib/blockscore/fingerprint.rb, line 20 def resource if watchlist_search? || watchlist_hits? 'watchlist_hit' else @resource end end
Private Instance Methods
resource_index?()
click to toggle source
hash style list format
# File lib/blockscore/fingerprint.rb, line 38 def resource_index? body.is_a?(Hash) && body[:object] == 'list' end
watchlist_hits?()
click to toggle source
# File lib/blockscore/fingerprint.rb, line 42 def watchlist_hits? data.first.is_a?(Hash) && data.first.key?(:matching_info) end
watchlist_search?()
click to toggle source
candidates#search endpoint
# File lib/blockscore/fingerprint.rb, line 33 def watchlist_search? body.respond_to?(:key?) && body.key?(:matches) end