ipligence 0.0.7 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9e6ec61058d4ad2b8da18aa620783724890b7ee
4
- data.tar.gz: a065074b9ff4dba16f1fc84b816774d904be3a27
3
+ metadata.gz: e72a6ad6568bffabce2bb9f43793dcd5abaee4df
4
+ data.tar.gz: 35ba8850a67ac1c5022173c9b39e1064244f7b8f
5
5
  SHA512:
6
- metadata.gz: 6679a0bf3eb446bc17eeb238555f2e995a19de2b64a6230cdd74365c5b7213a50a2739f4938c085b026af2b9dbb09e90970c9dbcbdfa994951d02307892f96bf
7
- data.tar.gz: 6b44581fc33ad7fd0315082a19f7978c8665cbcc55fd8e0d303a69fd04cf4f26cfcbb65972dd33a507c821863f1fc3aa789a5c67b3945f33824ec1c6e23a0f14
6
+ metadata.gz: e9b87319aa917dca86db468590526cfa08d88228376a342974ce6d7686fe3d7100fa61ecc6749df227c5aace15f12f85b886e97444d5b3b337858719d37edbcb
7
+ data.tar.gz: 6774ac060d74f77971baeb5919517e2193262f6f1ec071aae9fe803c69080d5d135130c2f1defcc26239bc67e308d86e60380d9c5ddd849b258bfaef6d4aaa15
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ipligence
1
+ # IPligence
2
2
 
