SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+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
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+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...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
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
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 

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