Skip to content

Commit

Permalink
Renamed to hateoas-client
Browse files Browse the repository at this point in the history
  • Loading branch information
DracoBlue committed Apr 4, 2015
1 parent 5f172dc commit ed53ade
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 25 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rest-client.js is licensed under the terms of MIT License.
hateoas-client.js is licensed under the terms of MIT License.

Copyright (c) 2011-2014 by DracoBlue (JanS@DracoBlue.de)

Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
rest-client.js README
hateoas-client.js README
=======================

This client is still a rough draft of how one could make this client happen.
The api is subject to change and comments and help is appriciated!

* Latest Release: [![GitHub version](https://badge.fury.io/gh/DracoBlue%2Frest-client-js.png)](https://github.com/DracoBlue/rest-client-js/releases)
* Latest Release: [![GitHub version](https://badge.fury.io/gh/DracoBlue%2Fhateoas-client-js.png)](https://github.com/DracoBlue/hateoas-client-js/releases)
* Official Site: <http://dracoblue.net/>

rest-client.js is copyright 2011-2014 by DracoBlue <http://dracoblue.net>
hateoas-client.js is copyright 2011-2014 by DracoBlue <http://dracoblue.net>

What is rest-client.js?
What is hateoas-client.js?
-----------------------

rest-client.js is a library to communicate with RESTful services. It uses
hateoas-client.js is a library to communicate with RESTful services. It uses
jQuery as ajax library. It's aim is to provide a very simple API to follow
the `links` defined in a request response, thus achieving
level 3 in `Richardson Maturity Model`.
Expand All @@ -26,7 +26,7 @@ How does it work?

### Example with JSON

If you include `rest-client.js` after your `jQuery.js`, you'll have the ability
If you include `hateoas-client.js` after your `jQuery.js`, you'll have the ability
to make such requests:

var a = new HttpAgent('/api');
Expand Down Expand Up @@ -71,11 +71,11 @@ That example also shows, how one can use the `proxy_script`-option to use a
Usage with require.js
---------------------

If you want to retrieve the HttpAgent in your require.js script use (ensure that `rest-client-js` maps on `rest-client.js`
If you want to retrieve the HttpAgent in your require.js script use (ensure that `hateoas-client-js` maps on `hateoas-client.js`
in your requirejs config file):

``` javascript
require('rest-client-js', function(rest_client) {
require('hateoas-client', function(rest_client) {
var a = new rest_client.HttpAgent('/api');
});
```
Expand All @@ -93,6 +93,7 @@ Changelog
---------

* dev
- renamed to hateoas-client.js
- handle relative paths in links (by asking HttpAgent for the base url)
- Added FIXME method for getLinks on HTML/XML objects
- added nodejs support with domino, jquery and xmlhttprequest for nodejs
Expand All @@ -113,4 +114,4 @@ Changelog
License
--------

rest-client.js is licensed under the terms of MIT. See LICENSE for more information.
hateoas-client.js is licensed under the terms of MIT. See LICENSE for more information.
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "rest-client-js",
"main": "rest-client.js",
"homepage": "https://github.com/DracoBlue/rest-client-js",
"name": "hateoas-client",
"main": "hateoas-client.js",
"homepage": "https://github.com/DracoBlue/hateoas-client-js",
"authors": [
"DracoBlue <JanS@DracoBlue.de>"
],
"description": "rest-client.js is a library to communicate with RESTful services. It uses jQuery as ajax library. It's aim is to provide a very simple API to follow the links defined in a request response, thus achieving level 3 in Richardson Maturity Model.",
"description": "hateoas-client.js is a library to communicate with RESTful services. It uses jQuery as ajax library. It's aim is to provide a very simple API to follow the links defined in a request response, thus achieving level 3 in Richardson Maturity Model.",
"moduleType": [
"amd",
"globals"
Expand Down
2 changes: 1 addition & 1 deletion example/buy_coffee.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.js"></script>
<script src="../rest-client.js"></script>
<script src="../hateoas-client.js"></script>
</head>
<body>
Please see your browsers console.log for output!
Expand Down
2 changes: 1 addition & 1 deletion example/hal_coffee.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.js"></script>
<script src="../rest-client.js"></script>
<script src="../hateoas-client.js"></script>
</head>
<body>
Please see your browsers console.log for output!
Expand Down
2 changes: 1 addition & 1 deletion example/leave_the_maze.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.js"></script>
<script src="../rest-client.js"></script>
<script src="../hateoas-client.js"></script>
</head>
<body>
Please see your browsers console.log for output!
Expand Down
2 changes: 1 addition & 1 deletion example/show_atom_archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.js"></script>
<script src="../rest-client.js"></script>
<script src="../hateoas-client.js"></script>
</head>
<body>
Please see your browsers console.log for output!
Expand Down
12 changes: 10 additions & 2 deletions rest-client.js → hateoas-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ HttpAgent.prototype.rawCall = function(cb, verb, params, headers) {
if (this.options.proxy_script) {
url = this.options.proxy_script + encodeURIComponent(url);
}
jQuery.ajax({
beforeSend: function(xhrObj){
for (var header in that.default_headers)
Expand Down Expand Up @@ -183,6 +183,14 @@ HttpAgent.prototype.rawBreadthFirstSearch = function(cb, filter_object) {
cb(links[filter_object][0], response);
return ;
}

if (typeof filter_object === "function") {
if (filter_object(response))
{
cb(tmp_entry_point.clone(), response);
return ;
}
}

if (typeof filter_object !== "string") {
try {
Expand Down Expand Up @@ -689,7 +697,7 @@ HttpAgent.registerResponseContentTypes(['text/html', 'application/xml'], XmlHttp

if (typeof define !== "undefined")
{
define('rest-client-js', [], function () {
define('hateoas-client-js', [], function () {
return {
"HttpAgent": HttpAgent
};
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rest-client.js",
"name": "hateoas-client",
"description": "A library to communicate with RESTful services. It's aim is to provide a very simple API to follow the links defined in a request response, thus achieving level 3 in Richardson Maturity Model.",
"main": "rest-client.js",
"main": "hateoas-client.js",
"directories": {
"example": "example"
},
Expand All @@ -10,7 +10,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/DracoBlue/rest-client-js.git"
"url": "https://github.com/DracoBlue/hateoas-client-js.git"
},
"keywords": [
"rest",
Expand All @@ -24,9 +24,9 @@
"author": "DracoBlue <JanS@DracoBlue.de>",
"license": "MIT",
"bugs": {
"url": "https://github.com/DracoBlue/rest-client-js/issues"
"url": "https://github.com/DracoBlue/hateoas-client-js/issues"
},
"homepage": "https://github.com/DracoBlue/rest-client-js",
"homepage": "https://github.com/DracoBlue/hateoas-client-js",
"dependencies": {
"domino": "^1.0.18",
"jquery": "^2.1.3",
Expand Down

0 comments on commit ed53ade

Please sign in to comment.