class Faker::Omniauth

def facebook(name: nil, email: nil, username: nil, uid: Number.number(digits: 7).to_s)

Returns:
  • (Hash) - An auth hash in the format provided by omniauth-facebook.

Parameters:
  • uid (String) -- A specific UID to return in the response.
  • username (String) -- A specific username 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 facebook(name: nil, email: nil, username: nil, uid: Number.number(digits: 7).to_s)
  auth = Omniauth.new(name: name, email: email)
  username ||= "#{auth.first_name.downcase[0]}#{auth.last_name.downcase}"
  {
    provider: 'facebook',
    uid: uid,
    info: {
      email: auth.email,
      name: auth.name,
      first_name: auth.first_name,
      last_name: auth.last_name,
      image: image,
      verified: random_boolean
    },
    credentials: {
      token: Crypto.md5,
      expires_at: Time.forward.to_i,
      expires: true
    },
    extra: {
      raw_info: {
        id: uid,
        name: auth.name,
        first_name: auth.first_name,
        last_name: auth.last_name,
        link: "http://www.facebook.com/#{username}",
        username: username,
        location: {
          id: Number.number(digits: 9).to_s,
          name: city_state
        },
        gender: gender,
        email: auth.email,
        timezone: timezone,
        locale: 'en_US',
        verified: random_boolean,
        updated_time: Time.backward.iso8601
      }
    }
  }
end