README.md in harpy-0.4.4 vs README.md in harpy-0.4.5
- old
+ new
@@ -1,8 +1,11 @@
Harpy
======
+[](https://travis-ci.org/TalentBox/harpy)
+[](https://codeclimate.com/github/TalentBox/harpy)
+
Client for REST API with HATEOAS
Dependencies
------------
@@ -29,27 +32,27 @@
# Mass assignment
model = MyModel.new "firstname" => "Anthony", "lastname" => "Stark"
model.attributes = {"company" => "Stark Enterprises"}
model.firstname # => "Anthony"
model.company # => "Stark Enterprises"
-
+
# Because model is not persisted you can read any attribute, allowing
# to use form_for on new resources to which the client doesn't know the
# existing attributes yet
model.email # => nil
# Fetch by url
- MyModel.from_url "http://localhost/mymodel/1"
+ MyModel.from_url "http://localhost/mymodel/1"
# => instance of MyModel with attributes filled in on 200
# => nil on 404
# => raises Harpy::ClientTimeout on timeout
# => raises Harpy::ClientError on Curl error
# => raises Harpy::InvalidResponseCode on other response codes
# Fetch multiple by url in parallel
MyModel.from_url ["http://localhost/mymodel/1", "http://localhost/mymodel/2"]
-
+
# Get index
MyModel.search
# will call GET http://localhost/mymodel given the following entry_point response:
{
"link": [
@@ -58,11 +61,11 @@
}
# => return an array of MyModel instances on 200
# => raises Harpy::ClientTimeout on timeout
# => raises Harpy::ClientError on Curl error
# => raises Harpy::InvalidResponseCode on other response codes
-
+
# Search by first_name
MyModel.search :firstname => "Anthony" # GET http://localhost/mymodel?firstname=Anthony
# Create (POST)
model = MyModel.new "firstname" => "Anthony"
@@ -150,20 +153,15 @@
include Harpy::Resource
end
class SecondModel
include Harpy::Resource
end
-
+
Harpy::Resource.from_url({
- FirstModel => ["http://localhost/firstmodel/1", "http://localhost/firstmodel/2"],
- SecondModel => ["http://localhost/secondmodel/1"],
+ FirstModel => ["http://localhost/firstmodel/1", "http://localhost/firstmodel/2"],
+ SecondModel => ["http://localhost/secondmodel/1"],
})
# => {FirstModel => [...], SecondModel => [...]}
-
-Build Status
----------
-
-[](http://travis-ci.org/TalentBox/harpy)
License
-------
harpy is Copyright © 2011 TalentBox SA. It is free software, and may be redistributed under the terms specified in the LICENSE file.