Skip to content

GalactHD/advice.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

advice.cr

A Crystal API wrapper for AdviceSlip.

"My life was changed after this got released"

Features

  • Get a random advice
  • Get advice by ID
  • Returns JSON parsed as key-value hashes

Installation

Clone the repository and require the SDK in your project:

require "path/to/advice"
client = Advice.new

advice = client.advice.by_id(13)

puts advice #{"slip" => {"id" => 13, "advice" => "If you're feeling tired or anxious, a pint of water will almost always make you feel better."}}
# again parsed to key value hashes!!
require "path/to/advice"

client = Advice.new

advice = client.advice.by_id(13)

puts advice #{"slip" => {"id" => 13, "advice" => "If you're feeling tired or anxious, a pint of water will almost always make you feel better."}}
# again parsed to key value hashes!!
require "path/to/advice"

client = Advice.new

query = client.advice.search("coffee")
puts advice #{"total_results": "1", "query": "coffee", "slips": [{"id":219,"advice":"Try buying a coffee for the creator of a free public API, now and then.","date":"2021-08-16"}]}

So simple!

Roadmap

  • Maybe better error handling
  • transform to a shard

About

advice.cr - a random, by id or search advice, simple and fast

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published