Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated README to describe the new navigate method

  • Loading branch information...
commit 963088b6e0d8565d5bcf7a149f5851f6bf1b4b27 1 parent d9d3348
@visoft authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
13 README.md
@@ -194,6 +194,19 @@ OData allows you to [query navigation properties and only return the links for t
svc.Categories(1).links("Products")
product_links = svc.execute # => returns URIs for the products under the Category with an ID of 1
+### Advanced Navigation Property Functions
+There are instances where you may need to navigate down a level in order to form the proper query.
+Take for example [Netflix's OData Service](http://developer.netflix.com/docs/oData_Catalog/) and their `Genres` Entity Collection, where you can access a Navigation Property (in this case `Titles` through the `Genre` and filter on it:
+
+ http://odata.netflix.com/Catalog/Genres('Horror%20Movies')/Titles?$filter=Name%20eq'Halloween'
+
+In order to do this within ruby_odata, you can use the `navigate` method of the `QueryBuilder` to drill-down into the Navigation Property. This will allow you to perform `filter`s, `skip`s, `orderby`s, etc. against the children.
+
+ svc = OData::Service.new("http://odata.netflix.com/Catalog")
+ svc.Genres("'Horror Movies'").navigate("Titles").filter("Name eq 'Halloween'")
+ movies = svc.execute
+ movies.each { |m| puts m.Name }
+
### Count
Sometimes all you want to do is count records, for that, you can use the `count` method.
This method can be combined with other options, such as `filter` but cannot be combined with the `links` method.
Please sign in to comment.
Something went wrong with that request. Please try again.