Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions to Access Quotes (Random, Tags, Author) #4

Open
5 of 7 tasks
nelsonic opened this issue Oct 12, 2019 · 1 comment
Open
5 of 7 tasks

Functions to Access Quotes (Random, Tags, Author) #4

nelsonic opened this issue Oct 12, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@nelsonic
Copy link
Member

nelsonic commented Oct 12, 2019

It's all well and good having a quotes.json file with a bunch of quotes.
But how are we going to access those quotes from Elixir?!

Story

As a person wanting to use thought-provoking quotes in my project,
I need an easy way of getting a single quote to display
so that the users of my app can be inspired/motivated to get stuff done!

Todo

  • Create an Elixir Module that has functions for returning a single quote:
    • random - get a random quote for any author or topic Quotes.random()
    • random_by_tag - get a random quote by a specific tag e.g: Quotes.tag("time")
    • author - get a random quote by a specific author e.g: Quotes.author("Einstein")
  • Helpers:
    • Quotes.parse_json() - opens quotes.json and parse it's contents into a List of Map.
    • Utils.count - returns the count of quotes, useful in testing Quotes.parse_json 👍
@nelsonic nelsonic added the enhancement New feature or request label Oct 12, 2019
@nelsonic nelsonic changed the title Add Functionality to Access Quotes (Random, Tags, Author) Functions to Access Quotes (Random, Tags, Author) Oct 12, 2019
nelsonic added a commit that referenced this issue Oct 13, 2019
nelsonic added a commit that referenced this issue Oct 14, 2019
nelsonic added a commit that referenced this issue Oct 17, 2019
@nelsonic
Copy link
Member Author

It's just occurred to me that if we execute a Quotes.random_by_tag function
and no match is found, will it explode...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant