-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Generate a Ruby client from a Servant API with Net::HTTP.
--   
--   Generate a Ruby client from a Servant API with Net::HTTP.
@package servant-ruby
@version 0.8.0.2


module Servant.Ruby

-- | The namespace for the generated class.
data NameSpace
NameSpace :: [Text] -> Text -> NameSpace

-- | The list of namespaces you'd like the class to appear in.
[moduleNames] :: NameSpace -> [Text]

-- | The name of the class you'd like the API methods to appear in.
[className] :: NameSpace -> Text

-- | Generate a Ruby class with methods for the Servant API.
--   
--   Currently assumes the API accepts and returns JSON.
--   
--   For example:
--   
--   <pre>
--   &gt;&gt;&gt; Data.Text.IO.putStr $ ruby (NameSpace [] "Baz") (Proxy :: Proxy (Get '[JSON] ()))
--   require "json"
--   require "net/http"
--   require "uri"
--   
--   class Baz
--     def initialize(origin)
--       @origin = URI(origin)
--       @http = Net::HTTP.new(@origin.host, @origin.port)
--     end
--   
--     def get()
--       uri = URI("#{@origin}")
--   
--       req = Net::HTTP::Get.new(uri)
--   
--       @http.request(req)
--     end
--   end
--   </pre>
--   
--   The class can be nested in a module namespace if you choose so.
--   
--   <pre>
--   &gt;&gt;&gt; Data.Text.IO.putStr $ ruby (NameSpace ["Foo", "Bar"] "Baz") (Proxy :: Proxy (Get '[JSON] ()))
--   require "json"
--   require "net/http"
--   require "uri"
--   
--   module Foo
--     module Bar
--       class Baz
--         def initialize(origin)
--           @origin = URI(origin)
--           @http = Net::HTTP.new(@origin.host, @origin.port)
--         end
--   
--         def get()
--           uri = URI("#{@origin}")
--   
--           req = Net::HTTP::Get.new(uri)
--   
--           @http.request(req)
--         end
--       end
--     end
--   end
--   </pre>
--   
--   Captures and query parameters are translated into required arguments,
--   in that order.
--   
--   The request body and headers are translated into keyword arguments, in
--   that order.
--   
--   <pre>
--   &gt;&gt;&gt; let api = Proxy :: Proxy ("foo" :&gt; Capture "fooId" Int :&gt; ReqBody '[JSON] () :&gt; QueryParam "barId" Bool :&gt; Header "Max-Forwards" Int :&gt; Post '[JSON] ())
--   
--   &gt;&gt;&gt; Data.Text.IO.putStr $ ruby (NameSpace [] "Foo") api
--   require "json"
--   require "net/http"
--   require "uri"
--   
--   class Foo
--     def initialize(origin)
--       @origin = URI(origin)
--       @http = Net::HTTP.new(@origin.host, @origin.port)
--     end
--   
--     def post_foo_by_foo_id(foo_id, bar_id, body:, max_forwards:)
--       uri = URI("#{@origin}/foo/#{foo_id}?barId=#{bar_id}")
--   
--       req = Net::HTTP::Post.new(uri)
--       req["Content-Type"] = "application/json"
--       req["Max-Forwards"] = max_forwards
--   
--       @http.request(req, body)
--     end
--   end
--   </pre>
ruby :: (GenerateList NoContent (Foreign NoContent api), HasForeign NoTypes NoContent api) => NameSpace -> Proxy api -> Text
