twitter_oauth 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile CHANGED
@@ -80,3 +80,48 @@ client = TwitterOAuth::Client.new(
80
80
  client.authorized?
81
81
  => true
82
82
  </code></pre>
83
+
84
+ h2. Working with a Proxy
85
+
86
+ Services such as "Apigee Analytics and API Management":http://apigee.com/ require you to proxy your API requests through their servers. The workflow is as follows.
87
+
88
+ First you need to authorize the Twitter user via OAuth directly via the Twitter API (this part cannot be proxied)
89
+
90
+ <pre><code>client = TwitterOAuth::Client.new(
91
+ :consumer_key => 'YOUR_APP_CONSUMER_KEY',
92
+ :consumer_secret => 'YOURA_APP_CONSUMER_SECRET'
93
+ )
94
+ request_token = client.request_token(:oauth_callback => 'YOUR_CALLBACK_URL')
95
+
96
+ request_token.authorize_url
97
+ => http://twitter.com/oauth/authorize?oauth_token=TOKEN
98
+ </code></pre>
99
+
100
+ The user is sent to Twitter to allow the application to access their account and then you need to obtain the access token for the user
101
+
102
+ <pre><code>access_token = client.authorize(
103
+ request_token.token,
104
+ request_token.secret,
105
+ :oauth_verifier => params[:oauth_verifier]
106
+ )
107
+
108
+ client.authorized?
109
+ => true
110
+ </code></pre>
111
+
112
+ Now you can make all further API calls through the proxy of your choice:
113
+
114
+ <pre><code>access_token = @user.access_token # assuming @user
115
+ client = TwitterOAuth::Client.new(
116
+ :proxy => 'http://XXX.YYY.apigee.com',
117
+ :consumer_key => 'YOUR_CONSUMER_KEY',
118
+ :consumer_secret => 'YOUR-CONSUMER-SECRET',
119
+ :token => access_token.token,
120
+ :secret => access_token.secret
121
+ )
122
+
123
+ client.authorized?
124
+ => true
125
+
126
+ client.update('Proxy via Apigee is working')
127
+ </code></pre>
data/lib/twitter_oauth.rb CHANGED
@@ -5,5 +5,5 @@ require 'mime/types'
5
5
  require 'twitter_oauth/client'
6
6
 
7
7
  module TwitterOAuth
8
- VERSION = '0.4.0'
8
+ VERSION = '0.4.3'
9
9
  end
@@ -21,5 +21,10 @@ module TwitterOAuth
21
21
  post("/statuses/retweet/#{id}.json")
22
22
  end
23
23
 
24
+ # Returns the 100 most recent retweets of the tweet.
25
+ def retweets(id)
26
+ get("/statuses/retweets/#{id}.json")
27
+ end
28
+
24
29
  end
25
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-07-10 00:00:00 +01:00
12
+ date: 2010-08-11 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency