diff --git a/CHANGELOG.md b/CHANGELOG.md index 34dbb8dcc..6f8854604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. * Added: Support for `Armenian Language` [[@hovikman][]] * Added: `Faker.Vehicle` [[@daytonn][]] * Added: Elixir 1.9 support [[@igas][]] +* Added: `Faker.BlockChain.CryptoCoin` [[@thadeubrito][]] ### Changed @@ -317,6 +318,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. [@sotojuan]: https://github.com/sotojuan [@stfnsr]: https://github.com/stfnsr [@tbash]: https://github.com/tbash +[@thadeubrito]: https://github.com/thadeubrito [@theabrad]: https://github.com/theabrad [@tobyhinloopen]: https://github.com/tobyhinloopen [@vbrazo]: https://github.com/vbrazo diff --git a/USAGE.md b/USAGE.md index 5f3aa7776..c693d631f 100644 --- a/USAGE.md +++ b/USAGE.md @@ -10,6 +10,7 @@ - [Faker.Beer](lib/faker/beer.ex) - [Faker.Beer.En](lib/faker/beer/en.ex) - [Faker.Blockchain.Bitcoin](lib/faker/bitcoin.ex) +- [Faker.BlockChain.CryptoCoin](lib/faker/blockchain/crypto_coin.ex) - [Faker.Cat](lib/faker/cat.ex) - [Faker.Cat.En](lib/faker/cat/en.ex) diff --git a/lib/faker/blockchain/crypto_coin.ex b/lib/faker/blockchain/crypto_coin.ex new file mode 100644 index 000000000..4a5ec92a2 --- /dev/null +++ b/lib/faker/blockchain/crypto_coin.ex @@ -0,0 +1,125 @@ +defmodule Faker.BlockChain.CryptoCoin do + import Faker, only: [sampler: 2] + + @moduledoc """ + Functions for generating Crypto Coin names, acronym and url_logo + """ + + @doc """ + Return a random Crypto Coin name + + ## Examples + + iex> Faker.BlockChain.CryptoCoin.name() + "Dash" + iex> Faker.BlockChain.CryptoCoin.name() + "Bitcoin Gold" + iex> Faker.BlockChain.CryptoCoin.name() + "Bitcoin" + iex> Faker.BlockChain.CryptoCoin.name() + "Cardano" + """ + @spec name() :: String.t() + sampler(:name, [ + "Bitcoin", + "Bitcoin Cash", + "Bitcoin Gold", + "Bitcoin SV", + "Binance Coin", + "Cardano", + "Dash", + "Decred", + "EOS.IO", + "Ethereum", + "Ethereum Classic", + "IOTA", + "Litecoin", + "Monero", + "NEM", + "NEO", + "Ripple", + "Stellar", + "Tether", + "TRON", + "Zcash" + ]) + + @doc """ + Return a random Crypto Coin acronym + + ## Examples + + iex> Faker.BlockChain.CryptoCoin.acronym() + "DASH" + iex> Faker.BlockChain.CryptoCoin.acronym() + "BTG" + iex> Faker.BlockChain.CryptoCoin.acronym() + "BTC" + iex> Faker.BlockChain.CryptoCoin.acronym() + "ADA" + """ + + @spec acronym() :: String.t() + sampler(:acronym, [ + "BTC", + "BCC", + "BTG", + "BSV", + "BNB", + "ADA", + "DASH", + "DCR", + "EOS", + "ETH", + "ETC", + "IOT", + "LTC", + "XMR", + "XEM", + "NEO", + "XRP", + "XLM", + "USDT", + "TRX", + "ZEC" + ]) + + @doc """ + Return a random Crypto Coin url_logo + + ## Examples + + iex> Faker.BlockChain.CryptoCoin.url_logo() + "https://i.imgur.com/2uX91cb.png" + iex> Faker.BlockChain.CryptoCoin.url_logo() + "https://i.imgur.com/l9cVE7c.png" + iex> Faker.BlockChain.CryptoCoin.url_logo() + "https://i.imgur.com/psBNOBq.png" + iex> Faker.BlockChain.CryptoCoin.url_logo() + "https://i.imgur.com/8qGU4zg.png" + """ + @spec url_logo() :: String.t() + sampler(:url_logo, [ + "https://i.imgur.com/psBNOBq.png", + "https://i.imgur.com/ViTjr9u.png", + "https://i.imgur.com/l9cVE7c.png", + "https://i.imgur.com/DkixrAc.png", + "https://i.imgur.com/2HJr7OR.png", + "https://i.imgur.com/8qGU4zg.png", + "https://i.imgur.com/2uX91cb.png", + "https://i.imgur.com/nURXAC2.png", + "https://i.imgur.com/Cr2w77s.png", + "https://i.imgur.com/uOPFCXj.png", + "https://i.imgur.com/8wBtmQA.png", + "https://i.imgur.com/DGFCOVt.png", + "https://i.imgur.com/EFz61Ei.png", + "https://i.imgur.com/pnupcJM.png", + "https://i.imgur.com/SJ8NteF.png", + "https://i.imgur.com/BmtVrJi.png", + "https://i.imgur.com/GjAPSsL.png", + "https://i.imgur.com/COLIHUE.png", + "https://i.imgur.com/xk6pQZy.png", + "https://i.imgur.com/grG05ZK.png", + "https://i.imgur.com/mX3r4j9.png" + ]) +end diff --git a/test/faker/blockchain/crypto_coin_test.exs b/test/faker/blockchain/crypto_coin_test.exs new file mode 100644 index 000000000..e862390a1 --- /dev/null +++ b/test/faker/blockchain/crypto_coin_test.exs @@ -0,0 +1,5 @@ +defmodule Faker.BlockChain.CryptoCoinTest do + use ExUnit.Case, async: true + + doctest Faker.BlockChain.CryptoCoin +end