google_contacts_api 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{google_contacts_api}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alvin Liang"]
12
- s.date = %q{2011-07-12}
12
+ s.date = %q{2011-07-21}
13
13
  s.description = %q{Lets you read from the Google Contacts API. Posting to come later. Tests to come later.}
14
14
  s.email = %q{ayliang@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -6,4 +6,8 @@ require 'google_contacts_api/group_set'
6
6
  require 'google_contacts_api/contact_set'
7
7
  require 'google_contacts_api/result'
8
8
  require 'google_contacts_api/group'
9
- require 'google_contacts_api/contact'
9
+ require 'google_contacts_api/contact'
10
+
11
+ module GoogleContactsApi
12
+ VERSION = "0.2.5"
13
+ end
@@ -72,5 +72,11 @@ module GoogleContactsApi
72
72
  nil # no emails at all
73
73
  end
74
74
  end
75
+
76
+ # Returns all instant messaging addresses for the contact.
77
+ # Doesn't yet distinguish protocols
78
+ def ims
79
+ self["gd$im"] ? self["gd$im"].map { |i| i.address } : []
80
+ end
75
81
  end
76
82
  end
@@ -112,7 +112,12 @@
112
112
  "rel": "http://schemas.google.com/g/2005#other",
113
113
  "address": "contact1@example.com",
114
114
  "primary": "true"
115
- }]
115
+ }],
116
+ "gd$im": [{
117
+ "address": "contact1@example.com",
118
+ "protocol": "http://schemas.google.com/g/2005#GOOGLE_TAL",
119
+ "rel": "http://schemas.google.com/g/2005#other"
120
+ }]
116
121
  },
117
122
  {
118
123
  "gd$etag": "\"QX8_ejVSLip7ImA9WB5UF0QCQAQ.\"",
@@ -155,15 +155,22 @@ describe "GoogleContactsApi" do
155
155
  @contact.primary_email.should == "contact1@example.com"
156
156
  end
157
157
  it "should return an empty array if there are no e-mail addresses" do
158
- @contact = contact_no_emails_json_hash
158
+ @contact = GoogleContactsApi::Contact.new(contact_no_emails_json_hash)
159
159
  @contact.emails.should == []
160
160
  end
161
161
  it "should return nil if there is no primary e-mail address" do
162
- @contact2 = contact_no_emails_json_hash
162
+ @contact2 = GoogleContactsApi::Contact.new(contact_no_emails_json_hash)
163
163
  @contact2.primary_email.should be_nil
164
- @contact3 = contact_no_primary_email_json_hash
164
+ @contact3 = GoogleContactsApi::Contact.new(contact_no_primary_email_json_hash)
165
165
  @contact3.primary_email.should be_nil
166
166
  end
167
+ it "should return all instant messaging accounts" do
168
+ @contact.ims.should == ["contact1@example.com"]
169
+ end
170
+ it "should return an empty array if there are no instant messaging accounts" do
171
+ @contact = GoogleContactsApi::Contact.new(contact_no_emails_json_hash)
172
+ @contact.ims.should == []
173
+ end
167
174
  end
168
175
 
169
176
  describe "Group" do
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,8 @@ require 'json'
5
5
  require 'hashie'
6
6
  require 'google_contacts_api'
7
7
 
8
+ puts "Testing version #{GoogleContactsApi::VERSION}"
9
+
8
10
  # Requires supporting files with custom matchers and macros, etc,
9
11
  # in ./support/ and its subdirectories.
10
12
  # Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: google_contacts_api
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.4
5
+ version: 0.2.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alvin Liang
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-12 00:00:00 -04:00
13
+ date: 2011-07-21 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- hash: -2760858629422999937
160
+ hash: 920346091884577731
161
161
  segments:
162
162
  - 0
163
163
  version: "0"