faker 2.2.2 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +135 -0
- data/README.md +5 -2
- data/lib/faker/blockchain/aeternity.rb +70 -0
- data/lib/faker/blockchain/bitcoin.rb +26 -0
- data/lib/faker/blockchain/ethereum.rb +10 -0
- data/lib/faker/blockchain/tezos.rb +56 -0
- data/lib/faker/books/book.rb +36 -0
- data/lib/faker/books/culture_series.rb +49 -0
- data/lib/faker/books/dune.rb +56 -3
- data/lib/faker/books/lovecraft.rb +172 -0
- data/lib/faker/creature/animal.rb +9 -0
- data/lib/faker/creature/cat.rb +27 -0
- data/lib/faker/creature/dog.rb +72 -0
- data/lib/faker/creature/horse.rb +18 -0
- data/lib/faker/default/alphanumeric.rb +23 -6
- data/lib/faker/default/app.rb +46 -0
- data/lib/faker/default/appliance.rb +18 -0
- data/lib/faker/default/artist.rb +9 -0
- data/lib/faker/default/avatar.rb +32 -0
- data/lib/faker/default/boolean.rb +12 -1
- data/lib/faker/default/chuck_norris.rb +1 -1
- data/lib/faker/default/date.rb +83 -2
- data/lib/faker/default/dessert.rb +27 -0
- data/lib/faker/default/device.rb +54 -0
- data/lib/faker/default/driving_licence.rb +2 -2
- data/lib/faker/default/electrical_components.rb +27 -0
- data/lib/faker/default/gender.rb +18 -0
- data/lib/faker/default/greek_philosophers.rb +18 -0
- data/lib/faker/default/hacker.rb +59 -1
- data/lib/faker/default/house.rb +18 -0
- data/lib/faker/default/id_number.rb +29 -0
- data/lib/faker/default/industry_segments.rb +36 -0
- data/lib/faker/default/internet.rb +19 -11
- data/lib/faker/default/lorem.rb +8 -7
- data/lib/faker/default/marketing.rb +9 -0
- data/lib/faker/default/military.rb +45 -0
- data/lib/faker/default/nation.rb +48 -5
- data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
- data/lib/faker/default/number.rb +124 -0
- data/lib/faker/default/omniauth.rb +42 -0
- data/lib/faker/default/programming_language.rb +18 -0
- data/lib/faker/default/restaurant.rb +54 -2
- data/lib/faker/default/science.rb +27 -0
- data/lib/faker/default/source.rb +43 -2
- data/lib/faker/default/subscription.rb +45 -0
- data/lib/faker/default/superhero.rb +45 -0
- data/lib/faker/default/time.rb +85 -8
- data/lib/faker/default/world_cup.rb +50 -0
- data/lib/faker/games/dota.rb +47 -0
- data/lib/faker/games/elder_scrolls.rb +72 -0
- data/lib/faker/games/fallout.rb +37 -0
- data/lib/faker/games/game.rb +27 -0
- data/lib/faker/games/half_life.rb +27 -0
- data/lib/faker/games/heroes.rb +27 -0
- data/lib/faker/games/heroes_of_the_storm.rb +36 -0
- data/lib/faker/games/league_of_legends.rb +54 -0
- data/lib/faker/games/myst.rb +45 -0
- data/lib/faker/games/overwatch.rb +27 -0
- data/lib/faker/games/pokemon.rb +27 -0
- data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
- data/lib/faker/games/super_smash_bros.rb +18 -0
- data/lib/faker/games/witcher.rb +54 -0
- data/lib/faker/games/world_of_warcraft.rb +18 -0
- data/lib/faker/games/zelda.rb +37 -1
- data/lib/faker/japanese_media/dragon_ball.rb +9 -0
- data/lib/faker/japanese_media/one_piece.rb +54 -0
- data/lib/faker/japanese_media/sword_art_online.rb +36 -0
- data/lib/faker/movies/back_to_the_future.rb +28 -0
- data/lib/faker/movies/ghostbusters.rb +28 -0
- data/lib/faker/movies/harry_potter.rb +54 -0
- data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
- data/lib/faker/movies/hobbit.rb +37 -0
- data/lib/faker/movies/lebowski.rb +27 -0
- data/lib/faker/movies/lord_of_the_rings.rb +28 -0
- data/lib/faker/movies/movie.rb +9 -0
- data/lib/faker/movies/princess_bride.rb +19 -0
- data/lib/faker/movies/star_wars.rb +94 -0
- data/lib/faker/movies/v_for_vendetta.rb +29 -0
- data/lib/faker/music/grateful_dead.rb +18 -0
- data/lib/faker/music/phish.rb +9 -0
- data/lib/faker/music/rock_band.rb +9 -0
- data/lib/faker/music/umphreys_mcgee.rb +9 -0
- data/lib/faker/sports/basketball.rb +36 -0
- data/lib/faker/sports/football.rb +45 -0
- data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
- data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
- data/lib/faker/tv_shows/breaking_bad.rb +18 -0
- data/lib/faker/tv_shows/buffy.rb +45 -0
- data/lib/faker/tv_shows/community.rb +19 -0
- data/lib/faker/tv_shows/dr_who.rb +78 -2
- data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
- data/lib/faker/tv_shows/family_guy.rb +28 -0
- data/lib/faker/tv_shows/friends.rb +27 -0
- data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
- data/lib/faker/tv_shows/hey_arnold.rb +27 -0
- data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
- data/lib/faker/tv_shows/michael_scott.rb +13 -0
- data/lib/faker/tv_shows/new_girl.rb +19 -0
- data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
- data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
- data/lib/faker/tv_shows/ru_paul.rb +18 -0
- data/lib/faker/tv_shows/seinfeld.rb +28 -0
- data/lib/faker/tv_shows/silicon_valley.rb +75 -0
- data/lib/faker/tv_shows/simpsons.rb +28 -0
- data/lib/faker/tv_shows/south_park.rb +19 -0
- data/lib/faker/tv_shows/star_trek.rb +36 -0
- data/lib/faker/tv_shows/stargate.rb +28 -0
- data/lib/faker/tv_shows/stranger_things.rb +19 -0
- data/lib/faker/tv_shows/the_expanse.rb +36 -0
- data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
- data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
- data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
- data/lib/faker/tv_shows/twin_peaks.rb +28 -0
- data/lib/faker/tv_shows/venture_bros.rb +38 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +2 -1
- data/lib/locales/en-TH.yml +360 -0
- data/lib/locales/en/color.yml +1 -1
- data/lib/locales/en/dr_who.yml +1 -1
- data/lib/locales/en/science.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +1 -0
- data/lib/locales/fr-CA.yml +1 -1
- data/lib/locales/ja.yml +12 -9
- data/lib/locales/th.yml +380 -0
- metadata +41 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cacd4170df63c267efee25b7e575509b1ff16528a143a916e90c6381bd48a8b
|
4
|
+
data.tar.gz: 7165d20574c9994f703d6c5b473b42125c27421754c7e387e3d34d5c174307e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc24fc4438f8737f09597f0f8b7be162f5d609c3e8b7799423eae173635d0762688f51e4790e915913e6e263ba9dbb45f6f02829f4ff5cf1fab724e4118acbd
|
7
|
+
data.tar.gz: ca6e471b882bca1b98ab777d6dfdf8798f4cb061d4c98781a8e93869d979ba8eefdf98541387fa309d745cd67fcb5a91b7adc8a23f647da3c8a705291b5f1989
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,140 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.7.0](https://github.com/faker-ruby/faker/tree/v2.7.0) (2019-11-01)
|
4
|
+
|
5
|
+
This version:
|
6
|
+
- adds `Faker::IDNumber.chilean_id`
|
7
|
+
- updates some translations/locales
|
8
|
+
- updates local dependencies
|
9
|
+
- adds SemVer badge
|
10
|
+
|
11
|
+
## Documentation
|
12
|
+
|
13
|
+
- [PR #1814](https://github.com/faker-ruby/faker/pull/1814) Add Discord link [@vbrazo](https://github.com/vbrazo)
|
14
|
+
- [PR #1289](https://github.com/faker-ruby/faker/pull/1289) Add SemVer compatibility badge to README [@greysteil](https://github.com/greysteil)
|
15
|
+
|
16
|
+
## Feature Request
|
17
|
+
|
18
|
+
- [PR #1819](https://github.com/faker-ruby/faker/pull/1819) Adding chilean_id in Faker::IDNumber [@cristofer](https://github.com/cristofer)
|
19
|
+
|
20
|
+
## Update locales
|
21
|
+
|
22
|
+
- [PR #1824](https://github.com/faker-ruby/faker/pull/1824) Added Canadian Country Code [@clinch](https://github.com/clinch)
|
23
|
+
- [PR #1817](https://github.com/faker-ruby/faker/pull/1817) Add Japanese animal names [@shouichi](https://github.com/shouichi)
|
24
|
+
- [PR #1816](https://github.com/faker-ruby/faker/pull/1816) Add Japanese bank names [@shouichi](https://github.com/shouichi)
|
25
|
+
- [PR #1813](https://github.com/faker-ruby/faker/pull/1813) Translate Canadian provinces for fr-CA [@Bhacaz](https://github.com/Bhacaz)
|
26
|
+
- [PR #1806](https://github.com/faker-ruby/faker/pull/1806) Add Terry Bogard to Super Smash Bros. options [@clinch](https://github.com/clinch)
|
27
|
+
|
28
|
+
## Update local dependencies
|
29
|
+
|
30
|
+
- Update rubocop requirement from = 0.75.0 to = 0.75.1 (#1811)
|
31
|
+
- Update rubocop requirement from = 0.75.1 to = 0.76.0 (#1822)
|
32
|
+
- Update minitest requirement from = 5.12.2 to = 5.13.0 (#1823)
|
33
|
+
|
34
|
+
------------------------------------------------------------------------------
|
35
|
+
|
36
|
+
## [v2.6.0](https://github.com/faker-ruby/faker/tree/v2.6.0) (2019-10-10)
|
37
|
+
|
38
|
+
This version:
|
39
|
+
- adds `Faker::Date.in_date_period`
|
40
|
+
- adds `Faker::WorldCup` YARD docs
|
41
|
+
- updates local dependencies
|
42
|
+
|
43
|
+
## Documentation
|
44
|
+
|
45
|
+
- [PR #1789](https://github.com/faker-ruby/faker/pull/1789) Faker::WorldCup YARD docs [@ashishra0](https://github.com/ashishra0)
|
46
|
+
|
47
|
+
## Feature Request
|
48
|
+
|
49
|
+
- [PR #1755](https://github.com/faker-ruby/faker/pull/1755) Add Faker::Date.in_date_period [@AmrAdelKhalil](https://github.com/AmrAdelKhalil)
|
50
|
+
|
51
|
+
## Update local dependencies
|
52
|
+
|
53
|
+
The following development dependencies were updated:
|
54
|
+
- Update rake requirement from = 12.3.3 to = 13.0.0 (#1776)
|
55
|
+
- Update minitest requirement from = 5.12.0 to = 5.12.2 (#1775)
|
56
|
+
- Update test-unit requirement from = 3.3.3 to = 3.3.4 (#1774)
|
57
|
+
|
58
|
+
------------------------------------------------------------------------------
|
59
|
+
|
60
|
+
## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
|
61
|
+
|
62
|
+
This version introduces:
|
63
|
+
- locales for Thai language - the mother language in Thailand
|
64
|
+
- YARD documentation for faker interfaces
|
65
|
+
- locales updates or fixes
|
66
|
+
|
67
|
+
## Feature Request
|
68
|
+
|
69
|
+
- [PR #1773](https://github.com/faker-ruby/faker/pull/1773) Two new locales added: th and en-th [@kodram](https://github.com/kodram)
|
70
|
+
|
71
|
+
## Documentation
|
72
|
+
|
73
|
+
- [PR #1771](https://github.com/faker-ruby/faker/pull/1771) Fix some rubocop comments that were showing up in YARD docs. [@connorshea](https://github.com/connorshea)
|
74
|
+
- [PR #1767](https://github.com/faker-ruby/faker/pull/1767) Fix two incorrect flexible method calls. [@connorshea](https://github.com/connorshea)
|
75
|
+
- [PR #1761](https://github.com/faker-ruby/faker/pull/1761) Add YARD docs for the Basketball and Football fakers. [@connorshea](https://github.com/connorshea)
|
76
|
+
- [PR #1768](https://github.com/faker-ruby/faker/pull/1768) Add YARD docs for Faker::Restaurant. [@connorshea](https://github.com/connorshea)
|
77
|
+
- [PR #1759](https://github.com/faker-ruby/faker/pull/1759) Add YARD docs for all remaining TV Shows [@connorshea](https://github.com/connorshea)
|
78
|
+
- [PR #1758](https://github.com/faker-ruby/faker/pull/1758) Add YARD docs for Doctor Who and fix a method name. [@connorshea](https://github.com/connorshea)
|
79
|
+
- [PR #1756](https://github.com/faker-ruby/faker/pull/1756) Add more miscellaneous YARD docs [@connorshea](https://github.com/connorshea)
|
80
|
+
- [PR #1753](https://github.com/faker-ruby/faker/pull/1753) Add YARD docs for Date, Time, and Number [@connorshea](https://github.com/connorshea)
|
81
|
+
|
82
|
+
## Update locales
|
83
|
+
|
84
|
+
- [PR #1764](https://github.com/faker-ruby/faker/pull/1764) Remove "mint green" from color [@ro-savage](https://github.com/ro-savage)
|
85
|
+
- [PR #1751](https://github.com/faker-ruby/faker/pull/1751) fix from Color.name to Color.color_name [@4geru](https://github.com/4geru)
|
86
|
+
|
87
|
+
## Update local dependencies
|
88
|
+
|
89
|
+
The following development dependencies were updated:
|
90
|
+
- Update minitest requirement from = 5.11.3 to = 5.12.0 (#1763)
|
91
|
+
|
92
|
+
------------------------------------------------------------------------------
|
93
|
+
|
94
|
+
## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
|
95
|
+
|
96
|
+
## Documentation
|
97
|
+
|
98
|
+
- [PR #1750](https://github.com/faker-ruby/faker/pull/1750) add only japanese word spec [@4geru](https://github.com/4geru)
|
99
|
+
- [PR #1740](https://github.com/faker-ruby/faker/pull/1740) Add more YARD docs [@connorshea](https://github.com/connorshea)
|
100
|
+
- [PR #1747](https://github.com/faker-ruby/faker/pull/1747) Fix PR links [@geniou](https://github.com/geniou)
|
101
|
+
|
102
|
+
## Feature Request
|
103
|
+
|
104
|
+
- [PR #1742](https://github.com/faker-ruby/faker/pull/1742) Add Faker::Blockchain::Aeternity [@2pd](https://github.com/2pd)
|
105
|
+
|
106
|
+
## Update locales
|
107
|
+
|
108
|
+
- [PR #1743](https://github.com/faker-ruby/faker/pull/1743) Fix another ambiguity in element_symbol field [@psibi](https://github.com/psibi)
|
109
|
+
- [PR #1748](https://github.com/faker-ruby/faker/pull/1748) fix typo from bread to breed [@4geru](https://github.com/4geru)
|
110
|
+
- [PR #1752](https://github.com/faker-ruby/faker/pull/1752) fix creature i18n path in japanese [@4geru](https://github.com/4geru)
|
111
|
+
|
112
|
+
## Update local dependencies
|
113
|
+
|
114
|
+
The following development dependencies were updated:
|
115
|
+
- Update simplecov requirement from = 0.17.0 to = 0.17.1 (#1749)
|
116
|
+
|
117
|
+
------------------------------------------------------------------------------
|
118
|
+
|
119
|
+
## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-12-09)
|
120
|
+
|
121
|
+
## Documentation
|
122
|
+
|
123
|
+
- [PR #1741](https://github.com/faker-ruby/faker/pull/1741) Fix the .gitignore for YARD. [@connorshea](https://github.com/connorshea)
|
124
|
+
- [PR #1553](https://github.com/faker-ruby/faker/pull/1553) Yard powered docs [@Zeragamba](https://github.com/Zeragamba) [@connorshea](https://github.com/connorshea)
|
125
|
+
- [PR #1727](https://github.com/faker-ruby/faker/pull/1727) Remove Football documentation from wrong category [@lucasqueiroz](https://github.com/lucasqueiroz)
|
126
|
+
|
127
|
+
## Feature Request
|
128
|
+
|
129
|
+
- [PR #1738](https://github.com/faker-ruby/faker/pull/1738) Add mock data for Apple OAuth [@dzunk](https://github.com/dzunk)
|
130
|
+
|
131
|
+
## Update locales
|
132
|
+
|
133
|
+
- [PR #1723](https://github.com/faker-ruby/faker/pull/1723) Add pokemon name in Johto area [@mathieujobin](https://github.com/mathieujobin)
|
134
|
+
- [PR #1732](https://github.com/faker-ruby/faker/pull/1732) Quebec province postal codes starts by [GHJ], adding missing two [@Ryutooooo](https://github.com/Ryutooooo)
|
135
|
+
|
136
|
+
------------------------------------------------------------------------------
|
137
|
+
|
3
138
|
## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-05-09)
|
4
139
|
|
5
140
|
## Bug/Fixes
|
data/README.md
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
# Faker
|
5
5
|
[![Build Status](https://travis-ci.org/faker-ruby/faker.svg?branch=master)](https://travis-ci.org/faker-ruby/faker)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/faker.svg)](https://badge.fury.io/rb/faker)
|
7
|
-
[![Inline docs](
|
7
|
+
[![Inline docs](https://inch-ci.org/github/faker-ruby/faker.svg?branch=master)](https://inch-ci.org/github/faker-ruby/faker)
|
8
8
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/test_coverage)](https://codeclimate.com/github/stympy/faker/test_coverage)
|
9
9
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/maintainability)](https://codeclimate.com/github/stympy/faker/maintainability)
|
10
|
+
[![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=faker&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=faker&package-manager=bundler&version-scheme=semver)
|
10
11
|
|
11
12
|
This gem is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker) that generates fake data.
|
12
13
|
|
@@ -161,7 +162,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
161
162
|
- [Faker::Fillmurray](doc/default/fillmurray.md)
|
162
163
|
- [Faker::Finance](doc/default/finance.md)
|
163
164
|
- [Faker::Food](doc/default/food.md)
|
164
|
-
- [Faker::Football](doc/default/football.md)
|
165
165
|
- [Faker::FunnyName](doc/default/funny_name.md)
|
166
166
|
- [Faker::Gender](doc/default/gender.md)
|
167
167
|
- [Faker::GreekPhilosophers](doc/default/greek_philosophers.md)
|
@@ -212,6 +212,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
|
|
212
212
|
- [Faker::WorldCup](doc/default/world_cup.md)
|
213
213
|
|
214
214
|
### Blockchain
|
215
|
+
- [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
|
215
216
|
- [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
|
216
217
|
- [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
|
217
218
|
- [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
|
@@ -360,5 +361,7 @@ See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/master/CONTRIBUTING.m
|
|
360
361
|
## Contact
|
361
362
|
Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker).
|
362
363
|
|
364
|
+
You can also join our [discord channel](https://discord.gg/RMumTwB) to discuss anything regarding improvements or feature requests.
|
365
|
+
|
363
366
|
## License
|
364
367
|
This code is free to use under the terms of the MIT license.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Faker
|
4
|
+
class Blockchain
|
5
|
+
class Aeternity < Base
|
6
|
+
class << self
|
7
|
+
##
|
8
|
+
# Produces a random Aeternity wallet address
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Blockchain::Aeternity.address
|
14
|
+
# #=> "ak_zvU8YQLagjcfng7Tg8yCdiZ1rpiWNp1PBn3vtUs44utSvbJVR"
|
15
|
+
#
|
16
|
+
def address
|
17
|
+
'ak_' + rand_strings
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Produces a random Aeternity transaction
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# Faker::Blockchain::Aeternity.transaction
|
27
|
+
# #=> "th_147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
|
28
|
+
#
|
29
|
+
def transaction
|
30
|
+
'th_' + rand_strings(51)
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Produces a random Aeternity contract
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Faker::Blockchain::Aeternity.contract
|
40
|
+
# #=> "ct_Hk2JsNeWGEYQEHHQCfcBeGrwbhtYSwFTPdDhW2SvjFYVojyhW"
|
41
|
+
#
|
42
|
+
def contract
|
43
|
+
'ct_' + rand_strings
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Produces a random Aeternity oracle
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# Faker::Blockchain::Aeternity.oracle
|
53
|
+
# #=> "ok_28QDg7fkF5qiKueSdUvUBtCYPJdmMEoS73CztzXCRAwMGKHKZh"
|
54
|
+
#
|
55
|
+
def oracle
|
56
|
+
'ok_' + rand_strings(51)
|
57
|
+
end
|
58
|
+
|
59
|
+
protected
|
60
|
+
|
61
|
+
def rand_strings(length = 50)
|
62
|
+
hex_alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
63
|
+
var = +''
|
64
|
+
length.times { var << sample(shuffle(hex_alphabet.split(''))) }
|
65
|
+
var
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -7,21 +7,47 @@ module Faker
|
|
7
7
|
class Blockchain
|
8
8
|
class Bitcoin < Base
|
9
9
|
class << self
|
10
|
+
# @private
|
10
11
|
PROTOCOL_VERSIONS = {
|
11
12
|
main: 0,
|
12
13
|
testnet: 111
|
13
14
|
}.freeze
|
14
15
|
|
16
|
+
##
|
17
|
+
# Produces a Bitcoin wallet address
|
18
|
+
#
|
19
|
+
# @return [String]
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Faker::Blockchain::Bitcoin.address
|
23
|
+
# #=> "147nDP22h3pHrLt2qykTH4txUwQh1ccaXp"
|
24
|
+
#
|
25
|
+
# @faker.version 1.9.2
|
15
26
|
def address
|
16
27
|
address_for(:main)
|
17
28
|
end
|
18
29
|
|
30
|
+
##
|
31
|
+
# Produces a Bitcoin testnet address
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Faker::Blockchain::Bitcoin.testnet_address
|
37
|
+
# #=> "n4YjRyYD6V6zREpk6opqESDqD3KYnMdVEB"
|
38
|
+
#
|
39
|
+
# @faker.version 1.9.2
|
19
40
|
def testnet_address
|
20
41
|
address_for(:testnet)
|
21
42
|
end
|
22
43
|
|
23
44
|
protected
|
24
45
|
|
46
|
+
##
|
47
|
+
# Generates a random Bitcoin address for the given network
|
48
|
+
#
|
49
|
+
# @param network [Symbol] The name of network protocol to generate an address for
|
50
|
+
# @return [String] A Bitcoin address
|
25
51
|
def address_for(network)
|
26
52
|
version = PROTOCOL_VERSIONS.fetch(network)
|
27
53
|
packed = version.chr + Faker::Config.random.bytes(20)
|
@@ -4,6 +4,16 @@ module Faker
|
|
4
4
|
class Blockchain
|
5
5
|
class Ethereum < Base
|
6
6
|
class << self
|
7
|
+
##
|
8
|
+
# Produces a random Ethereum wallet address
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# Faker::Blockchain::Ethereum.address
|
14
|
+
# #=> "0xd392b0c0500700d02d27ab30805ec80ddd3320ff"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.1
|
7
17
|
def address
|
8
18
|
hex_alphabet = '0123456789abcdef'
|
9
19
|
var = +'0x'
|
@@ -7,6 +7,7 @@ module Faker
|
|
7
7
|
class Blockchain
|
8
8
|
class Tezos < Base
|
9
9
|
class << self
|
10
|
+
# @private
|
10
11
|
PREFIXES = {
|
11
12
|
tz1: [6, 161, 159],
|
12
13
|
KT1: [2, 90, 121],
|
@@ -17,28 +18,83 @@ module Faker
|
|
17
18
|
o: [5, 116]
|
18
19
|
}.freeze
|
19
20
|
|
21
|
+
##
|
22
|
+
# Produces a random Tezos account address
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Blockchain::Tezos.account
|
28
|
+
# #=> "tz1eUsgK6aj752Fbxwk5sAoEFvSDnPjZ4qvk"
|
29
|
+
#
|
30
|
+
# @faker.version 1.9.2
|
20
31
|
def account
|
21
32
|
encode_tz(:tz1, 20)
|
22
33
|
end
|
23
34
|
|
35
|
+
##
|
36
|
+
# Produces a random Tezos contract
|
37
|
+
#
|
38
|
+
# @return [String]
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# Faker::Blockchain::Tezos.contract
|
42
|
+
# #=> "KT1MroqeP15nnitB4CnNfkqHYa2NErhPPLWF"
|
43
|
+
#
|
44
|
+
# @faker.version 1.9.2
|
24
45
|
def contract
|
25
46
|
encode_tz(:KT1, 20)
|
26
47
|
end
|
27
48
|
|
49
|
+
##
|
50
|
+
# Produces a random Tezos operation
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Faker::Blockchain::Tezos.operation
|
56
|
+
# #=> "onygWYXJX3xNstFLv9PcCrhQdCkENC795xwSinmTEc1jsDN4VDa"
|
57
|
+
#
|
58
|
+
# @faker.version 1.9.2
|
28
59
|
def operation
|
29
60
|
encode_tz(:o, 32)
|
30
61
|
end
|
31
62
|
|
63
|
+
##
|
64
|
+
# Produces a random Tezos block
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# Faker::Blockchain::Tezos.block
|
70
|
+
# #=> "BMbhs2rkY1dvAkAyRytvPsjFQ2RiPrBhYkxvWpY65dzkdSuw58a"
|
71
|
+
#
|
72
|
+
# @faker.version 1.9.4
|
32
73
|
def block
|
33
74
|
encode_tz(:B, 32)
|
34
75
|
end
|
35
76
|
|
77
|
+
##
|
78
|
+
# Produces a random Tezos signature
|
79
|
+
#
|
80
|
+
# @return [String]
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Faker::Blockchain::Tezos.signature
|
84
|
+
# #=> "edsigu165B7VFf3Dpw2QABVzEtCxJY2gsNBNcE3Ti7rRxtDUjqTFRpg67EdAQmY6YWPE5tKJDMnSTJDFu65gic8uLjbW2YwGvAZ"
|
85
|
+
#
|
86
|
+
# @faker.version 1.9.2
|
36
87
|
def signature
|
37
88
|
encode_tz(:edsig, 64)
|
38
89
|
end
|
39
90
|
|
40
91
|
protected
|
41
92
|
|
93
|
+
##
|
94
|
+
# @param prefix [Symbol]
|
95
|
+
# @param payload_size [Integer] The size of the payload
|
96
|
+
#
|
97
|
+
# @return [String]
|
42
98
|
def encode_tz(prefix, payload_size)
|
43
99
|
prefix = PREFIXES.fetch(prefix)
|
44
100
|
packed = prefix.map(&:chr).join('') + Faker::Config.random.bytes(payload_size)
|
data/lib/faker/books/book.rb
CHANGED
@@ -5,18 +5,54 @@ module Faker
|
|
5
5
|
flexible :book
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces a random book title
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::Book.title #=> "The Odd Sister"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.3
|
8
17
|
def title
|
9
18
|
fetch('book.title')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces a random book author
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::Book.author #=> "Alysha Olsen"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.3
|
12
30
|
def author
|
13
31
|
parse('book.author')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces a random book publisher
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::Book.publisher #=> "Opus Reader"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.3
|
16
43
|
def publisher
|
17
44
|
fetch('book.publisher')
|
18
45
|
end
|
19
46
|
|
47
|
+
##
|
48
|
+
# Produces a random genre
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::Book.genre #=> "Mystery"
|
54
|
+
#
|
55
|
+
# @faker.version 1.9.3
|
20
56
|
def genre
|
21
57
|
fetch('book.genre')
|
22
58
|
end
|