A Ruby wrapper for RandomUser API. See https://randomuser.me
API information can be found at https://randomuser.me/documentation
Add this line to your application's Gemfile:
gem 'random_user_generator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install random_user_generator
# Generate a random user
user = RandomUserGenerator.generate
user.email
user.name.first
# Generate multiple random users
users = RandomUserGenerator.generate(results: 2)
# Generate a random female/male user
female_user = RandomUserGenerator.generate_female
male_user = RandomUserGenerator.generate_male
# Generate random users base on global options
RandomUserGenerator.configure do |config|
config.gender = 'female'
end
female_user = RandomUserGenerator.generate
male_user = RandomUserGenerator.generate(gender: 'male') # overridden by inline
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
- Fork it ( https://github.com/samnang/random_user_generator/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Copyright (c) 2015 Samnang Chhun. See LICENSE for details.