omnicontacts 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnicontacts (0.1.6)
4
+ omnicontacts (0.1.7)
5
5
  json
6
6
  rack
7
7
 
@@ -1,6 +1,6 @@
1
1
  module OmniContacts
2
2
 
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
 
5
5
  autoload :Builder, "omnicontacts/builder"
6
6
  autoload :Importer, "omnicontacts/importer"
@@ -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
- contact[:name] = gd_name.elements['gd:fullName'].text
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnicontacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: