Skip to content

Commit

Permalink
added nbp
Browse files Browse the repository at this point in the history
  • Loading branch information
qoobaa committed Mar 12, 2014
1 parent 5a68200 commit c4e925a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
30 changes: 30 additions & 0 deletions nbp/nbp.dir.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>

<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Kuba Kuźma</author>
<sampleQuery>SELECT * FROM nbp.dir;</sampleQuery>
<documentationURL></documentationURL>
</meta>
<bindings>
<select itemPath="result.tables" produces="JSON">
<urls>
<url>http://www.nbp.pl/kursy/xml/dir.txt</url>
</urls>
<execute><![CDATA[
var dir = request.get().response;
var results = dir.split("\n").map(function (row) {
return {
id: row,
typ: row.substr(0, 1).toUpperCase(),
numer: row.substr(1, 3).replace(/^0+/, ""),
data_publikacji: "20" + row.substr(5, 2) + "-" + row.substr(7, 2) + "-" + row.substr(9, 2)
};
});
response.object = { tables: results };
]]></execute>
</select>
</bindings>
</table>
19 changes: 19 additions & 0 deletions nbp/nbp.tables.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Kuba Kuźma</author>
<sampleQuery>SELECT * FROM nbp.tables WHERE id = "LastA";</sampleQuery>
<documentationURL></documentationURL>
</meta>
<bindings>
<select itemPath="tabela_kursow" produces="XML">
<urls>
<url>http://www.nbp.pl/kursy/xml/{id}.xml</url>
</urls>
<inputs>
<key id="id" type="xs:string" paramType="path" required="true" />
</inputs>
</select>
</bindings>
</table>

0 comments on commit c4e925a

Please sign in to comment.