Your SlideShare is downloading. ×
0
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Ruby gravaty gem
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Ruby gravaty gem

79

Published on

This gem automagically prepares complete URIs for Gravatar, for both avatars and profiles, with all currently supThis gem automagically prepares complete URIs for Gravatar, for both avatars and …

This gem automagically prepares complete URIs for Gravatar, for both avatars and profiles, with all currently supThis gem automagically prepares complete URIs for Gravatar, for both avatars and profiles, with all currently supported options, included the XML-RPC API, as of 2014-04-30, starting from a single email address!
It's my first 'real' Ruby gem, hoping it will be useful for someone (let me know if you use it, please!). GNU GPLv3 license; source code available through anonymous checkout: hg clone http://hg.savannah.nongnu.org/hgweb/gravaty/ or write me and I'll send it.
You can even decide to contribute to this little free software project by registering to Savannah and ask to be part of the 'gravaty' project!
With contributions from: 新部裕, Peter R. Marreck, Jon Maken, Łukasz Niemier.ported options, included the XML-RPC API, as of 2014-04-30, starting from a single email address!
It's my first 'real' Ruby gem, hoping it will be useful for someone (let me know if you use it, please!). GNU GPLv3 license; source code available through anonymous checkout: hg clone http://hg.savannah.nongnu.org/hgweb/gravaty/ or write me and I'll send it.
You can even decide to contribute to this little free software project by registering to Savannah and ask to be part of the 'gravaty' project!
With contributions from: 新部裕, Peter R. Marreck, Jon Maken, Łukasz Niemier.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
79
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Ruby gravaty gem Marco Bresciani
  • 2. What is gravaty? ● As described in the RubyGems page: – This gem automagically prepares complete URIs for Gravatar, for both avatars and profiles, with all currently supported options, included the XML-RPC API, as of 2014-04-30, starting from a single email address! ● Some (hopefully useful) references: – https://rubygems.org/gems/gravaty – https://savannah.nongnu.org/projects/gravaty – Bugs: https://savannah.nongnu.org/bugs/?group=gravaty
  • 3. What is Gravatar? ● According to Gravatar.Com (retrieved on 2014-05-19): – An "avatar" is an image that represents you online—a little picture that appears next to your name when you interact with websites. – A Gravatar is a Globally Recognized Avatar. You upload it and create your profile just once, and then when you participate in any Gravatar-enabled site, your Gravatar image will automatically follow you there. – Gravatar is a free service for site owners, developers, and users. It is automatically included in every WordPress.com account and is run and supported by Automattic. ● According to Wikipedia (updated on 17 April 2014 at 10:22): – Gravatar (an abbreviation for globally recognized avatar) is a service for providing globally unique avatars which was created by Tom Preston-Werner. Since 2007, it has been owned by Automattic, who have integrated it into their WordPress blogging platform. (see http://en.wikipedia.org/wiki/Gravatar)
  • 4. How to create a gravaty object ● Create the Gravaty object. The gravatize factory method needs your email address as parameter. There is no need to register on Gravatar.Com: – Gravaty::gravatize yourem@il.address ● Returns your email address MD5 digest: – a_gravaty.digest ● to_s method is also available; ● Bonus feature: every Gravaty is a Comparable object, based on a_gravaty.email data, your email address in small capital letters.
  • 5. The avatar image feature ● With your Gravaty object available, the avatar method provides the configuration-specific URI for your avatar: – a_gravaty.avatar returns https://secure.avatar.com/avatar/HASH (where HASH is your a_gravaty.digest email address MD5 digest) ● The method allows an Hash, with avatar configuration parameters: type, pixel_size, force, secure, rating, default. (see https://en.gravatar.com/site/implement/images/ for details) ● The avatar! method saves the provided configuration for your Gravaty object's to_s output.
  • 6. The profile content feature ● With your Gravaty object available, the profile method provides the configuration-specific URI for your (registered) user: – a_gravaty.profile returns https://secure.avatar.com/HASH (where HASH is your a_gravaty.digest email address MD5 digest) ● The method allows an Hash, with profile configuration parameters: format, secure. (see https://en.gravatar.com/site/implement/profiles/ for details) ● The profile! method saves the provided configuration for your Gravaty object's to_s output.
  • 7. The XML-RPC API content feature ● With your Gravaty object available, the xmlrpc method provides a reference to the remote Gravatar XML-RPC AP, for your (registered) user: – a_gravaty.xmlrpc requires the method name (grav.test, by default), your password and possible method parameters (whether needed) via a Hash. ● In order to increase security, the password is not saved inside the Gravaty object but has to be provided for each call; (see https://en.gravatar.com/site/implement/xmlrpc/ for details) ● Communication happens through SSL: certificate might be required (see gravaty README.md file).
  • 8. Additional features (1/2) ● Since QRCode and JSON are becoming popular formats, qr and json methods (together with qr! and json!) allows to directly retrieve the user's profile data URI, in QRCode or JSON format, with format-specific parameters. Examples: – a_gravaty.qr pixel_size: 42 – a_gravaty.json! callback: 'my_method' ● The qr! and json! methods save the provided configuration for your Gravaty object's to_s output. ● a_gravaty.qr corresponds to a_gravaty.profile format: 'qr' while a_gravaty.json corresponds to a_gravaty.profile format: 'json' and they both filtered the allowed parameters according to the output type.
  • 9. Additional features (2/2) ● When using the 'banged' (!) methods (avatar! or profile!, same for qr! and json!), the built URI is saved inside the Gravaty object and is read-only available through to_s. ● The download method, simply specifying a filename as parameter, retrieves whatever resource is indicate by such internal status and saves its content in the specified file. Example: – a_gravaty.qr! – a_gravaty.download 'myQr.png' ● The reset method clears the internal status restoring the email address output of to_s.
  • 10. Ruby gravaty gem ● This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/. ● Ruby gravaty gem by Marco Bresciani is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. ● Some (hopefully useful) references: – https://rubygems.org/gems/gravaty – https://savannah.nongnu.org/projects/gravaty

×