avataree 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 bagwanpankaj
1
+ Copyright (c) 2010 [Bagwan Pankaj]
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.textile CHANGED
@@ -22,7 +22,7 @@ and you avataree will be up and running.
22
22
 
23
23
  h2. How to use It
24
24
 
25
- yeah.. that sound's a good question.
25
+ yeah that sound's a good question.
26
26
 
27
27
  in your controller
28
28
 
@@ -56,6 +56,6 @@ h2. Contributing to avataree
56
56
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
57
57
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
58
58
 
59
- == Copyright
59
+ h2. Copyright
60
60
 
61
61
  Copyright (c) 2010 [Bagwan Pankaj]. See LICENSE.txt for further details.
@@ -23,12 +23,13 @@ require 'digest/md5'
23
23
 
24
24
  module Helper
25
25
 
26
+ #makes MD5 hash of given email
26
27
  def make_digest(email)
27
28
  Digest::MD5.hexdigest(email)
28
29
  end
29
30
 
30
31
  #fallback method if not defined(i.e if not used with rails)
31
-
32
+ #to_param for hash if hash does not respond to it
32
33
  Hash.class_eval do
33
34
  def to_param
34
35
  self.collect{|k,v| "#{k}=#{v}"}.join("&")
@@ -25,8 +25,28 @@ module Avataree
25
25
 
26
26
  include Helper
27
27
 
28
+ #image path for gravatar if not defined?
28
29
  IMAGES_PATH = "http://www.gravatar.com/avatar/" unless const_defined?("IMAGES_PATH")
29
30
 
31
+ #this method returns resulted path to be requested to gravatar. takes all argument as a hash
32
+ #options:
33
+ #<tt>s</tt> or <tt>size</tt> takes size in px (upto 512 px) :default => 80px x 80px
34
+ #<tt>d</tt> or <tt>default</tt> takes default image. Also takes a url other options are:
35
+ # 404: do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response
36
+ # mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)
37
+ # identicon: a geometric pattern based on an email hash
38
+ # monsterid: a generated 'monster' with different colors, faces, etc
39
+ # wavatar: generated faces with differing features and backgrounds
40
+ # retro: awesome generated, 8-bit arcade-style pixelated faces
41
+ #<tt>f</tt> or <tt>forcedefault</tt> takes y and n as argument :default => n
42
+ #<tt>r</tt> or <tt>rating</tt> takes below mentioned options as argument
43
+ # g: suitable for display on all websites with any audience type.
44
+ # pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
45
+ # r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
46
+ # x: may contain hardcore sexual imagery or extremely disturbing violence.
47
+ #in addition to these it also takes extension as options that lets you define the image type you want.
48
+ # <tt>extension</tt> default => jpg
49
+
30
50
  def gravatar_image_path(email, options = {})
31
51
  email = make_digest(email)
32
52
  email<<".#{options[:extension]}" and options.delete(:extension) if options[:extension]
@@ -26,8 +26,18 @@ module Avataree
26
26
 
27
27
  module Profile
28
28
 
29
+ #image path for gravatar if not defined?
29
30
  PROFILE_PATH = "http://www.gravatar.com/" unless const_defined?("PROFILE_PATH")
30
31
 
32
+ #this method returns hash full of information provided by Gravatar.
33
+ #This hash may contain
34
+ #Email address marked up with class=email (only available via JS/client-side parsing due to spam-protection measures)
35
+ # IM accounts (some values only available via JS/client-side parsing due to spam-protection measures)
36
+ # Phone numbers
37
+ # Verified accounts
38
+ # Name
39
+ # Personal Links
40
+ # Image (main Gravatar)
31
41
  def gravatar_profile(email, options = {})
32
42
  email = make_digest(email)
33
43
  email << ".json"
@@ -37,7 +47,8 @@ module Avataree
37
47
  begin
38
48
  JSON.parse(open(path).read)
39
49
  rescue => e
40
- puts "I am unable to parse this bad stuff. because\n#{e}"
50
+ {"error" => "unable to parse", "description" => "either no such user is found on gravatar using
51
+ provided email or some server side error. do check it out.", "errorTrace" => "#{e}"}
41
52
  end
42
53
  end
43
54
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avataree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bagwan Pankaj (a.k.a modulo9)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-16 00:00:00 +05:30
18
+ date: 2010-12-17 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency