README.md in twitter-5.1.1 vs README.md in twitter-5.2.0
- old
+ new
@@ -23,13 +23,13 @@
recommended that you verify the signature. To do this, you need to add my
public key as a trusted certificate (you only need to do this once):
gem cert --add <(curl -Ls https://raw.github.com/sferik/twitter/master/certs/sferik.pem)
-Then, install the gem with the high security trust policy:
+Then, install the gem with the medium security trust policy:
- gem install twitter -P HighSecurity
+ gem install twitter -P MediumSecurity
## CLI
Looking for the Twitter command-line interface? It was [removed][] from this
gem in version 0.5.0 and now exists as a [separate project][t].
@@ -40,10 +40,15 @@
## Documentation
[http://rdoc.info/gems/twitter][documentation]
[documentation]: http://rdoc.info/gems/twitter
+## Examples
+[https://github.com/sferik/twitter/tree/master/examples][examples]
+
+[examples]: https://github.com/sferik/twitter/tree/master/examples
+
## Announcements
You should [follow @gem][follow] on Twitter for announcements and updates about
this library.
[follow]: https://twitter.com/gem
@@ -118,45 +123,50 @@
**Stream mentions of coffee or tea**
```ruby
topics = ["coffee", "tea"]
-client.filter(:track => topics.join(",")) do |tweet|
- puts tweet.text
+client.filter(:track => topics.join(",")) do |object|
+ puts object.text if object.is_a?(Twitter::Tweet)
end
```
**Stream a random sample of all tweets**
```ruby
-client.sample do |tweet|
- puts tweet.text
+client.sample do |object|
+ puts object.text if object.is_a?(Twitter::Tweet)
end
```
-**Stream tweets, events and direct messages for the authenticated user**
+**Stream tweets, events, and direct messages for the authenticated user**
```ruby
-client.user do |message|
- puts message
+client.user do |object|
+ case object
+ when Twitter::Tweet
+ puts "It's a tweet!"
+ when Twitter::DirectMessage
+ puts "It's a direct message!"
+ when Twitter::Streaming::StallWarning
+ warn "Falling behind!"
+ end
end
```
-`message` can be one of
- + Twitter::Tweet
- + Twitter::DirectMessage
- + Twitter::Streaming::Event
- + Twitter::Streaming::FriendList
+An `object` may be one of the following:
+* Twitter::DirectMessage
+* Twitter::Streaming::DeletedTweet
+* Twitter::Streaming::Event
+* Twitter::Streaming::FriendList
+* Twitter::Streaming::StallWarning
+* Twitter::Tweet
-[messages]: https://dev.twitter.com/docs/streaming-apis/messages
-
### Cursors
The `Twitter::Cursor` class has been completely redesigned with a focus on
simplicity and performance.
-[cursors]: https://dev.twitter.com/docs/misc/cursoring
-
<table>
<thead>
<tr>
<th>Notes</th>
<th colspan="2">Version 4</th>
@@ -498,17 +508,17 @@
```ruby
client.user("gem")
client.user(213747670)
```
-**Fetch a cursored list of followers with profile details (by screen name or user ID, or by implict authenticated user)**
+**Fetch a cursored list of followers with profile details (by screen name or user ID, or by implicit authenticated user)**
```ruby
client.followers("gem")
client.followers(213747670)
client.followers
```
-**Fetch a cursored list of friends with profile details (by screen name or user ID, or by implict authenticated user)**
+**Fetch a cursored list of friends with profile details (by screen name or user ID, or by implicit authenticated user)**
```ruby
client.friends("gem")
client.friends(213747670)
client.friends