InternetProvider {charlatan}R Documentation

InternetProvider

Description

internet methods, e.g., email addresses, domain names

Super class

charlatan::BaseProvider -> InternetProvider

Public fields

locale

(character) the locale

safe_email_tlds

(character) safe email tlds

free_email_domains

(character) free email tlds

tlds

(character) tlds

uri_pages

(character) uri pages

uri_paths

(character) uri paths

uri_extensions

(character) uri extensions

user_name_formats

(character) user name formats

email_formats

(character) email formats

url_formats

(character) url formats

uri_formats

(character) uri formats

image_placeholder_services

(character) image uri formats

replacements

(list) a list

Methods

Public methods

Inherited methods

Method allowed_locales()

fetch the allowed locales for this provider

Usage
InternetProvider$allowed_locales()

Method new()

Create a new InternetProvider object

Usage
InternetProvider$new(locale = NULL)
Arguments
locale

(character) the locale to use. See ⁠$allowed_locales()⁠ for locales supported (default: en_US)

Returns

A new InternetProvider object


Method to_ascii()

convert to ascii

Usage
InternetProvider$to_ascii(x)
Arguments
x

the stringn to convert to ascii


Method email()

get an email address

Usage
InternetProvider$email(domain = NULL)
Arguments
domain

(character) a domain name, if not given, a random name is chosen


Method safe_email()

get a safe email address

Usage
InternetProvider$safe_email()

Method free_email()

a free email address

Usage
InternetProvider$free_email()

Method company_email()

company email address

Usage
InternetProvider$company_email()

Method ascii_email()

ascii email address

Usage
InternetProvider$ascii_email()

Method ascii_safe_email()

safe ascii email address

Usage
InternetProvider$ascii_safe_email()

Method ascii_free_email()

an ascii free email address

Usage
InternetProvider$ascii_free_email()

Method ascii_company_email()

ascii company email address

Usage
InternetProvider$ascii_company_email()

Method user_name()

a user name

Usage
InternetProvider$user_name()

Method tld()

a tld

Usage
InternetProvider$tld()

Method free_email_domain()

free email domain name

Usage
InternetProvider$free_email_domain()

Method url()

a url

Usage
InternetProvider$url(schemes = NULL)
Arguments
schemes

(character vector) a url scheme, defaults are http and https


Method domain_name()

Produce an Internet domain name with the specified number of subdomain levels

Usage
InternetProvider$domain_name(levels = 1)
Arguments
levels

(integer) how many levels, must be >1


Method domain_word()

a domain word

Usage
InternetProvider$domain_word()

Method ipv4()

an ipv4 address or network

Usage
InternetProvider$ipv4(network = FALSE)
Arguments
network

(logical) produce a network


Method ipv6()

an ipv6 address or network

Usage
InternetProvider$ipv6(network = FALSE)
Arguments
network

(logical) produce a network


Method mac_address()

a mac address

Usage
InternetProvider$mac_address()

Method uri_page()

a uri page

Usage
InternetProvider$uri_page()

Method uri_path()

a uri path

Usage
InternetProvider$uri_path(deep = NULL)
Arguments
deep

how deep to go, an integer, if not given an integer between 1 and 4 (inclusive) is chosen


Method uri_extension()

a uri extension

Usage
InternetProvider$uri_extension()

Method uri()

a uri

Usage
InternetProvider$uri()

Method slug()

a slug

Usage
InternetProvider$slug(value = NULL)
Arguments
value

(character) a string, if given, returns itself, if not, uses LoremProvider to get a random string. default: NULL


Method image_url()

Returns URL to placeholder image - Example: http://placehold.it/640x480

Usage
InternetProvider$image_url(width = NULL, height = NULL)
Arguments
width

image width, in pixels

height

image height, in pixels


Method clone()

The objects of this class are cloneable with this method.

Usage
InternetProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Note

Note that if a locale you set doesn't have a locale specific set of data for PersonProvider or CompanyProvider we fall back to en_US

Examples

(x <- InternetProvider$new())
x$locale

# uri/url/tld/etc.
x$tld()
x$slug()
x$domain_word()
x$domain_name()
x$domain_name(levels = 2)
x$domain_name(levels = 3)
x$domain_name(levels = 10)
## url's
x$url()
x$url(schemes = c("hbbp", "hggp"))
x$image_url()
## uri's
x$uri()
x$uri_page()
x$uri_extension()
x$uri_path()
x$uri_path(deep = 1)
x$uri_path(deep = 2)
x$uri_path(deep = 3)
x$uri_path(deep = 4)

# user name
x$user_name()

# emails
x$email()
x$safe_email()
x$free_email()
x$company_email()
x$free_email_domain()
x$ascii_email()
x$ascii_safe_email()
x$ascii_free_email()
x$ascii_company_email()

# addresses, mac, ipv4, ipv6
x$mac_address()
if (requireNamespace("ipaddress", quietly = TRUE)) {
  x$ipv4()
  x$ipv4(network = TRUE)
  x$ipv6()
  x$ipv6(network = TRUE)
}

# different locales
(x <- InternetProvider$new(locale = "en_AU"))
x$locale
x$tld()
x$email()
x$free_email_domain()

(x <- InternetProvider$new(locale = "de_DE"))
x$locale
x$tld()
x$uri()
x$email()
x$ascii_email()

(x <- InternetProvider$new(locale = "bg_BG"))
x$locale
x$tld()
x$uri()
x$url()
x$user_name()
x$email()
x$ascii_email()

(x <- InternetProvider$new(locale = "cs_CZ"))
x$url()
x$user_name()
x$email()

(x <- InternetProvider$new(locale = "en_NZ"))
x$free_email_domain()
x$tld()

(x <- InternetProvider$new(locale = "fa_IR"))
x$url()

(x <- InternetProvider$new(locale = "fr_FR"))
x$url()
x$user_name()
x$email()

(x <- InternetProvider$new(locale = "hr_HR"))
x$url()
x$user_name()
x$email()

# convert a string to ascii with stringi pkg
if (requireNamespace("stringi", quietly = TRUE)) {
  x$to_ascii("anĂ¯")
}

[Package charlatan version 0.5.1 Index]