iprofiler 0.1.1 → 0.1.2

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/README.markdown CHANGED
@@ -6,26 +6,53 @@ Travis CI : [![Build Status](https://secure.travis-ci.org/kandadaboggu/iprofiler
6
6
 
7
7
  ## Installation
8
8
 
9
- [sudo] gem install iprofiler
9
+ Add the following line to your Gemfile.
10
10
 
11
- ## Usage
11
+ gem 'iprofiler'
12
+ bundle install
12
13
 
13
- require 'rubygems'
14
- require 'iprofiler'
14
+ ## Usage
15
15
 
16
- # get your api keys at https://www.linkedin.com/secure/developer
17
- client = Iprofiler::Client.new('your_consumer_key', 'your_consumer_secret')
18
- reply = client.company_lookup(:ip_address => "10.10.20.30")
16
+ **Setting the connection parameters globally**
17
+
18
+ Iprofiler.configure do |config|
19
+ config.api_key = "foo"
20
+ config.api_secret = "bar"
21
+ config.api_host = "http://localhost:3000"
22
+ end
23
+ client = Iprofiler::Client.new
24
+
25
+
26
+ **Setting the connection parameters per connection**
27
+
28
+ client = Iprofiler::Client.new ("foo", "bar", "http://localhost:3000")
29
+
30
+ **Invoking the API**
31
+
32
+ client = Iprofiler::Client.new
33
+ client.company_lookup(:company_name => "Bank Of America")
34
+ client.company_lookup(:ip_address => "10.10.10.2")
35
+ client.company_lookup(:domain => "bankofamerica.com")
36
+ client.company_lookup(:url => "accipitercom.com")
37
+
38
+ **Error/ISP handling**
39
+
40
+ reply = client.company_lookup(:ip_address => "2.228.11.0")
19
41
  if reply.status == :found
20
- company = reply.company
21
- if company.type == :isp
42
+ if reply.company.type == "company"
43
+ puts "Processed Company"
22
44
  else
45
+ puts "Ignored ISP"
23
46
  end
24
- else
25
- reply.code
26
- reply.message
47
+ elsif reply.status == :not_found
48
+ puts "Not found"
49
+ elsif reply.status == :insufficient_input
50
+ puts "Invalid input"
51
+ elsif reply.status == :error
52
+ puts "Error #{reply.error}"
27
53
  end
28
54
 
55
+
29
56
  ## TODO
30
57
 
31
58
 
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ iprofiler
2
+ =========
3
+
4
+ Ruby API for accessing the Iprofile API's
data/changelog.markdown CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## 0.0.1 - March 05, 2013
3
+ ## 0.1.0 - March 05, 2013
4
4
 
5
5
  * Initial release
6
+
7
+ ## 0.1.1 - March 08, 2013
8
+
9
+ * Added missing authentication parameter check
10
+
11
+ ## 0.1.2 - March 08, 2013
12
+
13
+ * Symbolized the type value in company structure
14
+ * Updated README.markdown
15
+
@@ -80,8 +80,6 @@ module Iprofiler
80
80
  return Mash.new.tap do |reply|
81
81
  reply.status = :error
82
82
  reply.code = 400
83
-
84
- missing = CONNECTION_PARAMETERS.none?{ |attr| send(attr).nil?}
85
83
  reply.error = "Invalid or missing API connection parameter(s)[#{missing_credentials.join(",")}]"
86
84
  end
87
85
  end
@@ -92,6 +90,9 @@ module Iprofiler
92
90
  reply.code = code
93
91
  if code == 200
94
92
  reply.status = reply.status.to_sym
93
+ if reply.status == :found
94
+ reply.company.type = reply.company.type.to_sym
95
+ end
95
96
  else
96
97
  reply.status = :error
97
98
  end
@@ -3,7 +3,7 @@ module Iprofiler
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 1
6
+ PATCH = 2
7
7
  PRE = nil
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
9
9
  end
@@ -99,18 +99,21 @@ describe Iprofiler::Api do
99
99
  reply = client.company_lookup(:company_name => company.name)
100
100
  reply.code.should eq(200)
101
101
  reply.status.should eq(:found)
102
+ reply.company.type.should eq(:company)
102
103
  end
103
104
 
104
105
  it "should be able to query using domain name" do
105
106
  reply = client.company_lookup(:domain => company.url)
106
107
  reply.code.should eq(200)
107
108
  reply.status.should eq(:found)
109
+ reply.company.type.should eq(:company)
108
110
  end
109
111
 
110
112
  it "should be able to query using ip address" do
111
113
  reply = client.company_lookup(:ip_address => company.ip_address)
112
114
  reply.code.should eq(200)
113
115
  reply.status.should eq(:found)
116
+ reply.company.type.should eq(:company)
114
117
  end
115
118
 
116
119
  it "should be able to query using employee email id" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iprofiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -171,6 +171,7 @@ files:
171
171
  - Gemfile
172
172
  - LICENSE
173
173
  - README.markdown
174
+ - README.md
174
175
  - Rakefile
175
176
  - changelog.markdown
176
177
  - iprofiler.gemspec