rest-graph 1.5.0 → 1.6.0

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/.specification ADDED
@@ -0,0 +1,309 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rest-graph
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 6
8
+ - 0
9
+ version: 1.6.0
10
+ platform: ruby
11
+ authors:
12
+ - Cardinal Blue
13
+ - "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-19 00:00:00 +08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rest-client
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 1
31
+ - 6
32
+ - 1
33
+ version: 1.6.1
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: em-http-request
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ segments:
45
+ - 0
46
+ - 2
47
+ - 15
48
+ version: 0.2.15
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rack
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ segments:
60
+ - 1
61
+ - 2
62
+ - 1
63
+ version: 1.2.1
64
+ type: :development
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: yajl-ruby
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ - 7
77
+ - 8
78
+ version: 0.7.8
79
+ type: :development
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: json
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ segments:
90
+ - 1
91
+ - 4
92
+ - 6
93
+ version: 1.4.6
94
+ type: :development
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: json_pure
98
+ prerelease: false
99
+ requirement: &id006 !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 1
106
+ - 4
107
+ - 6
108
+ version: 1.4.6
109
+ type: :development
110
+ version_requirements: *id006
111
+ - !ruby/object:Gem::Dependency
112
+ name: ruby-hmac
113
+ prerelease: false
114
+ requirement: &id007 !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ segments:
120
+ - 0
121
+ - 4
122
+ - 0
123
+ version: 0.4.0
124
+ type: :development
125
+ version_requirements: *id007
126
+ - !ruby/object:Gem::Dependency
127
+ name: rr
128
+ prerelease: false
129
+ requirement: &id008 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ segments:
135
+ - 1
136
+ - 0
137
+ - 2
138
+ version: 1.0.2
139
+ type: :development
140
+ version_requirements: *id008
141
+ - !ruby/object:Gem::Dependency
142
+ name: webmock
143
+ prerelease: false
144
+ requirement: &id009 !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ segments:
150
+ - 1
151
+ - 6
152
+ - 1
153
+ version: 1.6.1
154
+ type: :development
155
+ version_requirements: *id009
156
+ - !ruby/object:Gem::Dependency
157
+ name: bacon
158
+ prerelease: false
159
+ requirement: &id010 !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ segments:
165
+ - 1
166
+ - 1
167
+ - 0
168
+ version: 1.1.0
169
+ type: :development
170
+ version_requirements: *id010
171
+ - !ruby/object:Gem::Dependency
172
+ name: bones
173
+ prerelease: false
174
+ requirement: &id011 !ruby/object:Gem::Requirement
175
+ none: false
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ segments:
180
+ - 3
181
+ - 5
182
+ - 1
183
+ version: 3.5.1
184
+ type: :development
185
+ version_requirements: *id011
186
+ description: A super simple Facebook Open Graph API client
187
+ email: dev (XD) cardinalblue.com
188
+ executables: []
189
+
190
+ extensions: []
191
+
192
+ extra_rdoc_files:
193
+ - .specification
194
+ - CHANGES
195
+ - CONTRIBUTORS
196
+ - Gemfile
197
+ - Gemfile.lock
198
+ - LICENSE
199
+ - README
200
+ - TODO
201
+ - rest-graph.gemspec
202
+ files:
203
+ - .specification
204
+ - CHANGES
205
+ - CONTRIBUTORS
206
+ - Gemfile
207
+ - Gemfile.lock
208
+ - LICENSE
209
+ - README
210
+ - README.rdoc
211
+ - Rakefile
212
+ - TODO
213
+ - example/multi/config.ru
214
+ - example/multi/rainbows.rb
215
+ - example/rails2/README
216
+ - example/rails2/Rakefile
217
+ - example/rails2/app/controllers/application_controller.rb
218
+ - example/rails2/config/boot.rb
219
+ - example/rails2/config/environment.rb
220
+ - example/rails2/config/environments/development.rb
221
+ - example/rails2/config/environments/production.rb
222
+ - example/rails2/config/environments/test.rb
223
+ - example/rails2/config/initializers/cookie_verification_secret.rb
224
+ - example/rails2/config/initializers/new_rails_defaults.rb
225
+ - example/rails2/config/initializers/session_store.rb
226
+ - example/rails2/config/rest-graph.yaml
227
+ - example/rails2/config/routes.rb
228
+ - example/rails2/log
229
+ - example/rails2/script/console
230
+ - example/rails2/script/server
231
+ - example/rails2/test/functional/application_controller_test.rb
232
+ - example/rails2/test/test_helper.rb
233
+ - example/rails2/test/unit/rails_util_test.rb
234
+ - init.rb
235
+ - lib/rest-graph.rb
236
+ - lib/rest-graph/auto_load.rb
237
+ - lib/rest-graph/load_config.rb
238
+ - lib/rest-graph/rails_util.rb
239
+ - lib/rest-graph/test_util.rb
240
+ - lib/rest-graph/version.rb
241
+ - rest-graph.gemspec
242
+ - test/common.rb
243
+ - test/config/rest-graph.yaml
244
+ - test/test_api.rb
245
+ - test/test_cache.rb
246
+ - test/test_default.rb
247
+ - test/test_error.rb
248
+ - test/test_handler.rb
249
+ - test/test_load_config.rb
250
+ - test/test_misc.rb
251
+ - test/test_multi.rb
252
+ - test/test_oauth.rb
253
+ - test/test_old.rb
254
+ - test/test_page.rb
255
+ - test/test_parse.rb
256
+ - test/test_rest-graph.rb
257
+ - test/test_serialize.rb
258
+ - test/test_test_util.rb
259
+ - test/test_timeout.rb
260
+ has_rdoc: true
261
+ homepage: http://github.com/cardinalblue/rest-graph
262
+ licenses: []
263
+
264
+ post_install_message:
265
+ rdoc_options:
266
+ - --main
267
+ - README.rdoc
268
+ require_paths:
269
+ - lib
270
+ required_ruby_version: !ruby/object:Gem::Requirement
271
+ none: false
272
+ requirements:
273
+ - - ">="
274
+ - !ruby/object:Gem::Version
275
+ segments:
276
+ - 0
277
+ version: "0"
278
+ required_rubygems_version: !ruby/object:Gem::Requirement
279
+ none: false
280
+ requirements:
281
+ - - ">="
282
+ - !ruby/object:Gem::Version
283
+ segments:
284
+ - 0
285
+ version: "0"
286
+ requirements: []
287
+
288
+ rubyforge_project: rest-graph
289
+ rubygems_version: 1.3.7
290
+ signing_key:
291
+ specification_version: 3
292
+ summary: A super simple Facebook Open Graph API client
293
+ test_files:
294
+ - test/test_api.rb
295
+ - test/test_cache.rb
296
+ - test/test_default.rb
297
+ - test/test_error.rb
298
+ - test/test_handler.rb
299
+ - test/test_load_config.rb
300
+ - test/test_misc.rb
301
+ - test/test_multi.rb
302
+ - test/test_oauth.rb
303
+ - test/test_old.rb
304
+ - test/test_page.rb
305
+ - test/test_parse.rb
306
+ - test/test_rest-graph.rb
307
+ - test/test_serialize.rb
308
+ - test/test_test_util.rb
309
+ - test/test_timeout.rb
data/CHANGES CHANGED
@@ -1,5 +1,83 @@
1
1
  = rest-graph changes history
