Added a first simple test client to test the restbuck client
This commit is contained in:
18
examples/restbucks/client/client-safe.ecf
Normal file
18
examples/restbucks/client/client-safe.ecf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="client" uuid="D0059CEB-5F5C-4D21-8C71-842BD0F88468">
|
||||||
|
<target name="client">
|
||||||
|
<root class="RESTBUCK_CLIENT" feature="make"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/.git$</exclude>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||||
|
</option>
|
||||||
|
<setting name="concurrency" value="thread"/>
|
||||||
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="http_client" location="..\..\..\library\client\http_client\http_client-safe.ecf" readonly="false"/>
|
||||||
|
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
|
||||||
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
18
examples/restbucks/client/client.ecf
Normal file
18
examples/restbucks/client/client.ecf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="client" uuid="D0059CEB-5F5C-4D21-8C71-842BD0F88468">
|
||||||
|
<target name="client">
|
||||||
|
<root class="RESTBUCK_CLIENT" feature="make"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/.git$</exclude>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
|
||||||
|
</option>
|
||||||
|
<setting name="concurrency" value="thread"/>
|
||||||
|
<library name="http_client" location="..\..\..\library\client\http_client\http_client.ecf"/>
|
||||||
|
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||||
|
<library name="thread" location="$ISE_LIBRARY/library/thread/thread.ecf"/>
|
||||||
|
<cluster name="src" location="./src" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
58
examples/restbucks/client/src/restbuck_client.e
Normal file
58
examples/restbucks/client/src/restbuck_client.e
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
note
|
||||||
|
description : "Objects that ..."
|
||||||
|
author : "$Author$"
|
||||||
|
date : "$Date$"
|
||||||
|
revision : "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
RESTBUCK_CLIENT
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Initialize `Current'.
|
||||||
|
local
|
||||||
|
h: LIBCURL_HTTP_CLIENT
|
||||||
|
sess: HTTP_CLIENT_SESSION
|
||||||
|
s: READABLE_STRING_8
|
||||||
|
do
|
||||||
|
create h.make
|
||||||
|
sess := h.new_session ("http://127.0.0.1")
|
||||||
|
s := "[
|
||||||
|
{
|
||||||
|
"location":"takeAway",
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"name":"Late",
|
||||||
|
"option":"skim",
|
||||||
|
"size":"Small",
|
||||||
|
"quantity":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]"
|
||||||
|
|
||||||
|
if attached sess.post ("/order", Void, s) as r then
|
||||||
|
print (r.body)
|
||||||
|
end
|
||||||
|
|
||||||
|
if attached sess.get ("/order/1", Void) as r then
|
||||||
|
print (r.body)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
feature -- Change
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
invariant
|
||||||
|
-- invariant_clause: True
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user