my_gravatar 0.0.5 → 0.0.6

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.
@@ -1,3 +1,3 @@
1
1
  module MyGravatar
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/my_gravatar.rb CHANGED
@@ -72,7 +72,7 @@ module MyGravatar
72
72
  end
73
73
 
74
74
  def request_url(https)
75
- https ? "https://secure.gravatar.com/avatar/" : "http://www.gravatar.com/avatar/"
75
+ https ? "https://secure.gravatar.com/avatar" : "http://www.gravatar.com/avatar"
76
76
  end
77
77
 
78
78
  def md5hash(value)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_gravatar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pragash
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-29 00:00:00 +05:30
18
+ date: 2011-05-04 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -32,14 +32,9 @@ files:
32
32
  - .gitignore
33
33
  - Gemfile
34
34
  - Rakefile
35
- - lib/gravatar.rb
36
35
  - lib/my_gravatar.rb
37
- - lib/my_gravatar.rb~
38
- - lib/my_gravatar/gravatar.rb~
39
36
  - lib/my_gravatar/version.rb
40
- - lib/my_gravatar/version.rb~
41
37
  - my_gravatar.gemspec
42
- - my_gravatar.gemspec~
43
38
  has_rdoc: true
44
39
  homepage: ""
45
40
  licenses: []
data/lib/gravatar.rb DELETED
File without changes
File without changes
@@ -1,3 +0,0 @@
1
- module MyGravatar
2
- VERSION = "0.0.4"
3
- end
data/lib/my_gravatar.rb~ DELETED
@@ -1,87 +0,0 @@
1
- module MyGravatar
2
-
3
- @gravatar_params
4
-
5
- class Gravatar
6
-
7
- def set_params(img_params)
8
- @gravatar_params = img_params
9
- end
10
-
11
- def show_gravatar
12
- raise ArgumentError, "No value specified for email" unless @gravatar_params.has_key?("email")
13
-
14
- generate_request_url
15
- end
16
-
17
- private
18
-
19
- def generate_request_url
20
- url_params = []
21
-
22
- #the gravatar url
23
- url = request_url(@gravatar_params.has_key?("https") ? @gravatar_params["https"] : false)
24
-
25
- #hashed email
26
- hash_email = md5hash(@gravatar_params["email"])
27
-
28
- #assign the extra params the user pass
29
- ["size", "default_image", "rating"].each do |k|
30
- v = gravatar_param_key(k)
31
- value = @gravatar_params.has_key?(k) ? @gravatar_params[k] : gravatar_default_value(k)
32
- url_params << "#{v}=#{value}"
33
- end
34
-
35
- #generate the url to be called
36
- gravatar_image_url = []
37
- gravatar_image_url << url
38
- gravatar_image_url << hash_email
39
- gravatar_image_url << url_params.join("/")
40
-
41
- gravatar_image_url.join("/")
42
- end
43
-
44
- #return the relevant url key
45
- def gravatar_param_key(key)
46
- case (key)
47
- when "size" : return "s"
48
- when "default_image" : return "d"
49
- when "rating" : return "r"
50
- end
51
- end
52
-
53
- #return the default values
54
- def gravatar_default_value(key)
55
- case (key)
56
- when "size" : return default_size
57
- when "default_image" : return default_image
58
- when "rating" : return default_rating
59
- end
60
- end
61
-
62
- def default_size
63
- "200"
64
- end
65
-
66
- def default_image
67
- "retro"
68
- end
69
-
70
- def default_rating
71
- "g"
72
- end
73
-
74
- def request_url(https)
75
- https ? "https://secure.gravatar.com/avatar/" : "http://www.gravatar.com/avatar/"
76
- end
77
-
78
- def md5hash(value)
79
- require 'digest/md5'
80
- digest = Digest::MD5.hexdigest(value.lstrip.rstrip.downcase)
81
-
82
- digest
83
- end
84
-
85
- end
86
-
87
- end
data/my_gravatar.gemspec~ DELETED
@@ -1,21 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "my_gravatar/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "my_gravatar"
7
- s.version = MyGravatar::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Pragash"]
10
- s.email = ["pragashonlink@gmail.com"]
11
- s.homepage = ""
12
- s.summary = %q{TODO: Write a gem summary}
13
- s.description = %q{TODO: Write a gem description}
14
-
15
- s.rubyforge_project = "my_gravatar"
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
21
- end