2
2
 
3
+ == rest-graph 1.6.0 -- 2010-11-19
4
+
5
+ * [RestGraph] Added em-http as an alternate for HTTP client. So rest-client
6
+ is no longer a must-have dependency. Pass :async => true to
7
+ RestGraph#get/delete/post/put will pick em-http to do the
8
+ request instead of rest-client. Callback would be the block
9
+ passed to that particular method. There are short hands for
10
+ this, too: use RestGraph#aget/adelete/apost/aput.
11
+
12
+ Additionally, callback style also works for rest-client. e.g.
13
+
14
+ rg. get('me') # rest-client
15
+ rg. get('me', {}, :async => true){ |result| } # em-http
16
+ rg.aget('me') { |result| } # em-http
17
+ rg. get('me') { |result| } # rest-client
18
+
19
+ So you can always use callback style to ease porting from
20
+ blocking mode (synchronized) to non-blocking mode (evented).
21
+
22
+ * [RestGraph] Introduced RestGraph#multi to do multiple API call concurrently.
23
+ To use this feature, you'll need to run RestGraph inside an
24
+ EventMachine event loop and install em-http. (And you may want
25
+ async-rack if you're doing Rack application too.)
26
+
27
+ * [RestGraph] Added a timeout option, which makes rest-graph raise a
28
+ Timeout::Error when any of the API call exceeds the timeout
29
+ limit. This might have some issues in Rubinius 1.1, I'm not
30
+ sure why.
31
+
32
+ * [RestGraph] Added a log_method option, which would be used for default
33
+ logging template, which is extracted from RailsUtil. So the
34
+ log_method in RailsUtil would be `logger.method(:debug)',
35
+ while in a terminal, you might want `method(:puts)'.
36
+
37
+ Previously, you can only use log_handler for logging, which
38
+ you need to write your custom logging template. Now for common
39
+ logging, using log_method is enough. On the other hand,
40
+ log_handler could be used for event handling.
41
+
42
+ * [RestGraph] Introduced Event::MultiDone and Event::Failed. Those event
43
+ objects would be passed to log_handler and/or log_method.
44
+ The former means a multi-request is done, the latter means
45
+ a request is failed.
46
+
47
+ * [TestUtil] A collection of tools integrated with RR to ease the pain of
48
+ testing. There are 3 levels of tools to stub the result of
49
+ calling APIs. The highest level is TestUtil.login(1234) which
50
+ would stub a number of results to pretend the user 1234 is
51
+ logged-in.
52
+
53
+ The second level are the get/post/put/delete methods for
54
+ TestUtil. For example, to make rg.get('1234') return a
55
+ particular value (such as a hash {'a' => 1}), use
56
+ TestUtil.get('1234'){ {'a' => 1} } to set it up to return
57
+ the specified value (typically a hash).
58
+
59
+ The third level is for setting default_data and default_response
60
+ for TestUtil. The default_data is the default value for rg.data,
61
+ which includes the access_token and the user_id (uid). The
62
+ default_response is the response given by any RestGraph API call
63
+ (e.g. get, post) when no explicit response has been defined in
64
+ the second level.
65
+
66
+ To use TestUtil, remember to install RR (gem install rr) and
67
+ require 'rest-graph/test_util'. Then put
68
+ RestGraph::TestUtil.setup before any test case starts, and put
69
+ RestGraph::TestUtil.teardown after any test case ends. Setup
70
+ would stub default_data and default_response for you, and
71
+ teardown would remove any stubs on RestGraph. For Rails, you
72
+ might want to put these in test_helper.rb under "setup" and
73
+ "teardown" block, just as the name suggested. For bacon or
74
+ rspec style testing, these can be placed in the "before" and
75
+ "after" blocks.
76
+
77
+ In addition, you can get the API calls history via
78
+ RestGraph::TestUtil.history. This would get cleaned up in
79
+ RestGraph::TestUtil.teardown as well.
80
+
3
81
  == rest-graph 1.5.0 -- 2010-10-11
4
82
 
5
83
  * [RestGraph] Make sure RestGraph::Error#message is string, that way,
data/Gemfile CHANGED
@@ -1,9 +1,11 @@
1
1
 
2
2
  source 'http://rubygems.org'
3
3
 
4
- gem 'rest-client'
5
-
6
4
  group :test do
5
+ # pick one http client
6
+ gem 'rest-client', '>=1.6'
7
+ gem 'em-http-request'
8
+
7
9
  # optional
8
10
  gem 'rack'
9
11
 
data/Gemfile.lock CHANGED
@@ -1,13 +1,17 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.2.1)
4
+ addressable (2.2.2)
5
5
  bacon (1.1.0)