3
3
  A ruby gem to integrate the [IPligence database](http://ipligence.com/)
4
4
 
@@ -24,10 +24,10 @@ Or install it yourself as:
24
24
 
25
25
  ## Usage
26
26
 
27
- The gem needs an IPligence database. After you create it you can configure the `Ipligence::Client`:
27
+ After you create the DB you can configure the `IPligence::Client`:
28
28
 
29
29
  client =
30
- Ipligence::Client.new(
30
+ IPligence::Client.new(
31
31
  :adapter => "adapter",
32
32
  :host => "host.it.com"
33
33
  :database => "database",
@@ -43,13 +43,13 @@ For example, querying for `195.130.124.1` returns the following hash:
43
43
 
44
44
  => {:ip_from=>"3280108544", :ip_to=>"3280109567", :country_code=>"GR", :country_name=>"GREECE",
45
45
  :continent_code=>"EU", :continent_name=>"EUROPE", :time_zone=>"GMT+2", :region_code=>"",
46
- :region_name=>"", :owner=>"IONIAN UNIVERSITY", :city_name=>"CORFU", :country_name=>"",
46
+ :region_name=>"", :owner=>"IONIAN UNIVERSITY", :city_name=>"CORFU", :county_name=>"",
47
47
  :post_code=>"", :area_code=>"", :metro_code=>"", :latitude=>"39.62", :longitude=>"19.9197"}
48
48
 
49
49
  ## Contributing
50
50
 
51
- 1. Fork it (https://github.com/DaliaResearch/Ipligence/fork)
51
+ 1. Fork it (https://github.com/DaliaResearch/IPligence/fork)
52
52
  2. Create your feature branch (`git checkout -b my-new-feature`)
53
53
  3. Commit your changes (`git commit -am 'Add some feature'`)
54
54
  4. Push to the branch (`git push origin my-new-feature`)
55
- 5. Issue a new pull request (https://github.com/DaliaResearch/Ipligence/pulls)
55
+ 5. Issue a new pull request (https://github.com/DaliaResearch/IPligence/pulls)
@@ -5,7 +5,7 @@ require "ipligence/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ipligence"
8
- spec.version = Ipligence::VERSION
8
+ spec.version = IPligence::VERSION
9
9
  spec.authors = ["Sebastian Komianos, Fernando Guillen"]
10
10
  spec.email = ["sebastian.komianos@daliaresearch.com"]
11
11
  spec.summary = "A ruby gem for the IPligence database"
@@ -3,5 +3,5 @@ require_relative "ipligence/utils"
3
3
  require_relative "ipligence/db_connection"
4
4
  require_relative "ipligence/client"
5
5
 
6
- module Ipligence
6
+ module IPligence
7
7
  end
@@ -1,11 +1,11 @@
1
1
  require "active_record"
2
2
 
3
- class Ipligence::Client
3
+ class IPligence::Client
4
4
 
5
5
  attr_reader :connection
6
6
 
7
7
  def initialize(opts)
8
- @connection = Ipligence::DBConnection.establish_connection(opts).connection
8
+ @connection = IPligence::DBConnection.establish_connection(opts).connection
9
9
  end
10
10
 
11
11
  def data(ip)
@@ -34,7 +34,7 @@ class Ipligence::Client
34
34
 
35
35
  private
36
36
  def query(ip)
37
- long_ip = Ipligence::Utils.convert_dotted_to_long(ip).to_s
37
+ long_ip = IPligence::Utils.convert_dotted_to_long(ip).to_s
38
38
  data_fields = "ip_from, ip_to, country_code, country_name, continent_code, continent_name, time_zone, region_code, region_name, owner, city_name, county_name, post_code, area_code, metro_code, latitude, longitude"
39
39
  sql_query = "select #{data_fields} from ipligence2 where ip_from <= '#{long_ip}' and '#{long_ip}' <= ip_to"
40
40
  connection.exec_query(sql_query).first
@@ -1,3 +1,3 @@
1
- class Ipligence::DBConnection < ActiveRecord::Base
1
+ class IPligence::DBConnection < ActiveRecord::Base
2
2
  @abstract_class = true
3
3
  end
@@ -1,4 +1,4 @@
1
- module Ipligence::Utils
1
+ module IPligence::Utils
2
2
 
3
3
  def self.convert_dotted_to_long(ip)
4
4
  dotted_ip_array = ip.split(".").map(&:to_i)
@@ -1,3 +1,3 @@
1
- module Ipligence
2
- VERSION = "0.0.7"
1
+ module IPligence
2
+ VERSION = "0.1.1"
3
3
  end
@@ -8,13 +8,13 @@ class ClientTest < MiniTest::Test
8
8
  adapter_mock = mock(:connection => "CONNECTION")
9
9
 
10
10
  ActiveRecord::Base.expects(:establish_connection).with("OPTS").returns(adapter_mock)
11
- client = Ipligence::Client.new("OPTS")
11
+ client = IPligence::Client.new("OPTS")
12
12
 
13
13
  assert_equal("CONNECTION", client.connection)
14
14
  end
15
15
 
16
16
  def test_data
17
- client = Ipligence::Client.new(:adapter => "sqlite3", :database => "#{File.dirname(__FILE__)}/db/ipligence.sqlite")
17
+ client = IPligence::Client.new(:adapter => "sqlite3", :database => "#{File.dirname(__FILE__)}/db/ipligence.sqlite")
18
18
 
19
19
  data = client.data("2.84.170.255")
20
20
  assert_equal(39102976, data[:ip_from])
@@ -3,10 +3,10 @@ require_relative "test_helper"
3
3
  class UtilsTest < MiniTest::Test
4
4
 
5
5
  def test_convert_dotted_to_long
6
- assert_equal(3232235521, Ipligence::Utils.convert_dotted_to_long("192.168.0.1"))
7
- assert_equal(514, Ipligence::Utils.convert_dotted_to_long("0.0.2.2"))
8
- assert_equal(0, Ipligence::Utils.convert_dotted_to_long("0.0.0.0"))
9
- assert_equal(4294967295, Ipligence::Utils.convert_dotted_to_long("255.255.255.255"))
6
+ assert_equal(3232235521, IPligence::Utils.convert_dotted_to_long("192.168.0.1"))
7
+ assert_equal(514, IPligence::Utils.convert_dotted_to_long("0.0.2.2"))
8
+ assert_equal(0, IPligence::Utils.convert_dotted_to_long("0.0.0.0"))
9
+ assert_equal(4294967295, IPligence::Utils.convert_dotted_to_long("255.255.255.255"))
10
10
  end
11
11
 
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipligence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Komianos, Fernando Guillen