SlideShare uma empresa Scribd logo
1 de 10
Baixar para ler offline
Ruby gravaty gem
Marco Bresciani
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
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)
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.
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.
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.
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).
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.
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.
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

Mais conteúdo relacionado

Semelhante a Ruby gravaty gem

Rails training presentation routing
Rails training presentation   routingRails training presentation   routing
Rails training presentation routing
theacadian
 
Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Learning to code for startup mvp session 3
Learning to code for startup mvp session 3
Henry S
 

Semelhante a Ruby gravaty gem (20)

Freeing the cloud, one service at a time
Freeing the cloud, one service at a timeFreeing the cloud, one service at a time
Freeing the cloud, one service at a time
 
Will paginate and kaminari
Will paginate and kaminariWill paginate and kaminari
Will paginate and kaminari
 
Build Fast WordPress Site With Gatsby
Build Fast WordPress Site With GatsbyBuild Fast WordPress Site With Gatsby
Build Fast WordPress Site With Gatsby
 
Latest & interesting updates #android dev
Latest & interesting updates #android devLatest & interesting updates #android dev
Latest & interesting updates #android dev
 
IRJET- Login System for Web: Session Management using BCRYPTJS
IRJET- Login System for Web: Session Management using BCRYPTJSIRJET- Login System for Web: Session Management using BCRYPTJS
IRJET- Login System for Web: Session Management using BCRYPTJS
 
BloodHound Unleashed.pdf
BloodHound Unleashed.pdfBloodHound Unleashed.pdf
BloodHound Unleashed.pdf
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
 
Open Source Web Charts
Open Source Web ChartsOpen Source Web Charts
Open Source Web Charts
 
Schema Markup
Schema MarkupSchema Markup
Schema Markup
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
 
DEF CON 27 - BEN SADEGHIPOUR - owning the clout through ssrf and pdf generators
DEF CON 27 - BEN SADEGHIPOUR  - owning the clout through ssrf and pdf generatorsDEF CON 27 - BEN SADEGHIPOUR  - owning the clout through ssrf and pdf generators
DEF CON 27 - BEN SADEGHIPOUR - owning the clout through ssrf and pdf generators
 
Deploying your static web app to the Cloud
Deploying your static web app to the CloudDeploying your static web app to the Cloud
Deploying your static web app to the Cloud
 
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesomeEuroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
Euroclojure2014: Schema & Swagger - making your Clojure web APIs more awesome
 
Javascript SEO - Leicester Digital May 2018
Javascript SEO - Leicester Digital May 2018Javascript SEO - Leicester Digital May 2018
Javascript SEO - Leicester Digital May 2018
 
Rails training presentation routing
Rails training presentation   routingRails training presentation   routing
Rails training presentation routing
 
Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Learning to code for startup mvp session 3
Learning to code for startup mvp session 3
 
Shindig in 2 hours
Shindig in 2 hoursShindig in 2 hours
Shindig in 2 hours
 
Building A Gem From Scratch
Building A Gem From ScratchBuilding A Gem From Scratch
Building A Gem From Scratch
 
Web development - technologies and tools
Web development - technologies and toolsWeb development - technologies and tools
Web development - technologies and tools
 

Último

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Ruby gravaty gem

  • 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