rapleaf_api 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/api/person.rb +58 -5
- metadata +1 -1
data/README.md
CHANGED
@@ -46,6 +46,6 @@ Usage
|
|
46
46
|
Authors
|
47
47
|
-------
|
48
48
|
|
49
|
-
* Adam Coffman :: coffman.adam@gmail.com
|
50
|
-
* Brent Beer :: brentbeer@gmail.com
|
51
|
-
* Mark Sands :: marksands07@gmail.com
|
49
|
+
* [Adam Coffman](http://github.com/thecoffman) :: coffman.adam@gmail.com
|
50
|
+
* [Brent Beer](http://github.com/brntbeer) :: brentbeer@gmail.com
|
51
|
+
* [Mark Sands](http://github.com/marksands) :: marksands07@gmail.com
|
data/lib/api/person.rb
CHANGED
@@ -3,17 +3,70 @@ module RapleafApi
|
|
3
3
|
class Person
|
4
4
|
|
5
5
|
def initialize(xml)
|
6
|
-
@xml = XmlSimple.xml_in(xml
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
@xml = XmlSimple.xml_in(xml, {'ForceArray' => false,
|
7
|
+
'GroupTags' =>{'primary' => 'membership',
|
8
|
+
'supplemental' => 'membership',
|
9
|
+
'universities' => 'university',
|
10
|
+
'occupations' =>'occupation'}})
|
11
11
|
end
|
12
12
|
|
13
13
|
def rapleaf_id
|
14
14
|
@xml["id"]
|
15
15
|
end
|
16
16
|
|
17
|
+
def basics
|
18
|
+
@xml["basics"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def name
|
22
|
+
@xml["basics"]["name"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def age
|
26
|
+
@xml["basics"]["age"]
|
27
|
+
end
|
28
|
+
|
29
|
+
def gender
|
30
|
+
@xml["basics"]["gender"]
|
31
|
+
end
|
32
|
+
|
33
|
+
def location
|
34
|
+
@xml["basics"]["location"]
|
35
|
+
end
|
36
|
+
|
37
|
+
def occupations
|
38
|
+
@xml["basics"]["occupations"]
|
39
|
+
end
|
40
|
+
|
41
|
+
def universities
|
42
|
+
@xml["basics"]["universities"]
|
43
|
+
end
|
44
|
+
|
45
|
+
def earliest_known_activity
|
46
|
+
@xml["basics"]["earliest_known_activity"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def last_known_activity
|
50
|
+
@xml["basics"]["latest_known_activity"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def num_friends
|
54
|
+
@xml["basics"]["num_friends"]
|
55
|
+
end
|
56
|
+
|
57
|
+
def memberships(selection = :all)
|
58
|
+
if selection == :primary || selection == :all
|
59
|
+
memberships = (@xml["memberships"]["primary"])
|
60
|
+
end
|
61
|
+
if selection == :supplemental || selection == :all
|
62
|
+
if memberships.nil?
|
63
|
+
memberships = (@xml["memberships"]["supplemental"])
|
64
|
+
else
|
65
|
+
memberships << (@xml["memberships"]["supplemental"])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
memberships.compact
|
69
|
+
end
|
17
70
|
end
|
18
71
|
|
19
72
|
end
|