ambethia-google-client_login 1.0.0 → 1.1.0
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/VERSION +1 -1
- data/google-client_login.gemspec +56 -0
- data/lib/google/client_login.rb +9 -0
- data/test/google/client_login_test.rb +15 -0
- data/test/test_helper.rb +42 -0
- metadata +5 -5
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{google-client_login}
|
|
8
|
+
s.version = "1.1.0"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Jason L Perry"]
|
|
12
|
+
s.date = %q{2009-08-31}
|
|
13
|
+
s.description = %q{A simple library for authenticating against the Google ClientLogin API}
|
|
14
|
+
s.email = %q{jasper@ambethia.com}
|
|
15
|
+
s.extra_rdoc_files = [
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.rdoc"
|
|
18
|
+
]
|
|
19
|
+
s.files = [
|
|
20
|
+
".document",
|
|
21
|
+
".gitignore",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.rdoc",
|
|
24
|
+
"Rakefile",
|
|
25
|
+
"VERSION",
|
|
26
|
+
"google-client_login.gemspec",
|
|
27
|
+
"lib/google/client_login.rb",
|
|
28
|
+
"test/google/client_login_test.rb",
|
|
29
|
+
"test/test_helper.rb"
|
|
30
|
+
]
|
|
31
|
+
s.homepage = %q{http://github.com/ambethia/google-client_login}
|
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
33
|
+
s.require_paths = ["lib"]
|
|
34
|
+
s.rubygems_version = %q{1.3.5}
|
|
35
|
+
s.summary = %q{Google ClientLogin authentication}
|
|
36
|
+
s.test_files = [
|
|
37
|
+
"test/google/client_login_test.rb",
|
|
38
|
+
"test/test_helper.rb"
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
if s.respond_to? :specification_version then
|
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
43
|
+
s.specification_version = 3
|
|
44
|
+
|
|
45
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
46
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
|
47
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
|
48
|
+
else
|
|
49
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
|
50
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
|
51
|
+
end
|
|
52
|
+
else
|
|
53
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
|
54
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/google/client_login.rb
CHANGED
|
@@ -42,5 +42,14 @@ module Google
|
|
|
42
42
|
response.body if response.code == "200"
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
|
+
|
|
46
|
+
def given_name
|
|
47
|
+
profile.match(/<gd:givenName>(.+)<\/gd:givenName>/)[1] if profile
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def family_name
|
|
51
|
+
profile.match(/<gd:familyName>(.+)<\/gd:familyName>/)[1] if profile
|
|
52
|
+
end
|
|
53
|
+
|
|
45
54
|
end
|
|
46
55
|
end
|
|
@@ -31,7 +31,22 @@ class Google::ClientLoginTest < Test::Unit::TestCase
|
|
|
31
31
|
should "have an authentication token" do
|
|
32
32
|
assert_equal "DQAAAGgA...dk3fA5N", client_login.token
|
|
33
33
|
end
|
|
34
|
+
|
|
35
|
+
context "profile" do
|
|
34
36
|
|
|
37
|
+
setup do
|
|
38
|
+
@client = client_login
|
|
39
|
+
@client.stubs(:profile).returns(PROFILE_XML)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
should "have a given name" do
|
|
43
|
+
assert_equal "Elizabeth", @client.given_name
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
should "have a family name" do
|
|
47
|
+
assert_equal "Bennet", @client.family_name
|
|
48
|
+
end
|
|
49
|
+
end
|
|
35
50
|
end
|
|
36
51
|
|
|
37
52
|
context "failed login" do
|
data/test/test_helper.rb
CHANGED
|
@@ -9,3 +9,45 @@ require 'google/client_login'
|
|
|
9
9
|
|
|
10
10
|
class Test::Unit::TestCase
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
PROFILE_XML =<<-EOF
|
|
14
|
+
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
|
|
15
|
+
xmlns:gd='http://schemas.google.com/g/2005'>
|
|
16
|
+
<atom:category scheme='http://schemas.google.com/g/2005#kind'
|
|
17
|
+
term='http://schemas.google.com/contact/2008#contact' />
|
|
18
|
+
<gd:name>
|
|
19
|
+
<gd:givenName>Elizabeth</gd:givenName>
|
|
20
|
+
<gd:familyName>Bennet</gd:familyName>
|
|
21
|
+
<gd:fullName>Elizabeth Bennet</gd:fullName>
|
|
22
|
+
</gd:name>
|
|
23
|
+
<atom:content type='text'>Notes</atom:content>
|
|
24
|
+
<gd:email rel='http://schemas.google.com/g/2005#work'
|
|
25
|
+
primary='true'
|
|
26
|
+
address='liz@gmail.com' displayName='E. Bennet' />
|
|
27
|
+
<gd:email rel='http://schemas.google.com/g/2005#home'
|
|
28
|
+
address='liz@example.org' />
|
|
29
|
+
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
|
|
30
|
+
primary='true'>
|
|
31
|
+
(206)555-1212
|
|
32
|
+
</gd:phoneNumber>
|
|
33
|
+
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
|
|
34
|
+
(206)555-1213
|
|
35
|
+
</gd:phoneNumber>
|
|
36
|
+
<gd:im address='liz@gmail.com'
|
|
37
|
+
protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'
|
|
38
|
+
primary='true'
|
|
39
|
+
rel='http://schemas.google.com/g/2005#home' />
|
|
40
|
+
<gd:structuredPostalAddress
|
|
41
|
+
rel='http://schemas.google.com/g/2005#work'
|
|
42
|
+
primary='true'>
|
|
43
|
+
<gd:city>Mountain View</gd:city>
|
|
44
|
+
<gd:street>1600 Amphitheatre Pkwy</gd:street>
|
|
45
|
+
<gd:region>CA</gd:region>
|
|
46
|
+
<gd:postcode>94043</gd:postcode>
|
|
47
|
+
<gd:country>United States</gd:country>
|
|
48
|
+
<gd:formattedAddress>
|
|
49
|
+
1600 Amphitheatre Pkwy Mountain View
|
|
50
|
+
</gd:formattedAddress>
|
|
51
|
+
</gd:structuredPostalAddress>
|
|
52
|
+
</atom:entry>
|
|
53
|
+
EOF
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ambethia-google-client_login
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason L Perry
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-08-
|
|
12
|
+
date: 2009-08-31 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -48,12 +48,12 @@ files:
|
|
|
48
48
|
- README.rdoc
|
|
49
49
|
- Rakefile
|
|
50
50
|
- VERSION
|
|
51
|
+
- google-client_login.gemspec
|
|
51
52
|
- lib/google/client_login.rb
|
|
52
53
|
- test/google/client_login_test.rb
|
|
53
54
|
- test/test_helper.rb
|
|
54
|
-
has_rdoc:
|
|
55
|
+
has_rdoc: false
|
|
55
56
|
homepage: http://github.com/ambethia/google-client_login
|
|
56
|
-
licenses:
|
|
57
57
|
post_install_message:
|
|
58
58
|
rdoc_options:
|
|
59
59
|
- --charset=UTF-8
|
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
74
74
|
requirements: []
|
|
75
75
|
|
|
76
76
|
rubyforge_project:
|
|
77
|
-
rubygems_version: 1.
|
|
77
|
+
rubygems_version: 1.2.0
|
|
78
78
|
signing_key:
|
|
79
79
|
specification_version: 3
|
|
80
80
|
summary: Google ClientLogin authentication
|