gravatar-api 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -0
- data/lib/gravatar-api/get.rb +5 -17
- data/lib/gravatar-api/version.rb +1 -1
- metadata +2 -2
- data/Gemfile +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54053312ed31ac52e5943fda70586d910a31a2df
|
4
|
+
data.tar.gz: 83f6f336e5761909aa8d22de32aff551272b3403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4263e9cc6a11e75942b2128273565205b2c12369c1018747feb474fe9ffc3e822ddfcf54386a12fabde2c278ceff9c06971281bd8a1568b8446bea226660e5e3
|
7
|
+
data.tar.gz: 696d2cffde2dafd7d59744a465537f647f15b30b80131aa35049fd2b2b8f4a2997c810da3239a231f6f4be205506865ff9727be10b51c1c48db682e3fc4b69a8
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
gravatar-api
|
2
|
+
============
|
3
|
+
|
4
|
+
A library for easy, object oriented Gravatar API access.
|
5
|
+
|
6
|
+
# Using the Gem
|
7
|
+
gravatar-api was designed to use the Gravatar API properly for easy use in web applications (and whatever else you want!).
|
8
|
+
|
9
|
+
Examples:
|
10
|
+
```ruby
|
11
|
+
require 'gravatar-api'
|
12
|
+
|
13
|
+
profile = Gravatar.new("jessegrantherrick@gmail.com")
|
14
|
+
# Return the avatar URL with default size (80px)
|
15
|
+
profile.url
|
16
|
+
# => "http://www.gravatar.com/avatar/9f3712c7a02579d7e50cb20d2680eb67"
|
17
|
+
|
18
|
+
# Return the avatar URL with a different size (150px)
|
19
|
+
profile.url(:size => 150)
|
20
|
+
# => "http://www.gravatar.com/avatar/9f3712c7a02579d7e50cb20d2680eb67?s=150"
|
21
|
+
|
22
|
+
# Return a hash of your given email (as of v0.1.3)
|
23
|
+
profile.hash!
|
24
|
+
# => "9f3712c7a02579d7e50cb20d2680eb67"
|
25
|
+
```
|
26
|
+
|
27
|
+
The hash!(email) method also works as a class method.
|
28
|
+
```ruby
|
29
|
+
require 'gravatar-api'
|
30
|
+
|
31
|
+
Gravatar.hash!("jessegrantherrick@gmail.com")
|
32
|
+
# => "9f3712c7a02579d7e50cb20d2680eb67"
|
33
|
+
```
|
data/lib/gravatar-api/get.rb
CHANGED
@@ -1,26 +1,14 @@
|
|
1
1
|
class Gravatar
|
2
|
-
|
3
|
-
# A class method to get your Gravatar URL.
|
4
|
-
# A hash of options for size as well.
|
5
|
-
def self.url(email, options = { :size => 80 })
|
6
|
-
get_url(email, options)
|
7
|
-
end
|
8
|
-
|
9
|
-
# Same as above but as an instance method.
|
2
|
+
# Get your Gravatar URL. Also a hash for size.
|
10
3
|
def url(options = { :size => 80 })
|
11
|
-
|
12
|
-
end
|
13
|
-
# Make a new method 'get' the same as the instance method 'url'.
|
14
|
-
alias :get :url
|
15
|
-
|
16
|
-
private
|
17
|
-
# A private class to save lines of code.
|
18
|
-
def get_url(email, options)
|
19
|
-
hash = Gravatar.hash!(email)
|
4
|
+
hash = Gravatar.hash!(@@email)
|
20
5
|
if options[:size] == 80
|
21
6
|
return "http://www.gravatar.com/avatar/#{hash}"
|
22
7
|
else
|
23
8
|
return "http://www.gravatar.com/avatar/#{hash}?s=#{options[:size]}"
|
24
9
|
end
|
25
10
|
end
|
11
|
+
|
12
|
+
# Make a new method 'get' the same as the instance method 'url'.
|
13
|
+
alias :get :url
|
26
14
|
end
|
data/lib/gravatar-api/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = "0.1.
|
1
|
+
VERSION = "0.1.5"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravatar-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Herrick
|
@@ -60,7 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
|
-
-
|
63
|
+
- README.md
|
64
64
|
- Rakefile
|
65
65
|
- gravatar-api.gemspec
|
66
66
|
- lib/gravatar-api.rb
|
data/Gemfile
DELETED