Commit 5884cffd by Raphael Lullis

More updates to README.

parent 455c25a7
...@@ -186,7 +186,9 @@ the appropiates classes to work with them. One such example is ...@@ -186,7 +186,9 @@ the appropiates classes to work with them. One such example is
`GeoPoint`, where you store latitude and longitude `GeoPoint`, where you store latitude and longitude
~~~~~ {python} ~~~~~ {python}
class Restaurant(parse_rest.Object): from parse_rest.datatypes import Object
class Restaurant(Object):
pass pass
restaurant = Restaurant(name="Los Pollos Hermanos") restaurant = Restaurant(name="Los Pollos Hermanos")
...@@ -198,7 +200,9 @@ restaurant.save() ...@@ -198,7 +200,9 @@ restaurant.save()
We can store a reference to another Object by assigning it to an attribute: We can store a reference to another Object by assigning it to an attribute:
~~~~~ {python} ~~~~~ {python}
class CollectedItem(parse_rest.Object): from parse_rest.datatypes import Object
class CollectedItem(Object):
pass pass
collectedItem = CollectedItem(type="Sword", isAwesome=True) collectedItem = CollectedItem(type="Sword", isAwesome=True)
...@@ -326,16 +330,18 @@ for post in posts_by_joe: ...@@ -326,16 +330,18 @@ for post in posts_by_joe:
Users Users
----- -----
You can sign up, log in, modify or delete users as well, using the `User` object. You sign a user up as follows: You can sign up, log in, modify or delete users as well, using the `parse_rest.user.User` class. You sign a user up as follows:
~~~~~ {python} ~~~~~ {python}
u = parse_rest.User.signup("dhelmet", "12345", phone="555-555-5555") from parse_rest.user import User
u = User.signup("dhelmet", "12345", phone="555-555-5555")
~~~~~ ~~~~~
or log in an existing user with or log in an existing user with
~~~~~ {python} ~~~~~ {python}
u = parse_rest.User.login("dhelmet", "12345") u = User.login("dhelmet", "12345")
~~~~~ ~~~~~
Once a `User` has been logged in, it saves its session so that it can be edited or deleted: Once a `User` has been logged in, it saves its session so that it can be edited or deleted:
...@@ -378,13 +384,15 @@ Parse.Cloud.define("averageStars", function(request, response) { ...@@ -378,13 +384,15 @@ Parse.Cloud.define("averageStars", function(request, response) {
}); });
~~~~~ ~~~~~
Then you can call either of these functions using the `parse_rest.Function` class: Then you can call either of these functions using the `parse_rest.datatypes.Function` class:
~~~~~ {python} ~~~~~ {python}
hello_func = parse_rest.Function("hello") from parse_rest.datatypes import Function
hello_func = Function("hello")
hello_func() hello_func()
{u'result': u'Hello world!'} {u'result': u'Hello world!'}
star_func = parse_rest.Function("averageStars") star_func = Function("averageStars")
star_func(movie="The Matrix") star_func(movie="The Matrix")
{u'result': 4.5} {u'result': 4.5}
~~~~~ ~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment