freegeoip-ruby 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/freegeoip +29 -0
- data/lib/freegeoip/response.rb +4 -3
- data/lib/freegeoip/version.rb +1 -1
- data/lib/freegeoip.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93daca92561a38d16cf83f57a379dbb6f6aa33aa
|
4
|
+
data.tar.gz: 6deddb342209117eb791eb26ef698af1f06d59cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5db2b3c1e93ae72ddaf85471059f44ffa6f25514820c3b299a5a891437a3d9f3ead12768393d24ffc291d409610ee1fb2304aaf005644dcf98b1588521552802
|
7
|
+
data.tar.gz: 4cc4eaa998f232bd81b5c9d7b194513afbad5169945f751766f4dd71d9180c46833e0aadcff911518df829c08fd2dd1b1692c4007dd41552c16bb720124db249
|
data/bin/freegeoip
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "freegeoip"
|
4
|
+
|
5
|
+
|
6
|
+
case ARGV[0]
|
7
|
+
when "get"
|
8
|
+
remote = ARGV[1]
|
9
|
+
|
10
|
+
puts "Searching for: #{remote}"
|
11
|
+
puts "------------------------"
|
12
|
+
|
13
|
+
response = Freegeoip.get(remote)
|
14
|
+
|
15
|
+
puts "IP: #{response.ip}"
|
16
|
+
puts "Country code: #{response.country_code}"
|
17
|
+
puts "Country name: #{response.country_name}"
|
18
|
+
puts "Region code: #{response.region_code}"
|
19
|
+
puts "Region name: #{response.region_name}"
|
20
|
+
puts "City: #{response.city}"
|
21
|
+
puts "ZIP Code: #{response.zip_code}"
|
22
|
+
puts "Time zone: #{response.time_zone}"
|
23
|
+
puts "Latitude: #{response.latitude}"
|
24
|
+
puts "Longitude: #{response.longitude}"
|
25
|
+
puts "Metro code: #{response.metro_code}"
|
26
|
+
else
|
27
|
+
puts "Unknown command, usage: freegeoip get [IP|DOMAIN]"
|
28
|
+
end
|
29
|
+
|
data/lib/freegeoip/response.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module Freegeoip
|
2
2
|
class Response
|
3
|
-
attr_reader :ip, :country_code, :country_name,
|
3
|
+
attr_reader :remote, :ip, :country_code, :country_name,
|
4
4
|
:region_code, :region_name, :city, :zip_code,
|
5
5
|
:time_zone, :latitude, :longitude, :metro_code
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
|
7
|
+
def initialize(remote, data)
|
8
|
+
@remote = remote
|
9
|
+
data.each do |key, value|
|
9
10
|
instance_variable_set "@#{key}", value
|
10
11
|
end
|
11
12
|
end
|
data/lib/freegeoip/version.rb
CHANGED
data/lib/freegeoip.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freegeoip-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antonio Chávez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- README.md
|
69
69
|
- Rakefile
|
70
70
|
- bin/console
|
71
|
+
- bin/freegeoip
|
71
72
|
- bin/setup
|
72
73
|
- freegeoip.gemspec
|
73
74
|
- lib/freegeoip.rb
|