module Gravaty

Author

Marco Bresciani

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.

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, line 63
def self.gravatize(email_address)
  Gravaty.new email_address, parser
end
parser() click to toggle source

Provides the parameters' parsers object.

# File lib/gravaty.rb, line 70
def self.parser
  parsers = { avatar: Parsers::Avatar.new,
              callback: Parsers::Callback.new,
              default: Parsers::Default.new,
              force: Parsers::Force.new,
              format: Parsers::Format.new,
              pixelsize: Parsers::Pixelsize.new,
              rating: Parsers::Rating.new,
              secure: Parsers::Secure.new,
              type: Parsers::Type.new }

  Parser.new parsers
end