Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YARD docs to Faker::Twitter #1983

Merged
merged 2 commits into from
May 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions lib/faker/default/twitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
module Faker
class Twitter < Base
class << self
##
# Produces a random Twitter user.
#
# @param include_status [Boolean] Include or exclude user status details
# @param include_email [Boolean] Include or exclude user email details
# @return [Hash]
#
# @example
# Faker::Twitter.user #=> {:id=>8821452687517076614, :name=>"Lincoln Paucek", :screen_name=>"cody"...
# Faker::Twitter.user(include_status: false) # Just get a user object with no embed status
# Faker::Twitter.user(include_email: true) # Simulate an authenticated user with the email permission
#
# @faker.version 1.7.3
def user(legacy_include_status = NOT_GIVEN, legacy_include_email = NOT_GIVEN, include_status: true, include_email: false)
warn_for_deprecated_arguments do |keywords|
keywords << :include_status if legacy_include_status != NOT_GIVEN
Expand Down Expand Up @@ -59,6 +72,19 @@ def user(legacy_include_status = NOT_GIVEN, legacy_include_email = NOT_GIVEN, in
user
end

##
# Produces a random Twitter user.
#
# @param include_status [Boolean] Include or exclude user status details
# @param include_email [Boolean] Include or exclude user email details
# @return [Hash]
#
# @example
# Faker::Twitter.status #=> {:id=>8821452687517076614, :text=>"Ea et laboriosam vel non."...
# Faker::Twitter.status(include_user: false) # Just get a status object with no embed user
# Faker::Twitter.status(include_photo: true) # Includes entities for an attached image
#
# @faker.version 1.7.3
def status(legacy_include_user = NOT_GIVEN, legacy_include_photo = NOT_GIVEN, include_user: true, include_photo: false)
warn_for_deprecated_arguments do |keywords|
keywords << :include_user if legacy_include_user != NOT_GIVEN
Expand Down Expand Up @@ -97,6 +123,15 @@ def status(legacy_include_user = NOT_GIVEN, legacy_include_photo = NOT_GIVEN, in
status
end

##
# Produces a random screen name.
#
# @return [String]
#
# @example
# Faker::Twitter.screen_name #=> "audreanne_hackett"
#
# @faker.version 1.7.3
def screen_name
Faker::Internet.username(specifier: nil, separators: ['_'])[0...20]
end
Expand Down