6
- bones (3.4.7)
6
+ bones (3.5.1)
7
7
  little-plugger (>= 1.1.2)
8
- loquacious (>= 1.6.4)
8
+ loquacious (>= 1.7.0)
9
9
  rake (>= 0.8.7)
10
10
  crack (0.1.8)
11
+ em-http-request (0.2.14)
12
+ addressable (>= 2.0.0)
13
+ eventmachine (>= 0.12.9)
14
+ eventmachine (0.12.10)
11
15
  json (1.4.6)
12
16
  json_pure (1.4.6)
13
17
  little-plugger (1.1.2)
@@ -17,10 +21,10 @@ GEM
17
21
  rake (0.8.7)
18
22
  rest-client (1.6.1)
19
23
  mime-types (>= 1.16)
20
- rr (1.0.0)
24
+ rr (1.0.2)
21
25
  ruby-hmac (0.4.0)
22
- webmock (1.3.5)
23
- addressable (>= 2.1.1)
26
+ webmock (1.5.0)
27
+ addressable (>= 2.2.2)
24
28
  crack (>= 0.1.7)
25
29
  yajl-ruby (0.7.8)
26
30
 
@@ -30,10 +34,11 @@ PLATFORMS
30
34
  DEPENDENCIES
31
35
  bacon
32
36
  bones
37
+ em-http-request
33
38
  json
34
39
  json_pure
35
40
  rack
36
- rest-client
41
+ rest-client (>= 1.6)
37
42
  rr
38
43
  ruby-hmac
39
44
  webmock