Project

iprofiler

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for the iProfile API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7.7
~> 10.0.3
~> 4.0.0
~> 2.13.0
~> 0.7.1
~> 2.4.0
~> 1.11.0

Runtime

~> 2.0.2
~> 1.6.1
 Project Readme

Iprofiler

Ruby wrapper for the Iprofile API. Heavily inspired by Wynn Netherland's LinkedIn gem.

Travis CI : Build Status

Installation

Add the following line to your Gemfile.

gem 'iprofiler'

Install the gem by using bundler

bundle install

Usage

Setting the connection parameters globally

Iprofiler.configure do |config|
  config.api_key = "<<YOUR API KEY>>" 
  config.api_secret = "<<YOUR API SECRET>>" 
  config.api_host = "http://visitoriq2.iprofile.net"
end
client = Iprofiler::Client.new

Setting the connection parameters per connection

Iprofiler.configure do |config|
  config.api_host = "http://visitoriq2.iprofile.net"
end

client = Iprofiler::Client.new ( "<<YOUR API KEY>>", "<<YOUR API SECRET>>")

Invoking the API

client = Iprofiler::Client.new
client.company_lookup(:company_name => "Bank Of America")    
client.company_lookup(:ip_address => "10.10.10.2")
client.company_lookup(:domain => "bankofamerica.com")

# When invoked with multiple parameters, the lookup is performed in the following order
#      domain
#      company_name
#      ip_address
client.company_lookup(:domain => "bankofamerica.com", :company_name => "Bank Of America", :ip_address => "10.10.10.2")

Error/ISP handling

reply = client.company_lookup(:ip_address => "2.228.11.0")    
if reply.status == :found
  if reply.company.type == "company"
    puts "Processed Company"
  else
    puts "Ignored ISP"
  end
elsif reply.status == :not_found
  puts "Not found"
elsif reply.status == :insufficient_input
  puts "Invalid input"
elsif reply.status == :error
  puts "Error #{reply.error}"
end

TODO

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2013 Harish Shetty. See LICENSE for details.