url_scrubber 0.7.13 → 0.7.14

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.
@@ -1,3 +1,3 @@
1
1
  module UrlScrubber
2
- VERSION = "0.7.13"
2
+ VERSION = "0.7.14"
3
3
  end
data/lib/url_scrubber.rb CHANGED
@@ -71,7 +71,7 @@ module UrlScrubber
71
71
  when :facebook
72
72
  !!url.match(%r{^http://facebook\.com/(profile\.php?id=\d+|[\w_\.-]+)$})
73
73
  when :linkedin
74
- !!url.match(%r{^http://linkedin\.com/(company/[\w_-]+|profile/view\?id=\d+)$}) || !!url.match(%r{^http://linkedin\.com/(groups\?gid=[0-9]+)$}) || !!url.match(%r{^http://linkedin\.com/(groups/[\w_-]+)$})
74
+ !!url.match(%r{^http://linkedin\.com/(in/[\w_-]+|profile/view\?id=\d+)$}) || !!url.match(%r{^http://linkedin\.com/(company/[\w_-]+|profile/view\?id=\d+)$}) || !!url.match(%r{^http://linkedin\.com/(groups\?gid=[0-9]+)$}) || !!url.match(%r{^http://linkedin\.com/(groups/[\w_-]+)$})
75
75
  when :google
76
76
  !!url.match(%r{^http://plus\.google\.com/(\+[\w_-]+|\d+)$})
77
77
  when :slideshare
@@ -100,6 +100,12 @@ module UrlScrubber
100
100
  return url.include?('http://linkedin.com/company/')
101
101
  end
102
102
 
103
+ def self.linkedin_personal_url?(url)
104
+ url = scrub(url)
105
+ return false unless url
106
+ return url.include?('http://linkedin.com/in/')
107
+ end
108
+
103
109
  def self.find_identity_from_url(url)
104
110
  UrlScrubber.scrub(url).split("/").last unless url.nil?
105
111
  end
@@ -109,6 +115,8 @@ module UrlScrubber
109
115
  scrubbed_url = scrub(url)
110
116
  if scrubbed_url && linkedin_company_url?(scrubbed_url)
111
117
  scrubbed_url.split("/").last
118
+ elsif scrubbed_url && linkedin_personal_url?(scrubbed_url)
119
+ scrubbed_url.split("/").last
112
120
  elsif scrubbed_url.include?('linkedin.com/groups/')
113
121
  scrubbed_url.split("/").last
114
122
  elsif scrubbed_url.include?('linkedin.com/groups?gid=')
@@ -216,7 +224,9 @@ module UrlScrubber
216
224
 
217
225
  url.sub!('linkedin.com/companies/', 'linkedin.com/company/')
218
226
  if !!url.match(%r{com/company/})
219
- drop_url_query!(url)
227
+ drop_url_query!(url)
228
+ elsif !!url.match(%r{com/in/})
229
+ drop_url_query!(url)
220
230
  elsif url.include?('linkedin.com/groups/')
221
231
  drop_url_query!(url)
222
232
  elsif url.include?('linkedin.com/groups?gid=')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_scrubber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.13
4
+ version: 0.7.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-03-10 00:00:00.000000000 Z
15
+ date: 2014-04-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec