Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tfausak/lackey
:gem: A Haskell library for generating Ruby consumers of Servant APIs.
https://github.com/tfausak/lackey
haskell
Last synced: 10 days ago
JSON representation
:gem: A Haskell library for generating Ruby consumers of Servant APIs.
- Host: GitHub
- URL: https://github.com/tfausak/lackey
- Owner: tfausak
- License: mit
- Created: 2015-08-26T03:46:14.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-02T02:04:36.000Z (about 1 month ago)
- Last Synced: 2024-10-12T22:19:47.177Z (24 days ago)
- Topics: haskell
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/lackey
- Size: 157 KB
- Stars: 23
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# [Lackey][]
[![Workflow](https://github.com/tfausak/lackey/actions/workflows/ci.yml/badge.svg)](https://github.com/tfausak/lackey/actions/workflows/ci.yml)
[![Hackage](https://badgen.net/hackage/v/lackey)](https://hackage.haskell.org/package/lackey)Lackey is a Haskell library for generating Ruby consumers of [Servant][] APIs.
Use `Lackey.rubyForAPI` to generate a string of Ruby source code for consuming
a Servant API. For example:``` hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}import qualified Data.Proxy as Proxy
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Lackey
import Servant.APItype API = "words" :> Get '[JSON] [String]
api :: Proxy.Proxy API
api = Proxy.Proxyruby :: Text.Text
ruby = Lackey.rubyForAPI apimain :: IO ()
main = Text.putStrLn ruby
-- def get_words(excon)excon.request(:method=>:get,:path=>"/words",:headers=>{},:body=>nil)end
```The generated functions require [Excon][].
[Lackey]: https://github.com/tfausak/lackey
[Servant]: https://haskell-servant.readthedocs.org/en/stable/
[Excon]: https://rubygems.org/gems/excon