Popularity
1.4
Declining
Activity
0.0
Declining
6
1
1

Monthly Downloads: 2
Programming language: Elixir
License: MIT License
Tags: Third Party APIs    

random_user alternatives and similar packages

Based on the "Third Party APIs" category

Do you think we are missing an alternative of random_user or a related project?

Add another 'Third Party APIs' Package

README

RandomUser Build Status Coverage Status Deps Status

Features

  • [x] Return one random user
  • [x] Return multiple random users
  • [x] Seeds (always returns Becky Sims)
  • [x] Choose gender, nationality and other options
  • [x] Format results

Installation

This package is available in Hex and can be installed as follows:

  1. Add random_user to your list of dependencies in mix.exs:

    def deps do
      [{:random_user, "~> 0.3.3"}]
    end
    
  2. Ensure random_user is started before your application:

    def application do
      [applications: [:random_user]]
    end
    

Usage

One Random User

# Returns one random user
RandomUser.Random.one

# Returns a random female user
RandomUser.Random.one(%{ gender: "female" })

# Returns a random British female user
RandomUser.Random.one(%{ gender: "female", nat: "gb" })

Multiple Random Users

# Returns 50 users
RandomUser.Random.multiple(50)

# Returns 50 female users
RandomUser.Random.multiple(50, %{ gender: "female" })

# Returns 50 female users from AU and NZ
RandomUser.Random.multiple(50, %{ gender: "female", nat: "au,nz" })

Get results easily with Parser

For one random user:

res = RandomUser.Random.one |> RandomUser.Parser.results |> RandomUser.Parser.parse
res.gender
res.picture["large"]

For multiple random users:

users = RandomUser.Random.multiple(2) |> RandomUser.Parser.results
Enum.map(users, fn u ->
  user = RandomUser.Parser.parse(u)
  large_pic = user.picture["large"]
end)