omnicontacts 0.1.6 → 0.1.7
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.
- data/Gemfile.lock +1 -1
- data/lib/omnicontacts.rb +1 -1
- data/lib/omnicontacts/importer/gmail.rb +2 -1
- data/spec/omnicontacts/importer/gmail_spec.rb +15 -0
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/omnicontacts.rb
CHANGED
@@ -41,7 +41,8 @@ module OmniContacts
|
|
41
41
|
contact = {:email => gd_email.attributes['address']}
|
42
42
|
gd_name = entry.elements['gd:name']
|
43
43
|
if gd_name
|
44
|
-
|
44
|
+
gd_full_name = gd_name.elements['gd:fullName']
|
45
|
+
contact[:name] = gd_full_name.text if gd_full_name
|
45
46
|
end
|
46
47
|
contacts << contact
|
47
48
|
end
|
@@ -14,6 +14,13 @@ describe OmniContacts::Importer::Gmail do
|
|
14
14
|
</entry>"
|
15
15
|
}
|
16
16
|
|
17
|
+
let(:contact_without_fullname) {
|
18
|
+
"<entry xmlns:gd='http://schemas.google.com/g/2005'>
|
19
|
+
<gd:name/>
|
20
|
+
<gd:email rel='http://schemas.google.com/g/2005#work' primary='true' address='bennet@gmail.com'/>
|
21
|
+
</entry>"
|
22
|
+
}
|
23
|
+
|
17
24
|
describe "fetch_contacts_using_access_token" do
|
18
25
|
|
19
26
|
let(:token) { "token" }
|
@@ -36,5 +43,13 @@ describe OmniContacts::Importer::Gmail do
|
|
36
43
|
result.first[:email].should eq("bennet@gmail.com")
|
37
44
|
end
|
38
45
|
|
46
|
+
it "should handle contact without fullname" do
|
47
|
+
gmail.should_receive(:https_get).and_return(contact_without_fullname)
|
48
|
+
result = gmail.fetch_contacts_using_access_token token, token_type
|
49
|
+
result.size.should be(1)
|
50
|
+
result.first[:name].should be_nil
|
51
|
+
result.first[:email].should eq("bennet@gmail.com")
|
52
|
+
end
|
53
|
+
|
39
54
|
end
|
40
55
|
end
|