Class: OTX::Reputation

Inherits:
Base
  • Object
show all
Defined in:
lib/otx_ruby/reputation.rb

Overview

Retrieve and parse into the appropriate object the reputation for an IP Address from the OTX System

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #patch, #post

Constructor Details

This class inherits a constructor from OTX::Base

Instance Method Details

#get_reputation(ip, type = :ipv4) ⇒ OTX::Pulse

Download an individually identified IP Address Reputation and parse the output

Parameters:

  • ip (String)

    The ip address to check the reputation

  • type (Symbol) (defaults to: :ipv4)

    Type of address, IPv6 or IPv4

Returns:



13
14
15
16
17
18
19
20
21
# File 'lib/otx_ruby/reputation.rb', line 13

def get_reputation(ip, type=:ipv4)
  uri = "api/v1/indicators/#{type == :ipv6 ? "IPv6" : "IPv4"}/#{ip}/reputation"

  json_data = get(uri)

  reputation = OTX::Indicator::IP::Reputation.new(json_data["reputation"])

  return reputation
end