whos_using_what 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ class LinkedinClient < BaseApiClient
16
16
 
17
17
  @consumer = OAuth::Consumer.new(api_key, api_secret, {
18
18
  :site => url,
19
- # :scope => "r_basicprofile+r_emailaddress+r_network"
19
+ # :scope => "r_basicprofile+r_emailaddress+r_network"
20
20
  })
21
21
 
22
22
  @consumer.options[:request_token_path] = @consumer.options[:request_token_path] << "?scope=r_fullprofile+r_emailaddress+r_network"
@@ -57,16 +57,48 @@ class LinkedinClient < BaseApiClient
57
57
  url = base_url_tmp <<
58
58
  "people-search:(people:(id,first-name,last-name,public-profile-url,picture-url,headline),num-results)" <<
59
59
  "?company-name=" << company_name << "," <<
60
- "&location=" << location
60
+ "&location=" << location <<
61
+ "&current-company=true"
61
62
 
62
63
  json_api_call_helper url, {}
63
64
 
64
65
  end
65
66
 
67
+ def query_people_from_company_ids company_ids, title, location
66
68
 
67
- def json_api_call_helper (base_url, params)
69
+ location = location.gsub(/\s+/, "+")
70
+
71
+ base_url_tmp = @@base_url.clone
72
+
73
+ company_id_str = ""
74
+ i = 1
75
+ company_ids.each do |company_id|
76
+ delim = ""
77
+ if i != 1
78
+ delim = ","
79
+ end
80
+ company_id_str = company_id_str << delim << company_id
81
+ i += i
82
+ end
83
+
84
+ url = base_url_tmp <<
85
+ "people-search:(people:(id,first-name,last-name,public-profile-url,picture-url,headline),num-results)" <<
86
+ "?facets=location,current-company" <<
87
+ "&facet=location," << location <<
88
+ "&facet=current-company," << company_id_str
89
+ "&current-title=" << title
90
+
91
+ json_api_call_helper url, {}, true
92
+
93
+ end
94
+
95
+
96
+ def json_api_call_helper (base_url, params, skip_params = false)
68
97
 
69
- url = BaseApiClient.prepare_params_from_map_helper(base_url, params)
98
+ url = base_url.clone
99
+ if !skip_params
100
+ url = BaseApiClient.prepare_params_from_map_helper(base_url, params)
101
+ end
70
102
 
71
103
  #remove white spaces, for ease in reading queries, they may have white spaces / line breaks
72
104
  url = url.gsub(/\s+/, "")
@@ -60,6 +60,18 @@ class DataPopulators
60
60
 
61
61
  t1 = Thread.new do
62
62
 
63
+ begin
64
+
65
+ results = @@linkedin_client.query_people_from_company_ids ['2003'], 'human', 'us:84'
66
+
67
+ pause = ""
68
+ rescue Exception => e
69
+ puts e.message
70
+ puts e.backtrace
71
+
72
+ end
73
+
74
+
63
75
  =begin
64
76
  begin
65
77
 
@@ -104,34 +116,6 @@ class DataPopulators
104
116
  url = BaseApiClient.arry_to_str_delim query_url, ""
105
117
  }
106
118
 
107
-
108
- begin
109
-
110
- nearby_companies = @@companies_coll.find().limit(10)
111
-
112
- nearby_companies.each do |nearby_company|
113
- raw_results = @@linkedin_client.query_people_from_company nearby_company['name'], "Pleasant Hill, CA"
114
- people = raw_results['people']['values']
115
-
116
- limit = 3
117
- iter = 1
118
- people.each do |person|
119
- if iter > limit
120
- break
121
- end
122
- # @results.push person['firstName'] << " " << person['lastName']
123
- iter += iter
124
- end
125
-
126
- end
127
-
128
- # @@tech_ad_tagger.tag_company_with_technologies @@programming_languages, generate_duckduckgo_url
129
-
130
- rescue Exception => e
131
- puts e.message
132
- puts e.backtrace
133
- end
134
-
135
119
  end
136
120
 
137
121
 
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.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: