class Faker::Omniauth
def linkedin(name: nil, email: nil, uid: Number.number(digits: 6).to_s)
-
(Hash)
- An auth hash in the format provided by omniauth-linkedin.
Parameters:
-
uid
(String
) -- A specific UID to return in the response. -
email
(String
) -- A specific email to return in the response. -
name
(String
) -- A specific name to return in the response.
def linkedin(name: nil, email: nil, uid: Number.number(digits: 6).to_s) auth = Omniauth.new(name: name, email: email) first_name = auth.first_name.downcase last_name = auth.last_name.downcase location = city_state description = Lorem.sentence token = Crypto.md5 secret = Crypto.md5 industry = Commerce.department url = "http://www.linkedin.com/in/#{first_name}#{last_name}" { provider: 'linkedin', uid: uid, info: { name: auth.name, email: auth.email, nickname: auth.name, first_name: auth.first_name, last_name: auth.last_name, location: location, description: description, image: image, phone: PhoneNumber.phone_number, headline: description, industry: industry, urls: { public_profile: url } }, credentials: { token: token, secret: secret }, extra: { access_token: { token: token, secret: secret, consumer: nil, params: { oauth_token: token, oauth_token_secret: secret, oauth_expires_in: Time.forward.to_i, oauth_authorization_expires_in: Time.forward.to_i }, response: nil }, raw_info: { firstName: auth.first_name, headline: description, id: uid, industry: industry, lastName: auth.last_name, location: { country: { code: Address.country_code.downcase }, name: city_state.split(', ').first }, pictureUrl: image, publicProfileUrl: url } } } end