sgeoip 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ *.rbc
2
+ .bundle
3
+ .config
4
+ .yardoc
5
+ Gemfile.lock
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scrape-geoip.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Sgeoip
2
+
3
+ Scrape http://www.geoiptool.com/ for ip information
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'sgeoip'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install sgeoip
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/sgeoip.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "sgeoip/version"
2
+ require 'nokogiri'
3
+ require 'open-uri'
4
+
5
+ module Sgeoip
6
+ def self.scrape(ip)
7
+ url = "http://www.geoiptool.com/en/?#{ip}"
8
+ doc = Nokogiri::HTML(open(url))
9
+ geoip = { "host" => doc.at_css(".tbl_style tr:nth-child(1) td.arial_bold").text,
10
+ "country" => doc.at_css(".tbl_style tr:nth-child(3) td.arial_bold").text,
11
+ "country_code" => doc.at_css(".tbl_style tr:nth-child(4) td.arial_bold").text,
12
+ "region" => doc.at_css(".tbl_style tr:nth-child(5) td.arial_bold").text,
13
+ "city" => doc.at_css(".tbl_style tr:nth-child(6) td.arial_bold").text,
14
+ "zip" => doc.at_css(".tbl_style tr:nth-child(7) td.arial_bold").text
15
+ }
16
+ if geoip[:host].nil?
17
+ geoip[:error] = "Results Not Found"
18
+ end
19
+ geoip
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module Sgeoip
2
+ VERSION = "0.0.8"
3
+ end
data/sgeoip.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sgeoip/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "sgeoip"
8
+ gem.version = Sgeoip::VERSION
9
+ gem.authors = ["Travis Berry"]
10
+ gem.email = ["contact@travisberry.com"]
11
+ gem.description = %q{Scrape http://www.geoiptool.com/ for ip information}
12
+ gem.summary = %q{Scrape http://www.geoiptool.com/}
13
+ gem.homepage = ""
14
+
15
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ gem.files = `git ls-files`.split("\n")
17
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'nokogiri'
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sgeoip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -33,7 +33,15 @@ email:
33
33
  executables: []
34
34
  extensions: []
35
35
  extra_rdoc_files: []
36
- files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/sgeoip.rb
43
+ - lib/sgeoip/version.rb
44
+ - sgeoip.gemspec
37
45
  homepage: ''
38
46
  licenses: []
39
47
  post_install_message: