RUser
RUser is a simple Ruby Gem to communicate with the randomuser.me API.
Installation
gem install ruser
or in your Gemfile
gem 'ruser'
Documentation
rdoc.info/github/simpleappgroup/ruser
Quickstart
Using RUser in it's simplest form is as easy as calling:
require 'ruser'
user = RUser.new.first
puts "This user is a #{user.gender} named #{user.name.first_name}!"
Then you can access any of the following user attributes:
- gender
- name
- first_name
- last_name
- title
- location
- street
- city
- state
- zipcode
- username
- password
- salt
- md5
- sha1
- sha256
- registered
- dob
- phone
- cell
- ssn
- picture
- seed
If you want to request a female or male user specifically, specify the :gender
key in the options hash passed to new
:
require 'ruser'
woman = RUser.new({:gender => 'female'})
man = RUser.new({:gender => 'male'})
If you want to request a specific user by their seed, specify the :seed
key in the options hash passed to new
:
require 'ruser'
lazyWolf = RUser.new({:seed => 'lazyWolf'})
If you would like more than one user supply the :results
key in the options hash passed to new
:
require 'ruser'
results = RUser.new({:results => 3})
The maximum number of results is 40, any number larger than that will default to 40. You can pass the :gender
key along with results to return x number of male or female users:
results = RUser.new({ :results => 3, :gender => 'female' })
Contributing & Development
$ git clone https://github.com/simpleappgroup/ruser && cd ruser
$ bundle install
- Fork the project.
- Make your feature addition or bug fix. All specs should pass.
- Add specs for your changes. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with version, or history. If you want to have your own version, that is fine but bump version in a commit by itself in another branch so a maintainer ignore it when your pull request is merged.
- Send a pull request. Bonus points for topic branches.
License & Copyright
See LICENSE for details.