whos_using_what 0.0.1 → 0.0.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/lib/whos_using_what/linkedin_client.rb +56 -0
- metadata +35 -2
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'oauth'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class LinkedinClient
|
5
|
+
|
6
|
+
#the company industry codes to search for, see: https://developer.linkedin.com/documents/industry-codes
|
7
|
+
attr :access_token, true
|
8
|
+
attr :companyUrls
|
9
|
+
|
10
|
+
|
11
|
+
def initialize(api_key, api_secret, user_token, user_secret, url)
|
12
|
+
|
13
|
+
@industryCodes = "4,132,6,96,113";
|
14
|
+
@numberResults = "5"
|
15
|
+
@start = "15"
|
16
|
+
@companyUrls = Hash.new
|
17
|
+
|
18
|
+
consumer = OAuth::Consumer.new(api_key, api_secret, {:site => url})
|
19
|
+
|
20
|
+
@access_token = OAuth::AccessToken.new(consumer, user_token, user_secret)
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def self.parsePersonResult(result)
|
27
|
+
|
28
|
+
result['people']['values'].each do |person|
|
29
|
+
puts person['firstName'] + " " + person['lastName']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def parseCompanyResult(result)
|
34
|
+
result['companies']['values'].each do |company|
|
35
|
+
@companyUrls[company['universalName']] = company['websiteUrl']
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def apiCallLinkedin
|
42
|
+
#url = "http://api.linkedin.com/v1/people-search:(people:(headline,first-name,last-name,positions,location:(name)),num-results)?title=software¤t-title=true&facet=location%2Cus%3A84&format=json&count=500"
|
43
|
+
url = "http://api.linkedin.com/v1/company-search:(companies:(universal-name,website-url,locations:(address:(city,state))),facets,num-results)?facet=location,us:84&facet=industry," <<
|
44
|
+
@industryCodes <<
|
45
|
+
"&format=json" <<
|
46
|
+
"&start=" << @start <<
|
47
|
+
"&count=" << @numberResults
|
48
|
+
|
49
|
+
json = @access_token.get(url)
|
50
|
+
|
51
|
+
JSON.parse(json.body)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whos_using_what
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,13 +10,46 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-11-29 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: oauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
14
46
|
description: What companies are using what technologies
|
15
47
|
email: r.dane1010@gmail.com
|
16
48
|
executables: []
|
17
49
|
extensions: []
|
18
50
|
extra_rdoc_files: []
|
19
51
|
files:
|
52
|
+
- lib/whos_using_what/linkedin_client.rb
|
20
53
|
- lib/whos_using_what.rb
|
21
54
|
homepage: http://rubygems.org/gems/whos_using_what
|
22
55
|
licenses: []
|