rest-graph 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,20 @@
1
1
  = rest-graph changes history
2
2
 
3
+ == rest-graph 1.4.0 -- ?
4
+
5
+ Changes only for RailsUtil, the core (rest-graph.rb) is pretty stable for now.
6
+
7
+ * Internal code rearrangement.
8
+ * Removed url_for helper, it's too hard to do it right.
9
+ * Removed @fb_sig_in_canvas hack.
10
+ * Added rest_graph method in helper.
11
+ * Fixed a bug that logging redirect but not really do direct.
12
+ * Now passing :auto_authorize_scope implies :auto_authorize => true.
13
+ * Now :canvas option takes the name of canvas, instead of a boolean.
14
+ * Now :auto_authorize default to false.
15
+ * Now :auto_authorize_scope default to nothing.
16
+ * Now there's :write_session option to save fbs in session, default to false.
17
+
3
18
  == rest-graph 1.3.0 -- 2010-06-11
4
19
  * Now rest-graph is rescuing all exceptions from rest-client.
5
20
  * Added RestGraph#exchange_sessions to exchange old sessions to access tokens.
data/README ADDED
@@ -0,0 +1,252 @@
1
+ = rest-graph 1.3.0
2
+ by Cardinal Blue ( http://cardinalblue.com )
3
+
4
+ == LINKS:
5
+
6
+ * {github}[http://github.com/cardinalblue/rest-graph]
7
+ * {rubygems}[http://rubygems.org/gems/rest-graph]
8
+ * {rdoc}[http://rdoc.info/projects/cardinalblue/rest-graph]
9
+ * {mailing list}[http://groups.google.com/group/rest-graph/topics]
10
+
11
+ == DESCRIPTION:
12
+
13
+ A super simple Facebook Open Graph API client
14
+
15
+ == FEATURES:
16
+
17
+ * Simple Graph API call
18
+ * Simple FQL call
19
+ * Utility to extract access_token and check sig in cookies
20
+
21
+ == QUICK START:
22
+
23
+ # In typical use, here's how you use RestGraph. Note that the syntax follows
24
+ # closely to the Graph API URL syntax, making it easy to use. First, suppose
25
+ # that you already have an access_token, represented by TOKEN:
26
+
27
+ require 'rest-graph'
28
+ rg = RestGraph.new(:access_token => TOKEN)
29
+
30
+ # GET https://graph.facebook.com/me?access_token=TOKEN
31
+ rg.get('me')
32
+
33
+ # GET https://graph.facebook.com/me/likes?access_token=TOKEN
34
+ rg.get('me/likes')
35
+
36
+ # GET https://graph.facebook.com/search?q=taiwan&access_token=TOKEN
37
+ rg.get('search', :q => 'taiwan')
38
+
39
+
40
+ # Next, we explain how to use RestGraph to obtain the access token
41
+
42
+ # If you are using Rails, we recommend that you include a module
43
+ # called RailsUtil into your controllers, which will configure RestGraph.
44
+ # (Your code contributions for other Ruby frameworks would be appreciated!)
45
+ # There is an option in RailsUtil called "auto_authorize" which will cause
46
+ # RestGraph to automatically redirect the user to the authorization page if
47
+ # the access token is unavailable or has expired. (This way, you don't have
48
+ # to check if the token is expired or not.)
49
+
50
+ # Here is an example:
51
+
52
+ class UserController < ApplicationController
53
+ include RestGraph::RailsUtil
54
+ before_filter :filter_rest_graph_setup
55
+
56
+ def index
57
+ # rest_graph_setup provides rest_graph as a RestGraph instance
58
+ @profile = rest_graph.get('me')
59
+ end
60
+
61
+ # your code
62
+
63
+ private
64
+ def filter_rest_graph_setup
65
+ # Please see RestGraph::RailsUtil#rest_graph_options for all options.
66
+ rest_graph_setup(:auto_authorize_scope => 'publish_stream,email',
67
+ :app_id => '123',
68
+ :canvas => RestGraph.default_canvas)
69
+ end
70
+ end
71
+
72
+
73
+ # You might wonder how do we setup app_id, secret, and other stuffs?
74
+ # You could pass them in rest_graph_setup(:app_id => 1234), or setup
75
+ # in a config YAML file. Here's a config example:
76
+ {rest-graph.yaml}[http://github.com/cardinalblue/rest-graph/blob/master/test/config/rest-graph.yaml]
77
+ # For a QUICK START, we recommend that put this config file under
78
+ # config/rest-graph.yaml and require 'rest-graph/auto_load' to automatically
79
+ # load the config to setup default values for RestGraph in your application.
80
+ # in Rails 2.x, you might want to add this line into config/environment.rb:
81
+
82
+ config.gem 'rest-graph', :lib => 'rest-graph/auto_load'
83
+
84
+ # While for bundler, you might want to add this line into Gemfile:
85
+
86
+ gem 'rest-graph', :require => 'rest-graph/auto_load'
87
+
88
+ == SYNOPSIS:
89
+
90
+ # Here are ALL the available options for new instance of RestGraph.
91
+ # All options are optional:
92
+
93
+ rg = RestGraph.new(:access_token => TOKEN,
94
+ :graph_server => 'https://graph.facebook.com/',
95
+ :old_server => 'https://api.facebook.com/',
96
+ :accept => 'text/javascript',
97
+ :lang => 'en-us', # this affect search
98
+ :auto_decode => true , # decode by json
99
+ :app_id => '123' ,
100
+ :secret => '1829' ,
101
+
102
+ # This handler callback is only called if auto_decode is set to true,
103
+ # otherwise, it's ignored.
104
+ :error_handler =>
105
+ lambda{ |hash| raise ::RestGraph::Error.new(hash) },
106
+
107
+ # You might want to do this in Rails to do debug logging:
108
+ :log_handler =>
109
+ lambda{ |duration, url|
110
+ Rails.logger.debug("RestGraph " \
111
+ "spent #{duration} " \
112
+ "requesting #{url}")
113
+ })
114
+
115
+
116
+ # API calls:
117
+
118
+ # GET https://graph.facebook.com/me?access_token=TOKEN
119
+ rg.get('me')
120
+
121
+ # GET https://graph.facebook.com/me?metadata=1&access_token=TOKEN
122
+ rg.get('me', :metadata => '1')
123
+
124
+ # POST https://graph.facebook.com/me/feed?message=bread%21&access_token=tok
125
+ rg.post('me/feed', :message => 'bread!')
126
+
127
+ == UTILITY FUNCTIONS:
128
+
129
+ # If you have the session in the cookies,
130
+ # then RestGraph can parse the cookies:
131
+ rg.parse_cookies!(cookies) # auto save access_token if sig is correct
132
+ rg.data['uid'] # => facebook uid
133
+
134
+ # If you're writing a Rack application, you might want to parse
135
+ # the session directly from Rack env:
136
+ rg.parse_rack_env!(env) # auto save access_token if sig is correct
137
+ rg.data['uid'] # => facebook uid
138
+
139
+ # The following method yields the redirect URL for authorizing
140
+ # https://graph.facebook.com/oauth/authorize?client_id=123&
141
+ # redirect_uri=http%3A%2F%2Fw3.org%2F
142
+ rg.authorize_url(:redirect_uri => 'http://w3.org/', :scope => 'email')
143
+
144
+ # The following method makes a call to Facebook to convert
145
+ # the authorization "code" into an access token:
146
+ # https://graph.facebook.com/oauth/access_token?code=CODE&
147
+ # client_id=123&redirect_uri=http%3A%2F%2Fw3.org%2F&
148
+ # client_secret=1829
149
+ rg.authorize!(:redirect_uri => 'http://w3.org/', :code => 'CODE')
150
+ rg.access_token # your access_token is now available
151
+ rg.data['expires'] # other values are available in data
152
+
153
+ # The following method takes a session key from the old REST API
154
+ # (non-Graph API) and converts to an access token:
155
+ # https://graph.facebook.com/oauth/exchange_sessions?sessions=SESSION
156
+ params[:fb_sig_session_key] # => SESSION
157
+ rg.exchange_sessions(:sessions => params[:fb_sig_session_key])
158
+
159
+ # The following method allows for an arbitrary FQL query to made
160
+ # GET https://api.facebook.com/method/fql.query?query=
161
+ # SELECT+name+FROM+page+WHERE+page_id%3D%22123%22&
162
+ # format=json&access_token=tok
163
+ rg.fql('SELECT name FROM page WHERE page_id="123"')
164
+
165
+ # The following method allows for multiple FQL query to made
166
+ # http://developers.facebook.com/docs/reference/rest/fql.multiquery
167
+ # GET https://api.facebook.com/method/fql.multiquery?query=
168
+ # %7BSELECT+name+FROM+page+WHERE+page_id%3D%22123%22&%2C
169
+ # SELECT+name+FROM+page+WHERE+page_id%3D%22456%22&%7D
170
+ # format=json&access_token=tok
171
+ rg.fql_multi(:q1 => 'SELECT name FROM page WHERE page_id="123"',
172
+ :q2 => 'SELECT name FROM page WHERE page_id="456"')
173
+
174
+ # The following method makes it possible to call functionality
175
+ # from Facebook's old REST API:
176
+ rg.old_rest(
177
+ 'stream.publish',
178
+ { :message => 'Greetings',
179
+ :attachment => {:name => 'Wikipedia',
180
+ :href => 'http://wikipedia.org/',
181
+ :caption => 'Wikipedia says hi.',
182
+ :media => [{:type => 'image',
183
+ :src => 'http://wikipedia.org/favicon.ico',
184
+ :href => 'http://wikipedia.org/'}]
185
+ }.to_json,
186
+ :action_links => [{:text => 'Go to Wikipedia',
187
+ :href => 'http://wikipedia.org/'}
188
+ ].to_json
189
+ },
190
+ :suppress_decode => true) # You'll need to set suppress_decode to true
191
+ # if Facebook is not returning a proper JSON
192
+ # response. Otherwise, this could be omitted.
193
+
194
+ # Here are 3 possible ways to set up the default settings:
195
+
196
+ # (1) set it directly
197
+ module MyDefaults
198
+ def default_app_id
199
+ '456'
200
+ end
201
+
202
+ def default_secret
203
+ 'category theory'
204
+ end
205
+ end
206
+ RestGraph.send(:extend, MyDefaults)
207
+
208
+ # or (2) Load defaults from a YAML config file:
209
+ require 'rest-graph/load_config'
210
+ RestGraph::LoadConfig.load_config!('path/to/rest-graph.yaml', 'development')
211
+
212
+ RestGraph.new # app_id would be 456
213
+ RestGraph.new(:app_id => '123') # defaults could be overridden
214
+
215
+ # or (3) Load config automatically
216
+ require 'rest-graph/auto_load' # under Rails, load config/rest-graph.yaml
217
+
218
+ # Please read:
219
+ {rest-graph.yaml}[http://github.com/cardinalblue/rest-graph/blob/master/test/config/rest-graph.yaml]
220
+ # for an example of config file.
221
+
222
+ == REQUIREMENTS:
223
+
224
+ * Tested with MRI 1.8.7 and 1.9.1
225
+ * gem install rest-client
226
+ * gem install json (optional)
227
+ * gem install json_pure (optional)
228
+ * gem install rack (optional, to parse access_token in HTTP_COOKIE)
229
+
230
+ == INSTALL:
231
+
232
+ > gem install rest-graph
233
+ # or if you want rails plugin and bleeding edge
234
+ > script/plugin install git://github.com/cardinalblue/rest-graph.git
235
+
236
+ == LICENSE:
237
+
238
+ Apache License 2.0
239
+
240
+ Copyright (c) 2010, Cardinal Blue
241
+
242
+ Licensed under the Apache License, Version 2.0 (the "License");
243
+ you may not use this file except in compliance with the License.
244
+ You may obtain a copy of the License at
245
+
246
+ http://www.apache.org/licenses/LICENSE-2.0
247
+
248
+ Unless required by applicable law or agreed to in writing, software
249
+ distributed under the License is distributed on an "AS IS" BASIS,
250
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
251
+ See the License for the specific language governing permissions and
252
+ limitations under the License.
data/README.rdoc CHANGED
@@ -18,15 +18,79 @@ by Cardinal Blue ( http://cardinalblue.com )
18
18
  * Simple FQL call
19
19
  * Utility to extract access_token and check sig in cookies
20
20
 
21
- == SYNOPSIS:
21
+ == QUICK START:
22
22
 
23
- # If you feel SYNOPSIS is so hard to understand, please read
24
- # {examples}[http://github.com/cardinalblue/rest-graph/tree/master/example].
23
+ # In typical use, here's how you use RestGraph. Note that the syntax follows
24
+ # closely to the Graph API URL syntax, making it easy to use. First, suppose
25
+ # that you already have an access_token, represented by TOKEN:
25
26
 
26
27
  require 'rest-graph'
28
+ rg = RestGraph.new(:access_token => TOKEN)
29
+
30
+ # GET https://graph.facebook.com/me?access_token=TOKEN
31
+ rg.get('me')
32
+
33
+ # GET https://graph.facebook.com/me/likes?access_token=TOKEN
34
+ rg.get('me/likes')
35
+
36
+ # GET https://graph.facebook.com/search?q=taiwan&access_token=TOKEN
37
+ rg.get('search', :q => 'taiwan')
38
+
39
+
40
+ # Next, we explain how to use RestGraph to obtain the access token
41
+
42
+ # If you are using Rails, we recommend that you include a module
43
+ # called RailsUtil into your controllers, which will configure RestGraph.
44
+ # (Your code contributions for other Ruby frameworks would be appreciated!)
45
+ # There is an option in RailsUtil called "auto_authorize" which will cause
46
+ # RestGraph to automatically redirect the user to the authorization page if
47
+ # the access token is unavailable or has expired. (This way, you don't have
48
+ # to check if the token is expired or not.)
49
+
50
+ # Here is an example:
51
+
52
+ class UserController < ApplicationController
53
+ include RestGraph::RailsUtil
54
+ before_filter :filter_rest_graph_setup
55
+
56
+ def index
57
+ # rest_graph_setup provides rest_graph as a RestGraph instance
58
+ @profile = rest_graph.get('me')
59
+ end
60
+
61
+ # your code
62
+
63
+ private
64
+ def filter_rest_graph_setup
65
+ # Please see RestGraph::RailsUtil#rest_graph_options for all options.
66
+ rest_graph_setup(:auto_authorize_scope => 'publish_stream,email',
67
+ :app_id => '123',
68
+ :canvas => RestGraph.default_canvas)
69
+ end
70
+ end
71
+
72
+
73
+ # You might wonder how do we setup app_id, secret, and other stuffs?
74
+ # You could pass them in rest_graph_setup(:app_id => 1234), or setup
75
+ # in a config YAML file. Here's a config example:
76
+ {rest-graph.yaml}[http://github.com/cardinalblue/rest-graph/blob/master/test/config/rest-graph.yaml]
77
+ # For a QUICK START, we recommend that put this config file under
78
+ # config/rest-graph.yaml and require 'rest-graph/auto_load' to automatically
79
+ # load the config to setup default values for RestGraph in your application.
80
+ # in Rails 2.x, you might want to add this line into config/environment.rb:
27
81
 
28
- # Every option is optional.
29
- rg = RestGraph.new(:access_token => 'tok',
82
+ config.gem 'rest-graph', :lib => 'rest-graph/auto_load'
83
+
84
+ # While for bundler, you might want to add this line into Gemfile:
85
+
86
+ gem 'rest-graph', :require => 'rest-graph/auto_load'
87
+
88
+ == SYNOPSIS:
89
+
90
+ # Here are ALL the available options for new instance of RestGraph.
91
+ # All options are optional:
92
+
93
+ rg = RestGraph.new(:access_token => TOKEN,
30
94
  :graph_server => 'https://graph.facebook.com/',
31
95
  :old_server => 'https://api.facebook.com/',
32
96
  :accept => 'text/javascript',
@@ -35,12 +99,12 @@ by Cardinal Blue ( http://cardinalblue.com )
35
99
  :app_id => '123' ,
36
100
  :secret => '1829' ,
37
101
 
38
- # This handler callback is only called if auto_decode is set to true,
39
- # otherwise, it's ignored.
102
+ # This handler callback is only called if auto_decode is set to true,
103
+ # otherwise, it's ignored.
40
104
  :error_handler =>
41
105
  lambda{ |hash| raise ::RestGraph::Error.new(hash) },
42
106
 
43
- # You might want to do this in Rails to do debug logging:
107
+ # You might want to do this in Rails to do debug logging:
44
108
  :log_handler =>
45
109
  lambda{ |duration, url|
46
110
  Rails.logger.debug("RestGraph " \
@@ -48,54 +112,88 @@ by Cardinal Blue ( http://cardinalblue.com )
48
112
  "requesting #{url}")
49
113
  })
50
114
 
51
- # You might want to do redirect instead of raising an exception,
52
- # that is automatically redirect the user to authorization page
53
- # if the access token is unavailable. This way, you don't have to
54
- # check if the token is expired or not. If the token is expired,
55
- # it will automatically do authorization again. For that purpose,
56
- # you might want to include RestGraph::RailsUtil in your Rails'
57
- # controller. For example:
58
- class UserController < ApplicationController
59
- include RestGraph::RailsUtil
60
- before_filter :rest_graph_setup
61
- end
62
- # Please read:
63
- # {examples}[http://github.com/cardinalblue/rest-graph/tree/master/example].
64
- # for more detail, and other frameworks utils wanted!
65
115
 
66
- # Other simple API call:
67
- rg.get('me') # GET https://graph.facebook.com/me?access_token=tok
68
- rg.get('4/likes') # GET https://graph.facebook.com/4/likes?access_token=tok
116
+ # API calls:
69
117
 
70
- # GET https://graph.facebook.com/search?q=taiwan&access_token=tok
71
- rg.get('search', :q => 'taiwan')
118
+ # GET https://graph.facebook.com/me?access_token=TOKEN
119
+ rg.get('me')
72
120
 
73
- # GET https://graph.facebook.com/me?metadata=1&access_token=tok
121
+ # GET https://graph.facebook.com/me?metadata=1&access_token=TOKEN
74
122
  rg.get('me', :metadata => '1')
75
123
 
76
124
  # POST https://graph.facebook.com/me/feed?message=bread%21&access_token=tok
77
125
  rg.post('me/feed', :message => 'bread!')
78
126
 
79
- # For fully blown cookies hash
80
- rg = RestGraph.new(:app_id => '123', :secret => '1829')
81
- rg.parse_cookies!(cookies) # auto save access_token if sig checked
127
+ == UTILITY FUNCTIONS:
128
+
129
+ # If you have the session in the cookies,
130
+ # then RestGraph can parse the cookies:
131
+ rg.parse_cookies!(cookies) # auto save access_token if sig is correct
82
132
  rg.data['uid'] # => facebook uid
83
133
 
84
- # FQL query, same as:
134
+ # If you're writing a Rack application, you might want to parse
135
+ # the session directly from Rack env:
136
+ rg.parse_rack_env!(env) # auto save access_token if sig is correct
137
+ rg.data['uid'] # => facebook uid
138
+
139
+ # The following method yields the redirect URL for authorizing
140
+ # https://graph.facebook.com/oauth/authorize?client_id=123&
141
+ # redirect_uri=http%3A%2F%2Fw3.org%2F
142
+ rg.authorize_url(:redirect_uri => 'http://w3.org/', :scope => 'email')
143
+
144
+ # The following method makes a call to Facebook to convert
145
+ # the authorization "code" into an access token:
146
+ # https://graph.facebook.com/oauth/access_token?code=CODE&
147
+ # client_id=123&redirect_uri=http%3A%2F%2Fw3.org%2F&
148
+ # client_secret=1829
149
+ rg.authorize!(:redirect_uri => 'http://w3.org/', :code => 'CODE')
150
+ rg.access_token # your access_token is now available
151
+ rg.data['expires'] # other values are available in data
152
+
153
+ # The following method takes a session key from the old REST API
154
+ # (non-Graph API) and converts to an access token:
155
+ # https://graph.facebook.com/oauth/exchange_sessions?sessions=SESSION
156
+ params[:fb_sig_session_key] # => SESSION
157
+ rg.exchange_sessions(:sessions => params[:fb_sig_session_key])
158
+
159
+ # The following method allows for an arbitrary FQL query to made
85
160
  # GET https://api.facebook.com/method/fql.query?query=
86
- # SELECT+name+FROM+page+WHERE+page_id%3D%22123%22&
87
- # format=json&access_token=...
161
+ # SELECT+name+FROM+page+WHERE+page_id%3D%22123%22&
162
+ # format=json&access_token=tok
88
163
  rg.fql('SELECT name FROM page WHERE page_id="123"')
89
164
 
90
- # FQL multiquery, same as:
165
+ # The following method allows for multiple FQL query to made
166
+ # http://developers.facebook.com/docs/reference/rest/fql.multiquery
91
167
  # GET https://api.facebook.com/method/fql.multiquery?query=
92
- # %7BSELECT+name+FROM+page+WHERE+page_id%3D%22123%22&%2C
93
- # SELECT+name+FROM+page+WHERE+page_id%3D%22456%22&%7D
94
- # format=json&access_token=...
168
+ # %7BSELECT+name+FROM+page+WHERE+page_id%3D%22123%22&%2C
169
+ # SELECT+name+FROM+page+WHERE+page_id%3D%22456%22&%7D
170
+ # format=json&access_token=tok
95
171
  rg.fql_multi(:q1 => 'SELECT name FROM page WHERE page_id="123"',
96
172
  :q2 => 'SELECT name FROM page WHERE page_id="456"')
97
173
 
98
- # Setup default settings:
174
+ # The following method makes it possible to call functionality
175
+ # from Facebook's old REST API:
176
+ rg.old_rest(
177
+ 'stream.publish',
178
+ { :message => 'Greetings',
179
+ :attachment => {:name => 'Wikipedia',
180
+ :href => 'http://wikipedia.org/',
181
+ :caption => 'Wikipedia says hi.',
182
+ :media => [{:type => 'image',
183
+ :src => 'http://wikipedia.org/favicon.ico',
184
+ :href => 'http://wikipedia.org/'}]
185
+ }.to_json,
186
+ :action_links => [{:text => 'Go to Wikipedia',
187
+ :href => 'http://wikipedia.org/'}
188
+ ].to_json
189
+ },
190
+ :suppress_decode => true) # You'll need to set suppress_decode to true
191
+ # if Facebook is not returning a proper JSON
192
+ # response. Otherwise, this could be omitted.
193
+
194
+ # Here are 3 possible ways to set up the default settings:
195
+
196
+ # (1) set it directly
99
197
  module MyDefaults
100
198
  def default_app_id
101
199
  '456'
@@ -107,48 +205,19 @@ by Cardinal Blue ( http://cardinalblue.com )
107
205
  end
108
206
  RestGraph.send(:extend, MyDefaults)
109
207
 
110
- # Automatically load config:
111
- require 'rest-graph/auto_load' # under Rails, load config/rest-graph.yaml
112
- RestGraph.new # all default options would honor config
113
- RestGraph.new(:app_id => '123') # default could be override as well
114
-
115
- # Manually load config:
208
+ # or (2) Load defaults from a YAML config file:
116
209
  require 'rest-graph/load_config'
117
- RestGraph::LoadConfig.load_config!('path/to/rest-graph.yaml', 'env')
210
+ RestGraph::LoadConfig.load_config!('path/to/rest-graph.yaml', 'development')
118
211
 
119
- # See test/config/rest-graph.yaml for an example for config.
120
-
121
- # OAuth utilites:
122
- # https://graph.facebook.com/oauth/authorize?client_id=123&
123
- RestGraph.new.authorize_url(:redirect_uri => 'http://w3.org/')
212
+ RestGraph.new # app_id would be 456
213
+ RestGraph.new(:app_id => '123') # defaults could be overridden
124
214
 
125
- # Get access token by:
126
- # https://graph.facebook.com/oauth/access_token?code=edoc&
127
- rg = RestGraph.new
128
- rg.authorize!(:redirect_uri => 'http://w3.org/', :code => 'edoc')
129
- rg.access_token # your access_token is now available
130
- rg.data['expires'] # other values as well
131
-
132
- # Exchange old session key for access token:
133
- # https://graph.facebook.com/oauth/exchange_sessions?sessions=...
134
- rg.exchange_sessions(:sessions => params[:fb_sig_session_key])
215
+ # or (3) Load config automatically
216
+ require 'rest-graph/auto_load' # under Rails, load config/rest-graph.yaml
135
217
 
136
- # Call Facebook's old REST API:
137
- rg.old_rest(
138
- 'stream.publish',
139
- { :message => 'Greetings',
140
- :attachment => {:name => 'Wikipedia',
141
- :href => 'http://wikipedia.org/',
142
- :caption => 'Wikipedia says hi.',
143
- :media => [{:type => 'image',
144
- :src => 'http://wikipedia.org/favicon.ico',
145
- :href => 'http://wikipedia.org/'}]
146
- }.to_json,
147
- :action_links => [{:text => 'Go to Wikipedia',
148
- :href => 'http://wikipedia.org/'}
149
- ].to_json
150
- },
151
- :suppress_decode => true)
218
+ # Please read:
219
+ {rest-graph.yaml}[http://github.com/cardinalblue/rest-graph/blob/master/test/config/rest-graph.yaml]
220
+ # for an example of config file.
152
221
 
153
222
  == REQUIREMENTS:
154
223
 
data/TODO CHANGED
@@ -1,4 +1,6 @@
1
1
  = rest-graph todo list
2
2
 
3
+ * test for rails util for writing cookie
4
+
3
5
  * more docs?
4
6
  * more examples?
data/example/rails/README CHANGED
@@ -2,3 +2,5 @@
2
2
  Please fill config/rest-graph.yaml with your app_id, secret, and canvas to
3
3
  see if this example is working or not. This is supposed to be used in an
4
4
  iframe canvas page.
5
+
6
+ The default setup is designed for standalone site with Facebook JavaScript SDK.
@@ -10,23 +10,19 @@ class ApplicationController < ActionController::Base
10
10
 
11
11
  include RestGraph::RailsUtil
12
12
 
13
- before_filter :rest_graph_setup, :only => [:index, :url_for_standalone,
14
- :url_for_view_stand,
15
- :link_to_stand,
16
- :redirect_stand]
17
- before_filter :filter_canvas, :only => [:canvas, :url_for_canvas,
18
- :url_for_view_canvas,
19
- :link_to_canvas,
20
- :redirect_canvas]
13
+ before_filter :filter_common, :only => [:index]
14
+ before_filter :filter_canvas, :only => [:canvas]
21
15
  before_filter :filter_options, :only => [:options]
22
16
  before_filter :filter_no_auto, :only => [:no_auto]
23
- before_filter :filter_diff_app_id, :only => [:app_id]
17
+ before_filter :filter_diff_app_id, :only => [:diff_app_id]
18
+ before_filter :filter_diff_canvas, :only => [:diff_canvas]
24
19
 
25
20
  def index
26
21
  render :text => rest_graph.get('me').to_json
27
22
  end
28
- alias_method :canvas, :index
29
- alias_method :options, :index
23
+ alias_method :canvas , :index
24
+ alias_method :options , :index
25
+ alias_method :diff_canvas, :index
30
26
 
31
27
  def no_auto
32
28
  rest_graph.get('me')
@@ -34,42 +30,32 @@ class ApplicationController < ActionController::Base
34
30
  render :text => 'XD'
35
31
  end
36
32
 
37
- def app_id
33
+ def diff_app_id
38
34
  render :text => rest_graph.app_id
39
35
  end
40
36
 
41
- def url_for_standalone
42
- render :text => url_for(:action => 'index')
43
- end
44
- alias_method :url_for_canvas, :url_for_standalone
45
-
46
- def url_for_view_stand
47
- render :inline => '<%= url_for(:action => "index") %>'
48
- end
49
- alias_method :url_for_view_canvas, :url_for_view_stand
50
-
51
- def link_to_stand
52
- render :inline => '<%= link_to("test", :action => "index") %>'
53
- end
54
- alias_method :link_to_canvas, :link_to_stand
55
-
56
- def redirect_stand
57
- redirect_to :action => 'index'
37
+ private
38
+ def filter_common
39
+ rest_graph_setup(:auto_authorize => true)
58
40
  end
59
- alias_method :redirect_canvas, :redirect_stand
60
41
 
61
- private
62
42
  def filter_canvas
63
- rest_graph_setup(:canvas => true,
43
+ rest_graph_setup(:canvas => RestGraph.default_canvas,
64
44
  :auto_authorize_scope => 'publish_stream')
65
45
  end
66
46
 
47
+ def filter_diff_canvas
48
+ rest_graph_setup(:canvas => 'ToT',
49
+ :auto_authorize_scope => 'email')
50
+ end
51
+
67
52
  def filter_no_auto
68
53
  rest_graph_setup(:auto_authorize => false)
69
54
  end
70
55
 
71
56
  def filter_diff_app_id
72
- rest_graph_setup(:app_id => 'zzz')
57
+ rest_graph_setup(:app_id => 'zzz',
58
+ :auto_authorize => true)
73
59
  end
74
60
 
75
61
  def filter_options
@@ -39,4 +39,4 @@ Rails::Initializer.run do |config|
39
39
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
40
40
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
41
41
  # config.i18n.default_locale = :de
42
- end
42
+ end
@@ -14,4 +14,4 @@ config.action_view.debug_rjs = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
16
  # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
17
+ config.action_mailer.raise_delivery_errors = false
@@ -25,4 +25,4 @@ config.action_view.cache_template_loading = true
25
25
  # config.action_mailer.raise_delivery_errors = false
26
26
 
27
27
  # Enable threaded mode
28
- # config.threadsafe!
28
+ # config.threadsafe!
@@ -25,4 +25,4 @@ config.action_mailer.delivery_method = :test
25
25
  # Use SQL instead of Active Record's schema dumper when creating the test database.
26
26
  # This is necessary if your schema can't be completely dumped by the schema dumper,
27
27
  # like if you have constraints or database-specific column types
28
- # config.active_record.schema_format = :sql
28
+ # config.active_record.schema_format = :sql
@@ -2,6 +2,6 @@
2
2
 
3
3
  # Your secret key for verifying the integrity of signed cookies.
4
4
  # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
5
+ # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
7
  ActionController::Base.cookie_verifier_secret = '095e8e5c0b6b901901efb23fab50005b68d9d6a9d41f4ec780946cff34b26603762bc0ea1baf204613b252e5ae499d38b232d5b75edac513a723e450e76548a3';
@@ -18,4 +18,4 @@ ActiveSupport.use_standard_json_time_format = true
18
18
 
19
19
  # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
20
20
  # if you're including raw json in an HTML page.
21
- ActiveSupport.escape_html_entities_in_json = false
21
+ ActiveSupport.escape_html_entities_in_json = false
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Your secret key for verifying cookie session data integrity.
4
4
  # If you change this key, all old sessions will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
5
+ # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
7
  ActionController::Base.session = {
8
8
  :key => '_rails_session',
@@ -17,7 +17,7 @@ ActionController::Routing::Routes.draw do |map|
17
17
 
18
18
  # Sample resource route with sub-resources:
19
19
  # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
-
20
+
21
21
  # Sample resource route with more complex sub-resources
22
22
  # map.resources :products do |products|
23
23
  # products.resources :comments
@@ -22,7 +22,7 @@ class ApplicationControllerTest < ActionController::TestCase
22
22
  assert_equal(
23
23
  normalize_url(
24
24
  'https://graph.facebook.com/oauth/authorize?client_id=123&' \
25
- 'scope=offline_access%2Cpublish_stream%2Cread_friendlists&' \
25
+ 'scope=&' \
26
26
  'redirect_uri=http%3A%2F%2Ftest.host%2F'),
27
27
  normalize_url(assigns(:rest_graph_authorize_url)))
28
28
  end
@@ -38,6 +38,17 @@ class ApplicationControllerTest < ActionController::TestCase
38
38
  normalize_url((assigns(:rest_graph_authorize_url))))
39
39
  end
40
40
 
41
+ def test_diff_canvas
42
+ get(:diff_canvas)
43
+ assert_response :success
44
+ assert_equal(
45
+ normalize_url(
46
+ 'https://graph.facebook.com/oauth/authorize?client_id=123&' \
47
+ 'scope=email&' \
48
+ 'redirect_uri=http%3A%2F%2Fapps.facebook.com%2FToT%2Fdiff_canvas'),
49
+ normalize_url((assigns(:rest_graph_authorize_url))))
50
+ end
51
+
41
52
  def test_options
42
53
  get(:options)
43
54
  assert_response :redirect
@@ -56,59 +67,8 @@ class ApplicationControllerTest < ActionController::TestCase
56
67
  end
57
68
 
58
69
  def test_app_id
59
- get(:app_id)
70
+ get(:diff_app_id)
60
71
  assert_response :success
61
72
  assert_equal 'zzz', @response.body
62
73
  end
63
-
64
- def test_url_for_standalone
65
- get(:url_for_standalone)
66
- assert_response :success
67
- assert_equal 'http://test.host/', @response.body
68
- end
69
-
70
- def test_url_for_canvas
71
- get(:url_for_canvas)
72
- assert_response :success
73
- assert_equal 'http://apps.facebook.com/can/',
74
- @response.body
75
- end
76
-
77
- def test_url_for_view_stand
78
- get(:url_for_view_stand)
79
- assert_response :success
80
- assert_equal '/', @response.body
81
- end
82
-
83
- def test_url_for_view_canvas
84
- get(:url_for_view_canvas)
85
- assert_response :success
86
- assert_equal 'http://apps.facebook.com/can/',
87
- @response.body
88
- end
89
-
90
- def test_link_to_stand
91
- get(:link_to_stand)
92
- assert_response :success
93
- assert_equal '<a href="/">test</a>', @response.body
94
- end
95
-
96
- def test_link_to_canvas
97
- get(:link_to_canvas)
98
- assert_response :success
99
- assert_equal '<a href="http://apps.facebook.com/can/">test</a>',
100
- @response.body
101
- end
102
-
103
- def test_redirect_stand
104
- get(:redirect_stand)
105
- assert_response :redirect
106
- assert_redirected_to '/'
107
- end
108
-
109
- def test_redirect_canvas
110
- get(:redirect_canvas)
111
- assert_response :redirect
112
- assert_redirected_to 'http://apps.facebook.com/can/'
113
- end
114
74
  end
@@ -0,0 +1,27 @@
1
+
2
+ require 'rest-graph'
3
+
4
+ module RestGraph::FacebookUtil
5
+ module_function
6
+ def ext_perm
7
+ %w[publish_stream create_event rsvp_event sms offline_access manage_pages
8
+ email read_insights read_stream read_mailbox ads_management xmpp_login
9
+ user_about_me user_activities user_birthday user_education_history
10
+ user_events user_groups user_hometown user_interests user_likes
11
+ user_location user_notes user_online_presence user_photo_video_tags
12
+ user_photos user_relationships user_religion_politics user_status
13
+ user_videos user_videos user_work_history read_friendlists read_requests
14
+ friends_about_me friends_activities friends_birthday
15
+ friends_education_history friends_events friends_groups friends_hometown
16
+ friends_interests friends_likes friends_location friends_notes
17
+ friends_online_presence friends_photo_video_tags friends_photos
18
+ friends_relationships friends_religion_politics friends_status
19
+ friends_videos friends_website friends_work_history]
20
+ end
21
+
22
+ def method_name
23
+
24
+ end
25
+ end
26
+
27
+ RestGraph.send(:include, RestGraph::FacebookUtil)
@@ -1,16 +1,16 @@
1
1
 
2
2
  require 'rest-graph'
3
3
 
4
+ module RestGraph::DefaultAttributes
5
+ def default_canvas
6
+ ''
7
+ end
8
+ end
9
+
4
10
  module RestGraph::RailsUtil
5
11
  module Helper
6
- def url_for options
7
- caller = respond_to?(:controller) ? controller : self
8
- if caller.rest_graph_in_canvas? && options.kind_of?(Hash)
9
- super({:host => "apps.facebook.com/#{RestGraph.default_canvas}"}.
10
- merge(options))
11
- else
12
- super(options)
13
- end
12
+ def rest_graph
13
+ controller.rest_graph
14
14
  end
15
15
  end
16
16
 
@@ -18,17 +18,16 @@ module RestGraph::RailsUtil
18
18
  controller.rescue_from(::RestGraph::Error){ |exception|
19
19
  logger.debug("DEBUG: RestGraph: action halt")
20
20
  }
21
- controller.send(:include, ::RestGraph::RailsUtil::Helper)
22
21
  controller.helper(::RestGraph::RailsUtil::Helper)
23
22
  end
24
23
 
25
24
  def rest_graph_options
26
25
  @rest_graph_options ||=
27
- {:canvas => false,
28
- :auto_authorize => true,
26
+ {:canvas => '',
27
+ :auto_authorize => false,
29
28
  :auto_authorize_options => {},
30
- :auto_authorize_scope =>
31
- 'offline_access,publish_stream,read_friendlists'}
29
+ :auto_authorize_scope => '',
30
+ :write_session => false}
32
31
  end
33
32
 
34
33
  def rest_graph_options_new
@@ -41,43 +40,17 @@ module RestGraph::RailsUtil
41
40
  rest_graph_options .merge!(rest_graph_extract_options(options, :reject))
42
41
  rest_graph_options_new.merge!(rest_graph_extract_options(options, :select))
43
42
 
44
- # exchange the code with access_token
45
- if params[:code]
46
- rest_graph.authorize!(:code => params[:code],
47
- :redirect_uri => rest_graph_normalized_request_uri)
48
- logger.debug(
49
- "DEBUG: RestGraph: detected code with " \
50
- "#{rest_graph_normalized_request_uri}, " \
51
- "parsed: #{rest_graph.data.inspect}")
52
- end
53
-
54
- # if the code is bad or not existed,
55
- # check if there's one in session,
56
- # meanwhile, there the sig and access_token is correct,
57
- # that means we're in the context of canvas
58
- if !rest_graph.authorized? && params[:session]
59
- rest_graph.parse_json!(params[:session])
60
- logger.debug("DEBUG: RestGraph: detected session, parsed:" \
61
- " #{rest_graph.data.inspect}")
62
-
63
- if rest_graph.authorized?
64
- @fb_sig_in_canvas = true
65
- else
66
- logger.warn("WARN: RestGraph: bad session: #{params[:session]}")
67
- end
68
- end
69
-
70
- # if we're not in canvas nor code passed,
71
- # we could check out cookies as well.
72
- if !rest_graph.authorized?
73
- rest_graph.parse_cookies!(cookies)
74
- logger.debug("DEBUG: RestGraph: detected cookies, parsed:" \
75
- " #{rest_graph.data.inspect}")
76
- end
43
+ rest_graph_check_cookie
44
+ rest_graph_check_params_session
45
+ rest_graph_check_code
77
46
 
78
47
  # there are above 3 ways to check the user identity!
79
48
  # if nor of them passed, then we can suppose the user
80
- # didn't authorize for us
49
+ # didn't authorize for us, but we can check if user has authorized
50
+ # before, in that case, the fbs would be inside session,
51
+ # as we just saved it there
52
+
53
+ rest_graph_check_rails_session
81
54
  end
82
55
 
83
56
  # override this if you need different app_id and secret
@@ -85,17 +58,20 @@ module RestGraph::RailsUtil
85
58
  @rest_graph ||= RestGraph.new(rest_graph_options_new)
86
59
  end
87
60
 
88
- def rest_graph_authorize error
61
+ def rest_graph_authorize error=nil, redirect=false
89
62
  logger.warn("WARN: RestGraph: #{error.inspect}")
90
63
 
91
- @rest_graph_authorize_url = rest_graph.authorize_url(
92
- {:redirect_uri => rest_graph_normalized_request_uri,
93
- :scope => rest_graph_options[:auto_authorize_scope]}.
94
- merge( rest_graph_options[:auto_authorize_options]))
64
+ if redirect || rest_graph_auto_authorize?
65
+ @rest_graph_authorize_url = rest_graph.authorize_url(
66
+ {:redirect_uri => rest_graph_normalized_request_uri,
67
+ :scope => rest_graph_options[:auto_authorize_scope]}.
68
+ merge( rest_graph_options[:auto_authorize_options]))
69
+
70
+ logger.debug("DEBUG: RestGraph: redirect to #{@rest_graph_authorize_url}")
95
71
 
96
- logger.debug("DEBUG: RestGraph: redirect to #{@rest_graph_authorize_url}")
72
+ rest_graph_authorize_redirect
73
+ end
97
74
 
98
- rest_graph_authorize_redirect if rest_graph_options[:auto_authorize]
99
75
  raise ::RestGraph::Error.new(error)
100
76
  end
101
77
 
@@ -126,6 +102,73 @@ module RestGraph::RailsUtil
126
102
  end
127
103
  end
128
104
 
105
+ module_function
106
+
107
+ # ==================== checking utility ====================
108
+
109
+ # if we're not in canvas nor code passed,
110
+ # we could check out cookies as well.
111
+ def rest_graph_check_cookie
112
+ return if rest_graph.authorized? ||
113
+ !cookies["fbs_#{rest_graph.app_id}"]
114
+
115
+ rest_graph.parse_cookies!(cookies)
116
+ logger.debug("DEBUG: RestGraph: detected cookies, parsed:" \
117
+ " #{rest_graph.data.inspect}")
118
+ end
119
+
120
+ # if the code is bad or not existed,
121
+ # check if there's one in session,
122
+ # meanwhile, there the sig and access_token is correct,
123
+ # that means we're in the context of canvas
124
+ def rest_graph_check_params_session
125
+ return if rest_graph.authorized? || !params[:session]
126
+
127
+ rest_graph.parse_json!(params[:session])
128
+ logger.debug("DEBUG: RestGraph: detected session, parsed:" \
129
+ " #{rest_graph.data.inspect}")
130
+
131
+ if rest_graph.authorized?
132
+ @fb_sig_in_canvas = true
133
+ else
134
+ logger.warn("WARN: RestGraph: bad session: #{params[:session]}")
135
+ end
136
+
137
+ rest_graph_write_session
138
+ end
139
+
140
+ # exchange the code with access_token
141
+ def rest_graph_check_code
142
+ return if rest_graph.authorized? || !params[:code]
143
+
144
+ rest_graph.authorize!(:code => params[:code],
145
+ :redirect_uri => rest_graph_normalized_request_uri)
146
+ logger.debug(
147
+ "DEBUG: RestGraph: detected code with " \
148
+ "#{rest_graph_normalized_request_uri}, " \
149
+ "parsed: #{rest_graph.data.inspect}")
150
+
151
+ rest_graph_write_session
152
+ end
153
+
154
+ def rest_graph_check_rails_session
155
+ return if rest_graph.authorized? || !session['fbs']
156
+
157
+ rest_graph.parse_fbs!(session['fbs'])
158
+ logger.debug("DEBUG: RestGraph: detected session, parsed:" \
159
+ " #{rest_graph.data.inspect}")
160
+ end
161
+
162
+ # ==================== others ====================
163
+
164
+ def rest_graph_write_session
165
+ return if !rest_graph.authorized? || !rest_graph_options[:write_session]
166
+
167
+ fbs = rest_graph.data.to_a.map{ |k_v| k_v.join('=') }.join('&')
168
+ session['fbs'] = fbs
169
+ logger.debug("DEBUG: RestGraph: wrote session: fbs => #{fbs}")
170
+ end
171
+
129
172
  def rest_graph_log duration, url
130
173
  logger.debug("DEBUG: RestGraph: spent #{duration} requesting #{url}")
131
174
  end
@@ -133,7 +176,7 @@ module RestGraph::RailsUtil
133
176
  def rest_graph_normalized_request_uri
134
177
  if rest_graph_in_canvas?
135
178
  "http://apps.facebook.com/" \
136
- "#{RestGraph.default_canvas}#{request.request_uri}"
179
+ "#{rest_graph_canvas}#{request.request_uri}"
137
180
  else
138
181
  request.url
139
182
  end.sub(/[\&\?]session=[^\&]+/, '').
@@ -141,7 +184,21 @@ module RestGraph::RailsUtil
141
184
  end
142
185
 
143
186
  def rest_graph_in_canvas?
144
- rest_graph_options[:canvas] || @fb_sig_in_canvas
187
+ !rest_graph_options[:canvas].empty?
188
+ end
189
+
190
+ def rest_graph_canvas
191
+ if rest_graph_options[:canvas].empty?
192
+ RestGraph.default_canvas
193
+ else
194
+ rest_graph_options[:canvas]
195
+ end
196
+ end
197
+
198
+ def rest_graph_auto_authorize?
199
+ !rest_graph_options[:auto_authorize_scope ].empty? ||
200
+ !rest_graph_options[:auto_authorize_options].empty? ||
201
+ rest_graph_options[:auto_authorize]
145
202
  end
146
203
 
147
204
  def rest_graph_extract_options options, method
@@ -1,4 +1,4 @@
1
1
 
2
2
  require 'rest-graph'
3
3
 
4
- RestGraph::VERSION = '1.3.0'
4
+ RestGraph::VERSION = '1.4.0'
data/rest-graph.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rest-graph}
5
- s.version = "1.3.0"
5
+ s.version = "1.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Cardinal Blue", "Lin Jen-Shin (aka godfat 真常)"]
9
- s.date = %q{2010-06-10}
9
+ s.date = %q{2010-07-15}
10
10
  s.description = %q{ A super simple Facebook Open Graph API client}
11
11
  s.email = %q{dev (XD) cardinalblue.com}
12
- s.extra_rdoc_files = ["CHANGES", "LICENSE", "TODO", "example/rails/README", "example/rails/config/rest-graph.yaml", "example/rails/log", "example/rails/script/console", "example/rails/script/server", "rest-graph.gemspec"]
13
- s.files = ["CHANGES", "LICENSE", "README.rdoc", "Rakefile", "TODO", "example/rails/README", "example/rails/Rakefile", "example/rails/app/controllers/application_controller.rb", "example/rails/config/boot.rb", "example/rails/config/environment.rb", "example/rails/config/environments/development.rb", "example/rails/config/environments/production.rb", "example/rails/config/environments/test.rb", "example/rails/config/initializers/cookie_verification_secret.rb", "example/rails/config/initializers/new_rails_defaults.rb", "example/rails/config/initializers/session_store.rb", "example/rails/config/rest-graph.yaml", "example/rails/config/routes.rb", "example/rails/log", "example/rails/script/console", "example/rails/script/server", "example/rails/test/functional/application_controller_test.rb", "example/rails/test/test_helper.rb", "init.rb", "lib/rest-graph.rb", "lib/rest-graph/auto_load.rb", "lib/rest-graph/load_config.rb", "lib/rest-graph/rails_util.rb", "lib/rest-graph/version.rb", "rest-graph.gemspec", "test/common.rb", "test/config/rest-graph.yaml", "test/test_default.rb", "test/test_handler.rb", "test/test_load_config.rb", "test/test_oauth.rb", "test/test_old.rb", "test/test_parse.rb", "test/test_rest-graph.rb"]
12
+ s.extra_rdoc_files = ["CHANGES", "LICENSE", "README", "TODO", "example/rails/README", "example/rails/config/rest-graph.yaml", "example/rails/log", "example/rails/script/console", "example/rails/script/server", "rest-graph.gemspec"]
13
+ s.files = ["CHANGES", "LICENSE", "README", "README.rdoc", "Rakefile", "TODO", "example/rails/README", "example/rails/Rakefile", "example/rails/app/controllers/application_controller.rb", "example/rails/config/boot.rb", "example/rails/config/environment.rb", "example/rails/config/environments/development.rb", "example/rails/config/environments/production.rb", "example/rails/config/environments/test.rb", "example/rails/config/initializers/cookie_verification_secret.rb", "example/rails/config/initializers/new_rails_defaults.rb", "example/rails/config/initializers/session_store.rb", "example/rails/config/rest-graph.yaml", "example/rails/config/routes.rb", "example/rails/log", "example/rails/script/console", "example/rails/script/server", "example/rails/test/functional/application_controller_test.rb", "example/rails/test/test_helper.rb", "init.rb", "lib/rest-graph.rb", "lib/rest-graph/auto_load.rb", "lib/rest-graph/facebook_util.rb", "lib/rest-graph/load_config.rb", "lib/rest-graph/rails_util.rb", "lib/rest-graph/version.rb", "rest-graph.gemspec", "test/common.rb", "test/config/rest-graph.yaml", "test/test_default.rb", "test/test_handler.rb", "test/test_load_config.rb", "test/test_oauth.rb", "test/test_old.rb", "test/test_parse.rb", "test/test_rest-graph.rb"]
14
14
  s.homepage = %q{http://github.com/cardinalblue/rest-graph}
15
15
  s.rdoc_options = ["--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
@@ -24,29 +24,29 @@ Gem::Specification.new do |s|
24
24
  s.specification_version = 3
25
25
 
26
26
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<rest-client>, [">= 1.5.1"])
27
+ s.add_runtime_dependency(%q<rest-client>, [">= 1.6.0"])
28
28
  s.add_development_dependency(%q<json>, [">= 1.4.3"])
29
- s.add_development_dependency(%q<rack>, [">= 1.1.0"])
29
+ s.add_development_dependency(%q<rack>, [">= 1.2.1"])
30
30
  s.add_development_dependency(%q<rr>, [">= 0.10.11"])
31
- s.add_development_dependency(%q<webmock>, [">= 1.2.2"])
31
+ s.add_development_dependency(%q<webmock>, [">= 1.3.1"])
32
32
  s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
33
- s.add_development_dependency(%q<bones>, [">= 3.4.6"])
33
+ s.add_development_dependency(%q<bones>, [">= 3.4.7"])
34
34
  else
35
- s.add_dependency(%q<rest-client>, [">= 1.5.1"])
35
+ s.add_dependency(%q<rest-client>, [">= 1.6.0"])
36
36
  s.add_dependency(%q<json>, [">= 1.4.3"])
37
- s.add_dependency(%q<rack>, [">= 1.1.0"])
37
+ s.add_dependency(%q<rack>, [">= 1.2.1"])
38
38
  s.add_dependency(%q<rr>, [">= 0.10.11"])
39
- s.add_dependency(%q<webmock>, [">= 1.2.2"])
39
+ s.add_dependency(%q<webmock>, [">= 1.3.1"])
40
40
  s.add_dependency(%q<bacon>, [">= 1.1.0"])
41
- s.add_dependency(%q<bones>, [">= 3.4.6"])
41
+ s.add_dependency(%q<bones>, [">= 3.4.7"])
42
42
  end
43
43
  else
44
- s.add_dependency(%q<rest-client>, [">= 1.5.1"])
44
+ s.add_dependency(%q<rest-client>, [">= 1.6.0"])
45
45
  s.add_dependency(%q<json>, [">= 1.4.3"])
46
- s.add_dependency(%q<rack>, [">= 1.1.0"])
46
+ s.add_dependency(%q<rack>, [">= 1.2.1"])
47
47
  s.add_dependency(%q<rr>, [">= 0.10.11"])
48
- s.add_dependency(%q<webmock>, [">= 1.2.2"])
48
+ s.add_dependency(%q<webmock>, [">= 1.3.1"])
49
49
  s.add_dependency(%q<bacon>, [">= 1.1.0"])
50
- s.add_dependency(%q<bones>, [">= 3.4.6"])
50
+ s.add_dependency(%q<bones>, [">= 3.4.7"])
51
51
  end
52
52
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 1.3.0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cardinal Blue
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-06-11 00:00:00 +08:00
19
+ date: 2010-07-15 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,12 +27,12 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- hash: 1
30
+ hash: 15
31
31
  segments:
32
32
  - 1
33
- - 5
34
- - 1
35
- version: 1.5.1
33
+ - 6
34
+ - 0
35
+ version: 1.6.0
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency
@@ -59,12 +59,12 @@ dependencies:
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- hash: 19
62
+ hash: 29
63
63
  segments:
64
64
  - 1
65
+ - 2
65
66
  - 1
66
- - 0
67
- version: 1.1.0
67
+ version: 1.2.1
68
68
  type: :development
69
69
  version_requirements: *id003
70
70
  - !ruby/object:Gem::Dependency
@@ -91,12 +91,12 @@ dependencies:
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- hash: 27
94
+ hash: 25
95
95
  segments:
96
96
  - 1
97
- - 2
98
- - 2
99
- version: 1.2.2
97
+ - 3
98
+ - 1
99
+ version: 1.3.1
100
100
  type: :development
101
101
  version_requirements: *id005
102
102
  - !ruby/object:Gem::Dependency
@@ -123,12 +123,12 @@ dependencies:
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- hash: 27
126
+ hash: 25
127
127
  segments:
128
128
  - 3
129
129
  - 4
130
- - 6
131
- version: 3.4.6
130
+ - 7
131
+ version: 3.4.7
132
132
  type: :development
133
133
  version_requirements: *id007
134
134
  description: " A super simple Facebook Open Graph API client"
@@ -140,6 +140,7 @@ extensions: []
140
140
  extra_rdoc_files:
141
141
  - CHANGES
142
142
  - LICENSE
143
+ - README
143
144
  - TODO
144
145
  - example/rails/README
145
146
  - example/rails/config/rest-graph.yaml
@@ -150,6 +151,7 @@ extra_rdoc_files:
150
151
  files:
151
152
  - CHANGES
152
153
  - LICENSE
154
+ - README
153
155
  - README.rdoc
154
156
  - Rakefile
155
157
  - TODO
@@ -174,6 +176,7 @@ files:
174
176
  - init.rb
175
177
  - lib/rest-graph.rb
176
178
  - lib/rest-graph/auto_load.rb
179
+ - lib/rest-graph/facebook_util.rb
177
180
  - lib/rest-graph/load_config.rb
178
181
  - lib/rest-graph/rails_util.rb
179
182
  - lib/rest-graph/version.rb