grave 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/grave.rb +47 -0
- metadata +47 -0
data/lib/grave.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Grave
|
7
|
+
class User
|
8
|
+
def self.new(email)
|
9
|
+
hash = Digest::MD5.hexdigest(email)
|
10
|
+
json = JSON.parse(open("http://en.gravatar.com/#{hash}.json").read)
|
11
|
+
json = json["entry"]
|
12
|
+
@@json = json[0]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.hash
|
16
|
+
@@json['hash']
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.id
|
20
|
+
@@json['id']
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.url
|
24
|
+
@@json['profileUrl']
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.preferred
|
28
|
+
@@json['preferredUsername']
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.thumbnail
|
32
|
+
@@json['thumbnailUrl']
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.display
|
36
|
+
@@json['displayName']
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.bio
|
40
|
+
@@json['aboutMe']
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.location
|
44
|
+
@@json['currentLocation']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: grave
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- dejay
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Grave is the easiest way to manipulate Gravatar in a ruby environment.
|
15
|
+
Finally, you will be able to access user information by calling simple methods that
|
16
|
+
resemble those found in Gravatar's JSON files.
|
17
|
+
email: ''
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/grave.rb
|
23
|
+
homepage: http://rubygems.org/gems/grave
|
24
|
+
licenses: []
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 1.8.23
|
44
|
+
signing_key:
|
45
|
+
specification_version: 3
|
46
|
+
summary: A Gravatar Library
|
47
|
+
test_files: []
|