Skip to content

Commit e58f4b3

Browse files
author
Igor Kapkov
committed
Restore usage examples
1 parent 0478166 commit e58f4b3

File tree

2 files changed

+262
-16
lines changed

2 files changed

+262
-16
lines changed

README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
**Faker** is a pure [Elixir](http://elixir-lang.org/) library for generating
44
fake data.
55

6-
Inspired by:
7-
8-
* Ruby [faker](https://github.com/stympy/faker)
9-
* Ruby [ffaker](https://github.com/ffaker/ffaker)
10-
* PHP [Faker](https://github.com/fzaninotto/Faker)
11-
* Python [faker](https://github.com/joke2k/Faker)
12-
* Erlang [fakerl](https://github.com/piesie/fakerl)
13-
* Haskell [faker](https://github.com/gazay/faker)
6+
Inspired by: Ruby [faker](https://github.com/stympy/faker) & [ffaker](https://github.com/ffaker/ffaker), PHP [Faker](https://github.com/fzaninotto/Faker), Python [faker](https://github.com/joke2k/Faker), Erlang [fakerl](https://github.com/piesie/fakerl), and Haskell [faker](https://github.com/gazay/faker).
147

158
## Install
169

@@ -37,14 +30,8 @@ If you want to use `faker` outside tests remove `, only: :test` part.
3730
You need to start `:faker` application, but due to the many usages of fake data,
3831
(seed database, tests, etc) there's no right place to do it. For example, if you
3932
want to use it in tests, just add `Faker.start` to `test/test_helper.exs`, then,
40-
use any function described in the [documentation](http://hexdocs.pm/faker/), like `Faker.Name.name`
41-
to generate a random name.
42-
43-
## TODO
44-
45-
* Add more generators
46-
* Check performance
47-
* Promote library
33+
use any function described in the [documentation](http://hexdocs.pm/faker/) or in
34+
[usage examples](https://github.com/igas/faker/blob/master/USAGE.md).
4835

4936
## Troubleshooting
5037

USAGE.md

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
- [Faker.Address](#fakeraddress)
2+
- [Faker.App](#fakerapp)
3+
- [Faker.Avatar](#fakeravatar)
4+
- [Faker.Bitcoin](#fakerbitcoin)
5+
- [Faker.Code](#fakercode)
6+
- [Faker.Color](#fakercolor)
7+
- [Faker.Commerce](#fakercommerce)
8+
- [Faker.Company](#fakercompany)
9+
- [Faker.File](#fakerfile)
10+
- [Faker.Internet](#fakerinternet)
11+
- [Faker.Lorem](#fakerlorem)
12+
- [Faker.Lorem.Shakespeare](#fakerloremshakespeare)
13+
- [Faker.Name](#fakername)
14+
- [Faker.Team](#fakerteam)
15+
16+
### Faker.Address
17+
18+
```elixir
19+
Faker.Address.building_number #=> "99"
20+
21+
Faker.Address.city #=> "Palmaberg"
22+
23+
Faker.Address.city_prefix #=> "West"
24+
25+
Faker.Address.city_suffix #=> "ton"
26+
27+
Faker.Address.country #=> "Belize"
28+
29+
Faker.Address.country_code #=> "RO"
30+
31+
Faker.Address.latitude #=> "45.41060470043868"
32+
33+
Faker.Address.longitude #=> "-84.34087878300942"
34+
35+
Faker.Address.postcode #=> "25062"
36+
37+
Faker.Address.secondary_address #=> "Suite 097"
38+
39+
Faker.Address.state #=> "Massachusetts"
40+
41+
Faker.Address.state_abbr #=> "AK"
42+
43+
Faker.Address.street_address #=> "20 Herman Port"
44+
45+
Faker.Address.street_address(true) #=> "6379 Greenholt Turnpike Suite 779"
46+
47+
Faker.Address.street_name #=> "Derek Center"
48+
49+
Faker.Address.street_suffix #=> "Rapid"
50+
51+
Faker.Address.time_zone #=> "Asia/Novosibirsk"
52+
53+
Faker.Address.zip #=> "84084-8276"
54+
55+
Faker.Address.zip_code #=> "24838"
56+
```
57+
58+
### Faker.App
59+
60+
```elixir
61+
Faker.App.author #=> "Angie Graham IV"
62+
63+
Faker.App.name #=> "Fixflex"
64+
65+
Faker.App.version #=> "4.3.3"
66+
```
67+
68+
### Faker.Avatar
69+
70+
```elixir
71+
Faker.Avatar.image_url #=> "http://robohash.org/set_set3/bgset_bg2/qw6c1iLy6JM"
72+
73+
Faker.Avatar.image_url('a-simple-slug') #=> "http://robohash.org/a-simple-slug"
74+
75+
Faker.Avatar.image_url(200, 200) #=> "http://robohash.org/set_set1/bgset_bg2/4sA8?size=200x200"
76+
77+
Faker.Avatar.image_url('a-simple-slug', 200, 200) #=> "http://robohash.org/a-simple-slug?size=200x200"
78+
```
79+
80+
### Faker.Bitcoin
81+
82+
```elixir
83+
Faker.Bitcoin.address #=> "15SYCAaXvxosAmndphQthDok7SFTQ7Dddc"
84+
85+
Faker.Bitcoin.address(:testnet) #=> "n1nEhSeHJiURtEymbtrV1Kv97C8BN6mBUP"
86+
```
87+
88+
### Faker.Code
89+
90+
```elixir
91+
Faker.Code.isbn #=> "462033670X"
92+
93+
Faker.Code.isbn10 #=> "0762633026"
94+
95+
Faker.Code.isbn13 #=> "9794438325491"
96+
97+
Faker.Code.issn #=> "08979375"
98+
```
99+
100+
### Faker.Color
101+
102+
```elixir
103+
Faker.Color.rgb_decimal #=> {55, 2, 76}
104+
105+
Faker.Code.rgb_hex #=> "07E026"
106+
```
107+
108+
### Faker.Color
109+
110+
```elixir
111+
Faker.Color.rgb_decimal #=> {55, 2, 76}
112+
113+
Faker.Code.rgb_hex #=> "07E026"
114+
```
115+
116+
117+
### Faker.Commerce
118+
119+
```elixir
120+
Faker.Commerce.color #=> "maroon"
121+
122+
Faker.Commerce.department #=> "Sports & Outdoors"
123+
124+
Faker.Commerce.price #=> "3.5"
125+
126+
Faker.Commerce.product_name #=> "Fantastic Chair"
127+
128+
Faker.Commerce.product_name_adjective #=> "Incredible"
129+
130+
Faker.Commerce.product_name_material #=> "Wooden"
131+
132+
Faker.Commerce.product_name_product #=> "Gloves"
133+
```
134+
135+
### Faker.Company
136+
137+
```elixir
138+
Faker.Company.bs #=> "enable next-generation markets"
139+
140+
Faker.Company.bullshit #=> "value-added"
141+
142+
Faker.Company.bullshit_prefix #=> "recontextualize"
143+
144+
Faker.Company.bullshit_suffix #=> "technologies"
145+
146+
Faker.Company.buzzword #=> "composite"
147+
148+
Faker.Company.buzzword_prefix #=> "Up-sized"
149+
150+
Faker.Company.buzzword_suffix #=> "paradigm"
151+
152+
Faker.Company.catch_phrase #=> "Profound stable strategy""
153+
154+
Faker.Company.name #=> "Erdman, Rogahn and Bailey""
155+
156+
Faker.Company.suffix #=> "Group"
157+
```
158+
159+
### Faker.File
160+
161+
```elixir
162+
Faker.File.file_extension #=> "mp3"
163+
164+
Faker.File.file_extension(:video) #=> "webm"
165+
166+
Faker.File.file_name #=> "voluptaes.jpg"
167+
168+
Faker.File.file_name(:text) #=> "reo.json"
169+
170+
Faker.File.mime_type #=> "application/atom+xml"
171+
172+
Faker.File.mime_type(:image) #=> "image/gif"
173+
```
174+
175+
### Faker.Internet
176+
177+
```elixir
178+
Faker.Internet.domain_name #=> "tremblay.org"
179+
180+
Faker.Internet.domain_suffix #=> "info"
181+
182+
Faker.Internet.domain_word #=> "gerhold"
183+
184+
Faker.Internet.email #=> "tavares1993@oconner.biz"
185+
186+
Faker.Internet.free_email #=> "monroe.schaefer@yahoo.com"
187+
188+
Faker.Internet.free_email_service #=> "yahoo.com"
189+
190+
Faker.Internet.image_url #=> "https://dummyimage.com/846x223"
191+
192+
Faker.Internet.ip_v4_address #=> "3.147.154.132"
193+
194+
Faker.Internet.ip_v6_address #=> "382F:76D8:2AC7:8EFC:488E:7039:CA87:0DEA"
195+
196+
Faker.Internet.mac_address #=> "d2:35:c2:ea:f2:c1"
197+
198+
Faker.Internet.safe_email #=> "arvel1966@example.org"
199+
200+
Faker.Internet.url #=> "http://rohan.net"
201+
202+
Faker.Internet.user_name #=> "dee.ebert"
203+
```
204+
205+
### Faker.Lorem
206+
207+
```elixir
208+
Faker.Lorem.characters(%Range{first: 1, last: 10}) #=> 'lHixS3So'
209+
210+
Faker.Lorem.paragraph(%Range{first: 1, last: 2}) #=> "Nemo labore enim rem qui praesentium totam non et aut. Beatae molestiae et fugit!"
211+
212+
Faker.Lorem.paragraphs(%Range{first: 1, last: 2}) #=> ["Placeat quos harum voluptatem quaerat quidem eveniet dolores laboriosam aut. Facilis fugiat fuga quo excepturi aut ratione aut sed! Nihil velit quis magni. Illo et et ducimus labore veritatis."]
213+
214+
Faker.Lorem.sentence(%Range{first: 1, last: 10}) #=> "Eum et et."
215+
216+
Faker.Lorem.sentence(%Range{first: 1, last: 10}) #=> "Id eius esse totam voluptas sapiente totam accusantium?"
217+
218+
Faker.Lorem.sentence(3, " & ") #=> "Cum eos harum & "
219+
220+
Faker.Lorem.word #=> "voluptas"
221+
222+
Faker.Lorem.words(%Range{first: 1, last: 8}) #=> ["sed", "rerum", "et", "alias", "aut"]
223+
```
224+
225+
### Faker.Lorem.Shakespeare
226+
227+
```elixir
228+
Faker.Lorem.Shakespeare.as_you_like_it #=> "How bitter a thing it is to look into happiness through another man's eyes!"
229+
230+
Faker.Lorem.Shakespeare.hamlet #=> "And it must follow, as the night the day, thou canst not then be false to any man."
231+
232+
Faker.Lorem.Shakespeare.king_richard_iii #=> "Now is the winter of our discontent."
233+
234+
Faker.Lorem.Shakespeare.romeo_and_juliet #=> "O! she doth teach the torches to burn bright."
235+
```
236+
237+
### Faker.Name
238+
239+
```elixir
240+
Faker.Name.first_name #=> "Iva"
241+
242+
Faker.Name.last_name #=> "Veum"
243+
244+
Faker.Name.name #=> "Mr. Cristian Johnston"
245+
246+
Faker.Name.prefix #=> "Miss"
247+
248+
Faker.Name.suffix #=> "III"
249+
250+
Faker.Name.title #=> "Chief Brand Planner"
251+
```
252+
253+
### Faker.Team
254+
255+
```elixir
256+
Faker.Team.creature #=> "chickens"
257+
258+
Faker.Team.name #=> "Delaware ants"
259+
```

0 commit comments

Comments
 (0)