module Gravaty
- Author
rubocop:disable Style/AsciiComments
- Copyright
-
Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani
rubocop:enable Style/AsciiComments
- License
-
GNU General Public License version 3
Constants
- ALLOWED_PARAMS
Allowed parameters names. Currently: avatar, callback, default, force, format, pixelsize, rating, secure and type.
- ALLOWED_SIZES
Allowed sizes (in pixels) for images requests. Currently a range from 1 to 2048 (included).
- AVATAR_FORMATS
Allowed formats (extensions) for avatar requests. Currently: jp(e)g, png and gif.
- DEFAULT_OPTIONS
Currently allowed default builtin options. Currently: 404, mp, identicon, monsterid,wavatar, retro, robohash and blank.
- IMAGES_FORMATS
Allowed formats (extensions) for default own images. Currently: jp(e)g, png and gif.
- PROFILES
Formats allowing supplemental options for profile requests. Currently json and qr.
- PROFILE_FORMATS
Allowed formats (extensions) for profile requests. Currently: json, xml, php, vcf and qr.
- RATING_OPTIONS
Allowed rating options. Currently: g, pg, r and x.
- RPC_ERRORS
Possible XML-RPC API errors.
- RPC_METHODS
Allowed XML-RPC API methods.
- RPC_TEST_METHOD
Default test method for XML-RPC API.
- RPC_URI
Reference URI for XML-RPC API.
- TEST_BASIC_AVATAR
Example basic URI (avatar part) for testing purposes.
- TEST_BASIC_PROFILE
Example basic URI (profile part) for testing purposes.
- TEST_CALLBACK
Example generic callback string for testing purposes.
- TEST_FORCED
Example resulting query string when forced default for testing purposes.
- TEST_JSON_REGEXP
Example json file extension regular expression for testing purposes.
- TEST_MY_ADDRESS
Example mail address for testing purposes.
- TEST_MY_MD5
Example MD5'ed mail address for testing purposes.
- TEST_QR_REGEXP
Example QRCode file extension regular expression for testing purposes.
- TEST_SECURE_URI_REGEXP
Example secure (HTTPS) URI header regular expression for testing purposes.
- TEST_SIMPLE_URI_REGEXP
Example simple (HTTP) URI header regular expression for testing purposes.
- TEST_SIZE_REGEXP
Example size string regular expression for testing purposes.
- TEST_STRING
Example hash with basic URI parts for testing purposes.
- TEST_UNSECURE_URI_REGEXP
Example unsecure (HTTP) URI header regular expression for testing purposes.
- VERSION
Current version number for
Gravaty
gem.
Public Class Methods
Creates a new Gravaty
described by the user's email
. Throws a ArgumentError
exception if the supplied email
address is nil or not valid according to RFC5322.
- Usage
-
new_gravaty = Gravaty::gravatize email
-
new_gravaty = Gravaty::gravatize(email)
-
- Params
-
email_address
, the user's email address (a syntactically
valid one).
- Returns
-
a
Gravaty
object for the specifiedemail
address. - Raises
-
ArgumentError
, if the suppliedemail
address isnil
or not valid according to RFC 5322.
# File lib/gravaty.rb 63 def self.gravatize(email_address) 64 Gravaty.new email_address, parser 65 end
Provides the parameters' parsers object.
# File lib/gravaty.rb 70 def self.parser 71 parsers = { avatar: Parsers::Avatar.new, 72 callback: Parsers::Callback.new, 73 default: Parsers::Default.new, 74 force: Parsers::Force.new, 75 format: Parsers::Format.new, 76 pixelsize: Parsers::Pixelsize.new, 77 rating: Parsers::Rating.new, 78 secure: Parsers::Secure.new, 79 type: Parsers::Type.new } 80 81 Parser.new parsers 82 end