omnicontacts 0.3.3 → 0.3.4

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,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omnicontacts (0.3.3)
4
+ omnicontacts (0.3.4)
5
5
  json
6
6
  rack
7
7
 
data/README.md CHANGED
@@ -55,7 +55,7 @@ The following table shows which fields are supported by which provider:
55
55
  <th>Provider</th>
56
56
  <th>:email</th>
57
57
  <th>:id</th>
58
- <th>:profile_image</th>
58
+ <th>:profile_picture</th>
59
59
  <th>:name</th>
60
60
  <th>:first_name</th>
61
61
  <th>:last_name</th>
@@ -1,6 +1,6 @@
1
1
  module OmniContacts
2
2
 
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
 
5
5
  autoload :Builder, "omnicontacts/builder"
6
6
  autoload :Importer, "omnicontacts/importer"
@@ -36,15 +36,17 @@ module OmniContacts
36
36
 
37
37
  def contacts_from_response response_as_json
38
38
  response = JSON.parse(response_as_json)
39
+ return [] if response['feed'].nil? || response['feed']['entry'].nil?
39
40
  contacts = []
40
41
  response['feed']['entry'].each do |entry|
41
42
  # creating nil fields to keep the fields consistent across other networks
42
43
  contact = {:id => nil, :first_name => nil, :last_name => nil, :name => nil, :email => nil, :gender => nil, :birthday => nil, :profile_picture=> nil, :relation => nil}
43
44
  contact[:id] = entry['id']['$t'] if entry['id']
44
45
  if entry['gd$name']
45
- contact[:first_name] = normalize_name(entry['gd$name']['gd$givenName']['$t']) if entry['gd$name']['gd$givenName']
46
- contact[:last_name] = normalize_name(entry['gd$name']['gd$familyName']['$t']) if entry['gd$name']['gd$familyName']
47
- contact[:name] = normalize_name(entry['gd$name']['gd$fullName']['$t']) if entry['gd$name']['gd$fullName']
46
+ gd_name = entry['gd$name']
47
+ contact[:first_name] = normalize_name(entry['gd$name']['gd$givenName']['$t']) if gd_name['gd$givenName']
48
+ contact[:last_name] = normalize_name(entry['gd$name']['gd$familyName']['$t']) if gd_name['gd$familyName']
49
+ contact[:name] = normalize_name(entry['gd$name']['gd$fullName']['$t']) if gd_name['gd$fullName']
48
50
  contact[:name] = full_name(contact[:first_name],contact[:last_name]) if contact[:name].nil?
49
51
  end
50
52
 
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.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-17 00:00:00.000000000 Z
12
+ date: 2013-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack