linkedindata 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ce0c9ca0b41f4135c0bac28948b0c79b0fc1f4f
4
- data.tar.gz: e4b25773439dca11aa6db67b725b2a4d7e827c2a
3
+ metadata.gz: 71a61411dabf9133034b9e13bff8ee97ed718b18
4
+ data.tar.gz: d00c6243c9fdc2903811b06942579f3a37032c5d
5
5
  SHA512:
6
- metadata.gz: 2598ede15cff3d41303c6bd0745099ed23ffb0b7375970c1987d17b5621ae0c36fddf731468fcc9b889670a75e46bae8b6b30a85bc7bcdf2ce7c772954aa71d7
7
- data.tar.gz: 7e7e3ffbe4619a783b1315a78157986c20416bc6f07f9ac084f8ece34020f9210292153ba7669a3d7f5cb26e05e9bd7e36b451cf9c7365227ba710cb3f83d091
6
+ metadata.gz: 342759909ac1d68d7b82a372be35517877c8f26ddd7cbeab78cf75af2213bed05734d35bc5ca32354e838ee645882d8f901469d8ddc98648c04d42bababacbfc
7
+ data.tar.gz: 9e58c3534f8ce88a36b719517a82a9dfc9f7011f6a6235fa740b13036030cef1f07d6091dd2aadddf28ea557483c6da21f7e962a793fd8ad0498f268041a5a33
data/lib/linkedindata.rb CHANGED
@@ -6,6 +6,7 @@ require 'open-uri'
6
6
  load 'parseprofile.rb'
7
7
  require 'pry'
8
8
  require 'urlarchiver'
9
+ require 'set'
9
10
 
10
11
  class LinkedinData
11
12
  def initialize(input, todegree)
@@ -77,6 +78,29 @@ class LinkedinData
77
78
  end
78
79
  end
79
80
 
81
+ # Make sure all keys that occur occur in each item (even if nil)
82
+ def showAllKeys(data)
83
+ # Get all keys
84
+ fields = Set.new
85
+ data.map { |o| fields.merge(o.keys) }
86
+
87
+ # Make sure all items have all keys
88
+ datarr = Array.new
89
+ data.each do |d|
90
+ temphash = Hash.new
91
+ fields.each do |f|
92
+ if !d[f]
93
+ temphash[f] = nil
94
+ else
95
+ temphash[f] = d[f]
96
+ end
97
+ end
98
+ datarr.push(temphash)
99
+ end
100
+
101
+ return datarr
102
+ end
103
+
80
104
  # Gets all data and returns in JSON
81
105
  def getData
82
106
  search
@@ -98,7 +122,7 @@ class LinkedinData
98
122
  end
99
123
  end
100
124
 
101
- formatted_json = JSON.pretty_generate(@output)
125
+ formatted_json = JSON.pretty_generate(showAllKeys(@output))
102
126
  return formatted_json
103
127
  end
104
128
  end
data/lib/parseprofile.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'json'
2
2
  load 'getrelated.rb'
3
+ require 'pry'
3
4
 
4
5
  class ParseProfile
5
6
  def initialize(profile, url, curhops)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkedindata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. C. McGrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Scrapes all LinkedIn profiles including terms you specify.
14
14
  email: shidash@shidash.com