gravatar-ultimate 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -1
- data/VERSION +1 -1
- data/gravatar-ultimate.gemspec +4 -4
- data/lib/gravatar.rb +10 -10
- data/lib/gravatar/dependencies.rb +1 -1
- data/spec/lib/gravatar/dependencies_spec.rb +4 -0
- data/spec/lib/gravatar_spec.rb +2 -2
- metadata +15 -4
data/README.rdoc
CHANGED
@@ -16,7 +16,9 @@ As with any gem, you have to type a few lines to tell Ruby to actually *use* it.
|
|
16
16
|
|
17
17
|
==== ...in Ruby on Rails (v3.x)
|
18
18
|
|
19
|
-
*
|
19
|
+
* Edit your Gemfile
|
20
|
+
* Add this line:
|
21
|
+
gem 'gravitar-ultimate'
|
20
22
|
|
21
23
|
==== ...in Ruby on Rails (v2.x)
|
22
24
|
|
@@ -98,3 +100,7 @@ them within an Initializer in config/initializers/any_filename.rb in order to en
|
|
98
100
|
== Copyright
|
99
101
|
|
100
102
|
Copyright (c) 2010 Colin MacKenzie IV. See LICENSE for details.
|
103
|
+
|
104
|
+
== Contributors
|
105
|
+
|
106
|
+
Ben Tillman - github.com/crossroads
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/gravatar-ultimate.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gravatar-ultimate}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Colin MacKenzie IV"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-30}
|
13
13
|
s.description = %q{The Ultimate Gravatar Gem!
|
14
14
|
|
15
15
|
This gem is used to interface with the entire Gravatar API: it's not just for generating image URLs, but for connecting
|
@@ -45,7 +45,7 @@ rather than just a URL to that data. This saves you the extra step of having to
|
|
45
45
|
s.homepage = %q{http://www.thoughtsincomputation.com/}
|
46
46
|
s.rdoc_options = ["--charset=UTF-8"]
|
47
47
|
s.require_paths = ["lib"]
|
48
|
-
s.rubygems_version = %q{1.3.
|
48
|
+
s.rubygems_version = %q{1.3.7}
|
49
49
|
s.summary = %q{A gem for interfacing with the entire Gravatar API: not just images, but the XML-RPC API too!}
|
50
50
|
s.test_files = [
|
51
51
|
"spec/spec_helper.rb",
|
@@ -59,7 +59,7 @@ rather than just a URL to that data. This saves you the extra step of having to
|
|
59
59
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
60
60
|
s.specification_version = 3
|
61
61
|
|
62
|
-
if Gem::Version.new(Gem::
|
62
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
63
63
|
s.add_runtime_dependency(%q<sc-core-ext>, [">= 1.2.0"])
|
64
64
|
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
65
65
|
s.add_development_dependency(%q<fakeweb>, [">= 1.2.8"])
|
data/lib/gravatar.rb
CHANGED
@@ -6,12 +6,12 @@ require File.expand_path("../gravatar/cache", __FILE__)
|
|
6
6
|
# Errors usually come with a number and human readable text. Generally the text should be followed whenever possible,
|
7
7
|
# but a brief description of the numeric error codes are as follows:
|
8
8
|
#
|
9
|
-
# -7
|
10
|
-
# -8
|
11
|
-
# -9
|
12
|
-
# -10
|
13
|
-
# -11
|
14
|
-
# -100
|
9
|
+
# -7 Use secure.gravatar.com
|
10
|
+
# -8 Internal error
|
11
|
+
# -9 Authentication error
|
12
|
+
# -10 Method parameter missing
|
13
|
+
# -11 Method parameter incorrect
|
14
|
+
# -100 Misc error (see text)
|
15
15
|
#
|
16
16
|
class Gravatar
|
17
17
|
attr_reader :email
|
@@ -33,7 +33,7 @@ class Gravatar
|
|
33
33
|
pw_or_key = auth.keys.first || :none
|
34
34
|
@cache = Gravatar::Cache.new(self.class.cache, options[:duration] || self.class.duration,
|
35
35
|
"gravatar-#{email_hash}-#{pw_or_key}", options[:logger] || self.class.logger)
|
36
|
-
|
36
|
+
|
37
37
|
if !auth.empty?
|
38
38
|
@api = XMLRPC::Client.new("secure.gravatar.com", "/xmlrpc?user=#{email_hash}", 443, nil, nil, nil, nil, true)
|
39
39
|
end
|
@@ -123,7 +123,7 @@ class Gravatar
|
|
123
123
|
def use_user_image!(image_hash, *email_addresses)
|
124
124
|
hashed_email_addresses = normalize_email_addresses(email_addresses)
|
125
125
|
hash = call('grav.useUserimage', :userimage => image_hash, :addresses => hashed_email_addresses)
|
126
|
-
|
126
|
+
dehashify_emails(hash, email_addresses) { |value| boolean(value) }.tap do
|
127
127
|
expire_cache!
|
128
128
|
end
|
129
129
|
end
|
@@ -139,7 +139,7 @@ class Gravatar
|
|
139
139
|
def remove_image!(*emails)
|
140
140
|
hashed_email_addresses = normalize_email_addresses(emails)
|
141
141
|
hash = call('grav.removeImage', :addresses => hashed_email_addresses)
|
142
|
-
|
142
|
+
dehashify_emails(hash, emails) { |value| boolean(value) }.tap do
|
143
143
|
expire_cache!
|
144
144
|
end
|
145
145
|
end
|
@@ -151,7 +151,7 @@ class Gravatar
|
|
151
151
|
#
|
152
152
|
# This method will clear out the cache, since it may have an effect on what the API methods respond with.
|
153
153
|
def delete_user_image!(userimage)
|
154
|
-
|
154
|
+
boolean(call('grav.deleteUserimage', :userimage => userimage)).tap do
|
155
155
|
expire_cache!
|
156
156
|
end
|
157
157
|
end
|
data/spec/lib/gravatar_spec.rb
CHANGED
@@ -71,8 +71,8 @@ describe Gravatar do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should return user images" do
|
74
|
-
subject.user_images.should
|
75
|
-
[:g, "http://en.gravatar.com/userimage/14612723/fe9dee44a1df19967db30a04083722d5.jpg"]}
|
74
|
+
subject.user_images.should include({"fe9dee44a1df19967db30a04083722d5"=>
|
75
|
+
[:g, "http://en.gravatar.com/userimage/14612723/fe9dee44a1df19967db30a04083722d5.jpg"]})
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should determine that the user exists" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravatar-ultimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Colin MacKenzie IV
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-08-30 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: sc-core-ext
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 31
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: rspec
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 27
|
41
46
|
segments:
|
42
47
|
- 1
|
43
48
|
- 3
|
@@ -49,9 +54,11 @@ dependencies:
|
|
49
54
|
name: fakeweb
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
59
|
- - ">="
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
55
62
|
segments:
|
56
63
|
- 1
|
57
64
|
- 2
|
@@ -104,23 +111,27 @@ rdoc_options:
|
|
104
111
|
require_paths:
|
105
112
|
- lib
|
106
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
107
115
|
requirements:
|
108
116
|
- - ">="
|
109
117
|
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
110
119
|
segments:
|
111
120
|
- 0
|
112
121
|
version: "0"
|
113
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
114
124
|
requirements:
|
115
125
|
- - ">="
|
116
126
|
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
117
128
|
segments:
|
118
129
|
- 0
|
119
130
|
version: "0"
|
120
131
|
requirements: []
|
121
132
|
|
122
133
|
rubyforge_project:
|
123
|
-
rubygems_version: 1.3.
|
134
|
+
rubygems_version: 1.3.7
|
124
135
|
signing_key:
|
125
136
|
specification_version: 3
|
126
137
|
summary: "A gem for interfacing with the entire Gravatar API: not just images, but the XML-RPC API too!"
|