Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

attack-spotlight

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

attack-spotlight

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= spotlight

A simple interface to the www.hostip.info API.

= HostIP.info

hostip.info is a "Community Geotarget IP Project" and provides a simple API to transform an "IP Address" into a location (including Country, City, and coordinates).

No API key or sign-up is required to use the service.

hostip.info does request that if a lot of databases lookups are being done that you download the entire database from them instead.

= dependencies

== TESTING environment only

  • fakeweb [version used=1.2.0]

= example

== from the command line

spotlight 209.85.171.100

== from a ruby script

require 'rubygems' require 'spotlight'

spotlight = Spotlight.new("209.85.171.100")

puts spotlight.location.coordinates

== from a rails application

=== in config/environment

require 'spotlight'

=== in your controller

@spotlight = Spotlight.new("209.85.171.100")

=== in your view

@spotlight.location.coordinates

== from a rails application with caching

Using caching is highly advised if possible. The ip_address to location conversion doesn't normally change over time (if ever) so why continuously query it?

Assumption: caching is already enabled and working.\

=== in config/environment

require 'spotlight'

=== in your controller

ip_address = "209.85.171.100" @spotlight = Rails.cache.fetch(Spotlight.key(ip_address), :expires_in => 1.weeks) do Spotlight.new(ip_address) end

=== in your view

@spotlight.location.coordinates

= credits

Other then the code written by me (url=http://github.com/attack) and the code generated by 'jeweler' (url=http://github.com/jnunemaker) for making and maintaining gems, there is strong influence from jnunemaker (url=http://github.com/jnunemaker) and the gem google-weather.

== Copyright

Copyright (c) 2009 Mark G. See LICENSE for details.

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc