README.md in hullio-0.2.1 vs README.md in hullio-0.3.0
- old
+ new
@@ -22,10 +22,12 @@
c.app_id = "your-app-id"
c.app_secret = "your-app-secret"
c.org_url = "http://ORG-NAMESPACE.hullapp.io"
end
+In Rails, you can include this in an initializer.
+
### Making API Calls
`get`, `put`, `post` and `delete` methods are directly available on Hull.
examples:
@@ -44,10 +46,41 @@
Hull.get('entity', { uid: 'http://example.com' })
Hull.put('entity', { uid: 'http://example.com', name: 'My super Page' })
Hull.delete('entity', { uid: 'http://example.com' })
-### Compiling widgets and tempaltes with Rails' Assets Pipeline
+### Making API calls as as a User
+
+From its user ID
+
+ Hull.as('51fa7afd09e50d11f1000002').get('me')
+
+From a user UID
+
+ Hull.as('twitter:hull').get('me')
+ Hull.as('external:3637').get('me')
+
+
+
+### Getting the current User
+
+Hull.authenticate_user allows you to get the current User's ID.
+
+#### Rails
+
+
+ class MyController < ApplicationController
+ def current_hull_user_id
+ @current_hull_user_id ||= Hull.authenticate_user(request.env)
+ end
+ def current_hull_user
+ // You probably should cache this or record this information in a session
+ // to avoid making calls to Hull's API on each request
+ @current_hull_user ||= Hull.get(current_hull_user_id)
+ end
+ end
+
+### Compiling widgets and templates with Rails' Assets Pipeline
Load `handlebars_assets` in your Gemfile as part of the assets group
group :assets do
gem 'handlebars_assets'