README.md in yammer-client-0.1.1 vs README.md in yammer-client-0.1.2

- old
+ new

@@ -12,13 +12,15 @@ A Yammer Ruby gem ## Documentation +This README provides only a basic overview of how to use this gem.For more information about the API endpoints and helper methods available, look at the rdoc documentation. + [http://rdoc.info/github/tiabas/yammer-client][documentation] -[documentation]: http://rdoc.info/github/tiabas/yammer-client +[documentation]: http://rdoc.info/github/tiabas/yammer-client/index ## Installation Add this line to your application's Gemfile: @@ -39,24 +41,16 @@ $ gem install yammer-client ``` ## Configuration -The Yammer API requires authentication for access to certain endpoints. Below are the basic steps to get this done. For more information, take a look at Yammer's Developer Guide <http://developer.yammer.com/files/2012/10/PlatformDeveloperGuide.pdf> +The Yammer API requires authentication for access to certain endpoints. Below are the basic steps to get this done. - ### Register your application -1. Sign in to Yammer +Setup a Yammer client application as described in [Build your first Yammer App](https://developer.yammer.com/introduction/) -2. Go to `https://www.yammer.com/client_applications` - -3. Click on 'Register New App' and fill out the registration form - -4. Make note of your client_id and client_secret they will be needed for token authorization - - ### Obtaining an access token 1. Construct the following URL using the client_id you received `https://www.yammer.com/dialog/oauth?client_id=[:client_id]` 2. Have your users follow the URL you constructed above to allow your application to access their data @@ -195,19 +189,18 @@ **Thread** *fetch a thread with a given id* ```ruby -yamr.get_thread(42, :model_types => 'users;groups') +yamr.get_thread(42) #<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200> ``` -### Using the object models +### Using the object models (Experimental) -Object models are classes that take away the hussle of having to deal with parsing the JSON that Yammer returns for -any given request. Each model has accessor metods for all keys contained in the JSON response for a given model type. +The object model is an abstraction that makes it easy to manipulate the JSON data return when accessing Yammer's API. Each model has accessor methods for all keys contained in the JSON response for a given model type. **User** *get the current user* @@ -228,28 +221,30 @@ *fetch a thread with a given id* ```ruby t = Yammer::Thread.get(3) +``` -# view the participants in the thread +View the participants in the thread +```ruby parts = t.participants #> [{:type=>"user", :id=>18}, {:type=>"user", :id=>64}] +``` +View the participants in the thread as user object models -# view the participants in the thread as user object models - +```ruby peepl = t.people #> [#<Yammer::User:0x007f9f4c086630 @modified_attributes={}, @attrs={}, @new_record=false, @id=18>, #<Yammer::User:0x007f9f4c086568 @modified_attributes={}, @attrs={}, @new_record=false, @id=64>] +``` +Object models are lazyly loaded. Calling an accessor on a model will hydrate it -# object models are lazyly loaded - +```ruby peepl[0] #> #<Yammer::User:0x007f9f4c086568 @modified_attributes={}, @attrs={}, @new_record=false, @id=18> - -# calling an accessor on a model will hydrate it peepl[0].permalink #> 'thekev' peepl[0]