whos_using_what 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,8 @@ class LinkedinClient < BaseApiClient
|
|
9
9
|
|
10
10
|
@@json_indicator = "format=json"
|
11
11
|
@@base_url = "http://api.linkedin.com/v1/"
|
12
|
+
#@linkedin_tech_industry_codes = "4,132,6,96,113,80,126,81,8,36,118,28,140";
|
13
|
+
@@linkedin_tech_industry_codes = "80"
|
12
14
|
|
13
15
|
|
14
16
|
def initialize(api_key, api_secret, user_token, user_secret, url)
|
@@ -26,7 +28,7 @@ class LinkedinClient < BaseApiClient
|
|
26
28
|
end
|
27
29
|
|
28
30
|
|
29
|
-
def query_companies params
|
31
|
+
def query_companies location_code, company_size, params
|
30
32
|
|
31
33
|
base_url = @@base_url <<
|
32
34
|
"company-search:(
|
@@ -40,7 +42,10 @@ class LinkedinClient < BaseApiClient
|
|
40
42
|
employee-count-range,
|
41
43
|
locations
|
42
44
|
)
|
43
|
-
)"
|
45
|
+
)?facets=industry,location,company-size" <<
|
46
|
+
"&facet=industry," << @@linkedin_tech_industry_codes <<
|
47
|
+
"&facet=location," << location_code <<
|
48
|
+
"&facet=company-size,C,D,E,F,G,H,I"
|
44
49
|
|
45
50
|
json_api_call_helper(base_url, params)
|
46
51
|
|
@@ -107,6 +112,8 @@ class LinkedinClient < BaseApiClient
|
|
107
112
|
|
108
113
|
json = @access_token.get(url << "&" << @@json_indicator)
|
109
114
|
|
115
|
+
puts json.body
|
116
|
+
|
110
117
|
JSON.parse(json.body)
|
111
118
|
|
112
119
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'base_api_client'
|
2
|
+
require 'crack'
|
3
|
+
|
4
|
+
class SimplyHiredClient
|
5
|
+
|
6
|
+
require 'json'
|
7
|
+
@@base_url = "http://api.linkedin.com/v1/"
|
8
|
+
@@json_indicator = "format=json"
|
9
|
+
@@number_results = 100
|
10
|
+
|
11
|
+
def perform_search query, location
|
12
|
+
|
13
|
+
url = "http://api.simplyhired.com/a/jobs-api/xml-v2/" <<
|
14
|
+
"q-%22" << query << "%22/" <<
|
15
|
+
"l-" << location <<
|
16
|
+
"/ws-" << @@number_results.to_s <<
|
17
|
+
"?pshid=47575&ssty=2&cflg=r&jbd=hiringto.jobamatic.com"
|
18
|
+
|
19
|
+
url = url.tr(" ", "+")
|
20
|
+
|
21
|
+
xml_response = RestClient.get(url)
|
22
|
+
|
23
|
+
map = Crack::XML.parse(xml_response)
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
@@ -9,8 +9,6 @@ class GatherCompanies < Base
|
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
|
12
|
-
@linkedin_tech_industry_codes = "4,132,6,96,113";
|
13
|
-
|
14
12
|
@indeed_api_client = IndeedApiClient.new
|
15
13
|
|
16
14
|
@@mongo_client = MongoHelper.get_mongo_connection
|
@@ -73,17 +71,18 @@ class GatherCompanies < Base
|
|
73
71
|
|
74
72
|
def load_companies_to_db num_iterations, cur_start_position, facet_location_code
|
75
73
|
|
76
|
-
|
74
|
+
company_size_codes = "C,D,E,F,G,H,I"
|
75
|
+
increment = 10
|
77
76
|
cnt = 1
|
78
77
|
|
79
78
|
while cnt <= num_iterations do
|
80
79
|
puts cur_start_position.to_s
|
81
80
|
|
82
|
-
|
83
|
-
"start" => cur_start_position.to_s
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
params = {
|
82
|
+
"start" => cur_start_position.to_s
|
83
|
+
}
|
84
|
+
|
85
|
+
resp = @@linkedin_client.query_companies facet_location_code, company_size_codes, params
|
87
86
|
docs = resp['companies'].values[3]
|
88
87
|
if docs != nil
|
89
88
|
docs.each do |doc|
|
@@ -96,7 +95,7 @@ class GatherCompanies < Base
|
|
96
95
|
|
97
96
|
cnt = cnt + 1
|
98
97
|
|
99
|
-
sleep_seconds = rand(
|
98
|
+
sleep_seconds = rand(3-9)
|
100
99
|
puts "sleeping for: " << sleep_seconds.to_s << " seconds"
|
101
100
|
sleep(sleep_seconds)
|
102
101
|
|
@@ -44,7 +44,7 @@ class DataPopulators
|
|
44
44
|
@@coords_coll = @@mongo_client['coordinates']
|
45
45
|
|
46
46
|
#data holders
|
47
|
-
@@facet_location = "us:
|
47
|
+
@@facet_location = "us:82"
|
48
48
|
@@programming_languages = ["java", "ruby", "c#", "php", "python", "javascript"]
|
49
49
|
|
50
50
|
@li_config = YAML.load_file(File.expand_path("../../config/linkedin.env", __FILE__))
|
@@ -62,9 +62,19 @@ class DataPopulators
|
|
62
62
|
|
63
63
|
begin
|
64
64
|
|
65
|
-
results = @@linkedin_client.query_people_from_company_ids ['2003'], '
|
65
|
+
# results = @@linkedin_client.query_people_from_company_ids ['2003'], 'software', 'us:84'
|
66
|
+
|
67
|
+
|
68
|
+
@@companies_coll.remove({
|
69
|
+
'employeeCountRange' => {'code' => "B", "name" => "2-10"}
|
70
|
+
})
|
71
|
+
@@companies_coll.remove({
|
72
|
+
'employeeCountRange' => {'code' => "B", "name" => "1-10"}
|
73
|
+
})
|
74
|
+
|
75
|
+
|
76
|
+
@@gather_companies.load_companies_to_db 100, 1200, @@facet_location
|
66
77
|
|
67
|
-
pause = ""
|
68
78
|
rescue Exception => e
|
69
79
|
puts e.message
|
70
80
|
puts e.backtrace
|
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: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -107,6 +107,22 @@ dependencies:
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: crack
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
110
126
|
- !ruby/object:Gem::Dependency
|
111
127
|
name: mongo
|
112
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,6 +184,7 @@ files:
|
|
168
184
|
- lib/whos_using_what/api_clients/indeed_api_client.rb
|
169
185
|
- lib/whos_using_what/api_clients/google_client.rb
|
170
186
|
- lib/whos_using_what/api_clients/base_api_client.rb
|
187
|
+
- lib/whos_using_what/api_clients/simply_hired_client.rb
|
171
188
|
- lib/whos_using_what/api_clients/linkedin_client.rb
|
172
189
|
- lib/whos_using_what/api_clients/google_locations_client.rb
|
173
190
|
- lib/whos_using_what/data_gatherers/gather_companies.rb
|