gravatar-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/Rakefile +45 -0
- data/gravatar-api.gemspec +21 -0
- data/lib/gravatar-api.rb +9 -0
- data/lib/gravatar-api/get.rb +26 -0
- data/lib/gravatar-api/hash.rb +10 -0
- data/lib/gravatar-api/version.rb +1 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c11c1d0dd0f39ff733e37920d2c619aee6563df4
|
4
|
+
data.tar.gz: 7873180b38d160042a7fa21a74b94b410aa31a77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24982810de4671d7e5ae90eb8f1c3fe7146bb60c7c8c29d01bff7816ae65ddbb85a0569616f124da15650b9ab703904fd96012ebb3888bba4d25aefb13d0fef4
|
7
|
+
data.tar.gz: a7605f1837e4d5ab923ca6b2e97dbcb88fca60feaa7a0eeca13aa47f1af45e8fb746e811f42702bc5897a04a279b759bacc3a82aa77805f15f3ea973bc70fff5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
|
4
|
+
|
5
|
+
# Lib Files
|
6
|
+
require 'gravatar-api/version'
|
7
|
+
|
8
|
+
# Gems
|
9
|
+
require "rubygems"
|
10
|
+
require "rake"
|
11
|
+
require "colorize"
|
12
|
+
|
13
|
+
# Tasks
|
14
|
+
desc "Gem version"
|
15
|
+
task :version do
|
16
|
+
puts "gravatar-api " + "v#{VERSION}".yellow
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Default task."
|
20
|
+
task :default do
|
21
|
+
puts `rake version`
|
22
|
+
puts "Gem seems to be in tip top shape!".green
|
23
|
+
puts "Run: ".yellow + "`gravatar --help` to list all commands."
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Build gem."
|
27
|
+
task :build do
|
28
|
+
puts "Starting gem build...".yellow
|
29
|
+
puts " Building...".yellow
|
30
|
+
`gem build gravatar-api.gemspec`
|
31
|
+
|
32
|
+
version = VERSION
|
33
|
+
puts "gravatar successfully built! ".green + "Gem ".red + "v".yellow + version
|
34
|
+
puts "Gems in this directory: ".yellow
|
35
|
+
Dir.glob("*.gem").each { |gem| puts "=> " + gem.yellow }
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Install the gem."
|
39
|
+
task :install do
|
40
|
+
gem = Dir.glob("*.gem")[-1]
|
41
|
+
puts "Installing gem...".yellow
|
42
|
+
puts "From: ".yellow +
|
43
|
+
`sudo gem install #{gem}`
|
44
|
+
puts "Gem successfully installed!".green
|
45
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'gravatar-api/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "gravatar-api"
|
7
|
+
spec.version = VERSION
|
8
|
+
spec.authors = ["Jesse Herrick"]
|
9
|
+
spec.email = ["jessegrantherrick@gmail.com"]
|
10
|
+
spec.description = %q{A library for easy, object oriented Gravatar API access.}
|
11
|
+
spec.summary = %q{Easily access the Gravatar API in an object oriented way.}
|
12
|
+
spec.homepage = "https://github.com/JesseHerrick/gravatar-api"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_development_dependency('bundler')
|
19
|
+
spec.add_development_dependency('rake')
|
20
|
+
spec.add_development_dependency('colorize')
|
21
|
+
end
|
data/lib/gravatar-api.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
class Gravatar
|
2
|
+
public
|
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.
|
10
|
+
def url(options = { :size => 80 })
|
11
|
+
get_url(@@email, options)
|
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)
|
20
|
+
if options[:size] == 80
|
21
|
+
return "http://www.gravatar.com/avatar/#{hash}"
|
22
|
+
else
|
23
|
+
return "http://www.gravatar.com/avatar/#{hash}/#{options[:size]}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
VERSION = "0.1.0"
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gravatar-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jesse Herrick
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: A library for easy, object oriented Gravatar API access.
|
56
|
+
email:
|
57
|
+
- jessegrantherrick@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- Rakefile
|
65
|
+
- gravatar-api.gemspec
|
66
|
+
- lib/gravatar-api.rb
|
67
|
+
- lib/gravatar-api/get.rb
|
68
|
+
- lib/gravatar-api/hash.rb
|
69
|
+
- lib/gravatar-api/version.rb
|
70
|
+
homepage: https://github.com/JesseHerrick/gravatar-api
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.0.3
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Easily access the Gravatar API in an object oriented way.
|
94
|
+
test_files: []
|
95
|
+
has_rdoc:
|