linkout 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/lib/linkout.rb +23 -6
- data/lib/linkout/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db320009473c80564afaf17e69fcaa7cfa7b4dea
|
4
|
+
data.tar.gz: c6ea53f2f63ccd4c5baa8eb062896998aba42da4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 022b11b0e485a01423335b202f4d68e68cf74082b399787fb2ba137bef3cb584b785489d8654a6461d0a7cecdbc795d487a2b5dd050c5ed9f10025314260842b
|
7
|
+
data.tar.gz: 709d8b6447d90b0c438fe6888092886fb9ab243d8c696c1e935b4d8edf519cf2fe0dd7fdc0248e2b94a9b02d42696c126839a90530df934d6b5ce48bd9474499
|
data/lib/linkout.rb
CHANGED
@@ -5,7 +5,7 @@ require 'open-uri'
|
|
5
5
|
|
6
6
|
module Linkout
|
7
7
|
class Profile
|
8
|
-
attr_accessor :url, :name,:basic_info, :full_info
|
8
|
+
attr_accessor :url, :name,:basic_info, :full_info, :clean_tags
|
9
9
|
def initialize(profile_url, params={})
|
10
10
|
@url = profile_url
|
11
11
|
@doc = Nokogiri::HTML(open(@url))
|
@@ -15,13 +15,30 @@ module Linkout
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def basic_info
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
@basics = {}
|
19
|
+
@basics[:current_title] = Sanitize.fragment(@doc.css('.title').first).strip
|
20
|
+
@basics[:current_location] = Sanitize.fragment(@doc.css('.locality').first).strip
|
21
|
+
@basics[:current_industry] = Sanitize.fragment(@doc.css('.descriptor')[1]).strip
|
22
|
+
return @basics
|
22
23
|
end
|
23
24
|
def full_info
|
24
|
-
|
25
|
+
@full = {}
|
26
|
+
@full[:educations] = @doc.css('.school').map { |data| clean_tags(data)}
|
27
|
+
@full[:experiences] = @doc.css('.position').map { |data| clean_tags(data)}
|
28
|
+
@full[:certifications] = @doc.css('.certification').map { |data| clean_tags(data)}
|
29
|
+
@full[:languages] = @doc.css('.language').map { |data| clean_tags(data)}
|
30
|
+
@full[:courses] = @doc.css('.course').map { |data| clean_tags(data)}
|
31
|
+
@full[:projects] = @doc.css('.project').map { |data| clean_tags(data)}
|
32
|
+
return @full
|
33
|
+
end
|
34
|
+
|
35
|
+
def clean_tags(data)
|
36
|
+
Sanitize.fragment(data).strip
|
37
|
+
Sanitize.fragment(data).strip
|
38
|
+
Sanitize.fragment(data).strip
|
39
|
+
Sanitize.fragment(data).strip
|
40
|
+
Sanitize.fragment(data).strip
|
41
|
+
Sanitize.fragment(data).strip
|
25
42
|
end
|
26
43
|
end
|
27
44
|
end
|
data/lib/linkout/version.rb
CHANGED