class Faker::Omniauth
def twitter(name: nil, nickname: nil, uid: Number.number(digits: 6).to_s)
-
(Hash)
- An auth hash in the format provided by omniauth-twitter.
Parameters:
-
uid
(String
) -- A specific UID to return in the response. -
nickname
(String
) -- A specific nickname to return in the response. -
name
(String
) -- A specific name to return in the response.
def twitter(name: nil, nickname: nil, uid: Number.number(digits: 6).to_s) auth = Omniauth.new(name: name) nickname ||= auth.name.downcase.delete(' ') location = city_state description = Lorem.sentence { provider: 'twitter', uid: uid, info: { nickname: nickname, name: auth.name, location: location, image: image, description: description, urls: { Website: nil, Twitter: "https://twitter.com/#{nickname}" } }, credentials: { token: Crypto.md5, secret: Crypto.md5 }, extra: { access_token: '', raw_info: { name: auth.name, listed_count: random_number_from_range(1..10), profile_sidebar_border_color: Color.hex_color, url: nil, lang: 'en', statuses_count: random_number_from_range(1..1000), profile_image_url: image, profile_background_image_url_https: image, location: location, time_zone: Address.city, follow_request_sent: random_boolean, id: uid, profile_background_tile: random_boolean, profile_sidebar_fill_color: Color.hex_color, followers_count: random_number_from_range(1..10_000), default_profile_image: random_boolean, screen_name: '', following: random_boolean, utc_offset: timezone, verified: random_boolean, favourites_count: random_number_from_range(1..10), profile_background_color: Color.hex_color, is_translator: random_boolean, friends_count: random_number_from_range(1..10_000), notifications: random_boolean, geo_enabled: random_boolean, profile_background_image_url: image, protected: random_boolean, description: description, profile_link_color: Color.hex_color, created_at: Time.backward.strftime('%a %b %d %H:%M:%S %z %Y'), id_str: uid, profile_image_url_https: image, default_profile: random_boolean, profile_use_background_image: random_boolean, entities: { description: { urls: [] } }, profile_text_color: Color.hex_color, contributors_enabled: random_boolean } } } end