README.md in yammer-client-0.1.0 vs README.md in yammer-client-0.1.1
- old
+ new
@@ -1,9 +1,16 @@
Yammer Client
=============
+[![GemVersion](https://badge.fury.io/rb/yammer-client.png)][gemversion]
+[![Build Status](https://travis-ci.org/tiabas/yammer-client.png?branch=master)][travis]
+[![Coverage Status](https://coveralls.io/repos/tiabas/yammer-client/badge.png?branch=master)][coveralls]
+[![Dependency Status](https://gemnasium.com/tiabas/yammer-client.png)][gemnasium]
-[![Build Status](https://travis-ci.org/tiabas/yammer-client.png?branch=master)](https://travis-ci.org/tiabas/yammer-client)
+[gemversion]: (http://badge.fury.io/rb/yammer-client)
+[travis]: (https://travis-ci.org/tiabas/yammer-client)
+[coveralls]: (https://coveralls.io/r/tiabas/yammer-client)
+[gemnasium]: https://gemnasium.com/tiabas/yammer-client
A Yammer Ruby gem
## Documentation
@@ -86,32 +93,29 @@
```ruby
require 'yammer'
Yammer.options
-
-# => {:site_url=>"https://www.yammer.com", :client_id=>nil, :client_secret=>nil, :access_token=>nil, :http_adapter=>Yammer::HttpConnection, :connection_options=>{:max_redirects=>5, :use_ssl=>true}}
+#> {:site_url=>"https://www.yammer.com", :client_id=>nil, :client_secret=>nil, :access_token=>nil, :http_adapter=>Yammer::HttpConnection, :connection_options=>{:max_redirects=>5, :use_ssl=>true}}
```
You may change this configuration by using the `configure` method
```ruby
Yammer.configure do |c|
c.client_id = '[client_id]'
c.client_secret = '[client_secret]'
c.token = '[access_token]'
end
-
-# => Yammer
+#> Yammer
```
At this point, your new settings will take effect
```ruby
Yammer.options
-
-# => {:site_url=>"https://www.yammer.com", :client_id=>'[client_id]', :client_secret=>'[client_secret]', :access_token=>'[access_token]', :http_adapter=>Yammer::HttpConnection, :connection_options=>{ :max_redirects=>5, :use_ssl=>true }}
+#> {:site_url=>"https://www.yammer.com", :client_id=>'[client_id]', :client_secret=>'[client_secret]', :access_token=>'[access_token]', :http_adapter=>Yammer::HttpConnection, :connection_options=>{ :max_redirects=>5, :use_ssl=>true }}
```
## Usage
`yammer-client` provides two ways to access Yammer's API. One of these ways is by using HTTP helper methods on and instance of `Yammer::Client`. The other
@@ -135,58 +139,68 @@
*find a user by email*
```ruby
yamr.get_user_by_email('user@example.com')
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
*find a user by user id*
```ruby
yamr.get_user('1588')
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
*get the current user*
```ruby
yamr.current_user
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
**Message**
*post a update as the current user*
```ruby
yamr.create_message(:body => 'status update')
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
*send a private message to another Yammer user*
```ruby
yamr.create_message(:body => 'private message', :direct_to_id => 24)
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
*send a message with an Open Graph Object as an attachment*
```ruby
yamr.create_message(:body => 'here is my open graph object', og_url: "https://www.yammer.com/example/graph/31415926")
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
**Search**
*search for a term within the context of current user*
```ruby
yamr.search(:search => 'thekev', :model_types => 'users;groups')
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
**Thread**
+
*fetch a thread with a given id*
+
```ruby
yamr.get_thread(42, :model_types => 'users;groups')
+#<Yammer::Response:0x007fb949434ec8 @headers=#<Net::HTTPOK 200 OK readbody=true>, @body="[JSON Response]", @code=200>
```
### Using the object models
@@ -199,54 +213,50 @@
*get the current user*
```ruby
u = Yammer::User.current
+#> <Yammer::User:0x007f9f4b0c39c8>
-#=> #<Yammer::User:0x007f9f4b0c39c8>
-
u.full_name
+#> 'Kevin Mutyaba'
-#=> 'Kevin Mutyaba'
-
u.update!(:job_title => 'k0dR')
-
```
**Thread**
*fetch a thread with a given id*
```ruby
-
t = Yammer::Thread.get(3)
# view the participants in the thread
parts = t.participants
-#=> [{:type=>"user", :id=>18}, {:type=>"user", :id=>64}]
+#> [{:type=>"user", :id=>18}, {:type=>"user", :id=>64}]
# view the participants in the thread as user object models
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>]
+#> [#<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
peepl[0]
-#=> #<Yammer::User:0x007f9f4c086568 @modified_attributes={}, @attrs={}, @new_record=false, @id=18>
+#> #<Yammer::User:0x007f9f4c086568 @modified_attributes={}, @attrs={}, @new_record=false, @id=18>
# calling an accessor on a model will hydrate it
peepl[0].permalink
-#=> 'thekev'
+#> 'thekev'
peepl[0]
-#=> #<Yammer::User:0x007f9f4c086630 @modified_attributes={}, @attrs={:last_name=>"Mutyaba", :network_id=>1, :first_name=>"Kevin", :id => 18, :permalink=>"thekev" }, @network_id=1, @first_name="Kev", @full_name="Tiaba", @permalink="thekev", @id=18 >
+#=> #<Yammer::User:0x007f9f4c086568 @modified_attributes={}, @attrs={:last_name=>"Mutyaba", :network_id=>1, :first_name=>"Kevin", :id => 18, :permalink=>"thekev" }, @network_id=1, @first_name="Kev", @full_name="Tiaba", @permalink="thekev", @id=18 >
```
## Supported Ruby Versions
This library aims to support and is [tested against][travis] the following Ruby
version:
@@ -260,6 +270,6 @@
above.
## Copyright
Copyright (c) 2013 Kevin Mutyaba
See [LICENSE][license] for details.
-[license]: https://github.com/tiabas/yammer-client/blob/master/LICENSE.md
\ No newline at end of file
+[license]: https://github.com/tiabas/yammer-client/blob/master/LICENSE.md