#-- # gravaty # Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani # # This file is part of gravaty. # # gravaty is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # gravaty is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with gravaty. If not, see . #++ require_relative '../lib/gravaty' i = 0 # Creates the Gravaty object with an (example) email puts "------------------------------------------" puts "Avatar: '#{i}'. Creates the Gravaty object with an (example) email." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty = Gravaty::gravatize 'user@example.com'" a_gravaty = Gravaty::gravatize 'user@example.com' puts i += 1 # Prints the secure URL for avatar retrieval, with no frills # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints the secure URL for avatar retrieval, with no frills (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)." puts "------------------------------------------" puts 'irb(main):001:0> a_gravaty.avatar' puts a_gravaty.avatar puts i += 1 # Prints the basic URL for avatar retrieval, with no frills # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints the basic URL for avatar retrieval, with no frills (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af)." puts "------------------------------------------" puts 'irb(main):001:0> a_gravaty.avatar secure: false' puts a_gravaty.avatar secure: false puts i += 1 # Prints the secure URL for avatar retrieval, with specified image file # extension # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints the secure URL for avatar retrieval, with specified image file extension (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty.avatar type: 'JPG'" puts a_gravaty.avatar type: 'JPG' puts i += 1 # Retrieves the latest saved operation (email address, if none saved) # (user@example.com) puts "------------------------------------------" puts "Avatar: '#{i}'. Retrieves the latest saved operation (email address, if none saved) (user@example.com)." puts "------------------------------------------" puts 'irb(main):001:0> puts a_gravaty' puts a_gravaty puts i += 1 # Prints and saves the secure URL for avatar and later retrieval, with # specified image file extension # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints and saves the secure URL for avatar and later retrieval, with specified image file extension (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty.avatar! type: 'JPG'" puts a_gravaty.avatar! type: 'JPG' puts i += 1 # Prints the basic URL for avatar retrieval, with specified image file # extension # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.gif) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints the basic URL for avatar retrieval, with specified image file extension (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.gif)." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty.avatar type: 'GIF', secure: false" puts a_gravaty.avatar type: 'GIF', secure: false puts i += 1 # Retrieves and prints the latest saved operation # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg) puts "------------------------------------------" puts "Avatar: '#{i}'. Retrieves and prints the latest saved operation. (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg)" puts "------------------------------------------" puts 'irb(main):001:0> puts a_gravaty' puts a_gravaty puts i += 1 # Prints the basic URL for avatar retrieval, with specified image size # (in pixels) and specified image file extension # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints the basic URL for avatar retrieval, with specified image size (in pixels) and specified image file extension (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42)." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty.avatar type: 'png', pixelsize: 42, secure: false" puts a_gravaty.avatar type: 'png', pixelsize: 42, secure: false puts i += 1 # Prints and saves the basic URL for avatar retrieval, with specified # image size (in pixels), specified image file extension and type # (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42&d=monsterid) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints and saves the basic URL for avatar retrieval, with specified image size (in pixels), specified image file extension and type (http://www.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.png?s=42&d=robohash)." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty.avatar! type: 'png', default: 'robohash', pixelsize: 42, secure: false" puts a_gravaty.avatar! type: 'png', default: 'robohash', pixelsize: 42, secure: false puts i += 1 # Downloads the previously saved gravaty configuration with the default # name of the file according to saved URI # (saves b58996c504c5638798eb6b511e6f49af.png file) puts "------------------------------------------" puts "Avatar: '#{i}'. Downloads the previously saved gravaty configuration with the default name of the file according to saved URI. (saves b58996c504c5638798eb6b511e6f49af.png file)" puts "------------------------------------------" puts 'irb(main):001:0> a_gravaty.download' a_gravaty.download puts i += 1 # Prints and saves the basic URL for avatar retrieval, with specified # image default # (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=identicon) puts "------------------------------------------" puts "Avatar: '#{i}'. Prints and saves the basic URL for avatar retrieval, with specified image default (https://secure.gravatar.com/avatar/b58996c504c5638798eb6b511e6f49af.jpg?d=identicon)." puts "------------------------------------------" puts "irb(main):001:0> a_gravaty.avatar default: 'identicon', type: 'jpg'" puts a_gravaty.avatar! default: 'identicon', type: 'jpg' puts i += 1 # Downloads the previously saved gravaty configuration with the default # name of the file according to saved URI # (saves b58996c504c5638798eb6b511e6f49af.jpg file) puts "------------------------------------------" puts "Avatar: '#{i}'. Downloads the previously saved gravaty configuration with the default name of the file according to saved URI. (saves b58996c504c5638798eb6b511e6f49af.jpg file)" puts "------------------------------------------" puts 'irb(main):001:0> a_gravaty.download' a_gravaty.download puts