úÎ"U!}:Generate a Ruby client from a Servant API using Net::HTTP.(c) Hardy Jones, 2017BSD3jones3.hardy@gmail.com ExperimentalNone!":<=&The namespace for the generated class.9The list of namespaces you'd like the class to appear in.>The name of the class you'd like the API methods to appear in.7Generate a Ruby class with methods for the Servant API.3Currently assumes the API accepts and returns JSON. For example:QData.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)5 @http = Net::HTTP.new(@origin.host, @origin.port) end def get() uri = URI("#{@origin}")! req = Net::HTTP::Get.new(uri) @http.request(req) endend?The class can be nested in a module namespace if you choose so.]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)9 @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 endendTCaptures and query parameters are translated into required arguments, in that order.RThe request body and headers are translated into keyword arguments, in that order.–let api = Proxy :: Proxy ("foo" :> Capture "fooId" Int :> ReqBody '[JSON] () :> QueryParam "bar" Bool :> Header "Max-Forwards" Int :> Post '[JSON] ())3Data.Text.IO.putStr $ ruby (NameSpace [] "Foo") apirequire "json"require "net/http" require "uri" class Foo def initialize(origin) @origin = URI(origin)5 @http = Net::HTTP.new(@origin.host, @origin.port) end; def post_foo_by_foo_id(foo_id, bar, body:, max_forwards:)3 uri = URI("#{@origin}/foo/#{fooId}?bar=#{bar}")" req = Net::HTTP::Post.new(uri), req["Content-Type"] = "application/json"& req["Max-Forwards"] = max_forwards @http.request(req, body) endend        +servant-ruby-0.2.0.0-HcVvm5HHEliDhHF4y8EP9x Servant.Ruby NameSpace moduleNames classNamerubyimports properIndent initializepublic requestHeader rbSegments segmentToStrsegmentTypeToStrrbParams paramToStrsnake