module Gravaty

Author

Marco Bresciani

Copyright

Copyright © 2013, 2014, 2015, 2016, 2017, 2018,

2019 Marco Bresciani

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

gravatize(email_address) click to toggle source

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 specified email address.

Raises

ArgumentError, if the supplied email address is nil

or not valid according to RFC 5322.

   # File lib/gravaty.rb
53 def self.gravatize(email_address)
54   Gravaty.new email_address, parser
55 end