rest-graph 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,9 @@ require 'rubygems' if RUBY_VERSION < '1.9.2'
3
3
  require 'rack' if RUBY_VERSION < '1.9.2' # autoload broken in 1.8?
4
4
  require 'rest-graph'
5
5
 
6
+ # need to require this before webmock in order to enable mocking in em-http
7
+ require 'em-http-request'
8
+
6
9
  require 'rr'
7
10
  require 'webmock'
8
11
  require 'bacon'
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -41,12 +41,24 @@ describe RestGraph do
41
41
  post('feed/me', :message => 'hi there').should == 'ok'
42
42
  end
43
43
 
44
+ should 'use secret_access_token' do
45
+ stub_request(:get,
46
+ 'https://graph.facebook.com/me?access_token=1|2').
47
+ to_return(:body => 'ok')
48
+
49
+ rg = RestGraph.new(:auto_decode => false, :access_token => 'wrong',
50
+ :app_id => '1', :secret => '2')
51
+ rg.get('me', {}, :secret => true).should == 'ok'
52
+ rg.url('me', {}, rg.graph_server, :secret => true).should ==
53
+ 'https://graph.facebook.com/me?access_token=1%7C2'
54
+ end
55
+
44
56
  should 'suppress auto-decode in an api call' do
45
57
  stub_request(:get, 'https://graph.facebook.com/woot').
46
58
  to_return(:body => 'bad json')
47
59
 
48
60
  rg = RestGraph.new(:auto_decode => true)
49
- rg.get('woot', {}, :suppress_decode => true).should == 'bad json'
61
+ rg.get('woot', {}, :auto_decode => false).should == 'bad json'
50
62
  rg.auto_decode.should == true
51
63
  end
52
64
 
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph::Error do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -5,12 +5,9 @@ else
5
5
  require File.dirname(__FILE__) + '/common'
6
6
  end
7
7
 
8
- require 'em-http-request'
9
- load 'webmock/http_lib_adapters/em_http_request.rb'
10
-
11
8
  describe 'RestGraph#multi' do
12
9
  after do
13
- WebMock.reset_webmock
10
+ WebMock.reset!
14
11
  RR.verify
15
12
  end
16
13
 
@@ -12,7 +12,7 @@ describe RestGraph do
12
12
  end
13
13
 
14
14
  after do
15
- WebMock.reset_webmock
15
+ WebMock.reset!
16
16
  end
17
17
 
18
18
  should 'return correct oauth url' do
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -54,7 +54,7 @@ describe RestGraph do
54
54
  'https://api.facebook.com/method/notes.create?format=json').
55
55
  to_return(:body => body)
56
56
 
57
- RestGraph.new.old_rest('notes.create', {}, :suppress_decode => true).
57
+ RestGraph.new.old_rest('notes.create', {}, :auto_decode => false).
58
58
  should == body
59
59
  end
60
60
 
@@ -71,17 +71,6 @@ describe RestGraph do
71
71
  first['access_token'].should == 'bogus'
72
72
  end
73
73
 
74
- should 'broken json' do
75
- stub_request(:get,
76
- 'https://api.facebook.com/method/admin.getAppProperties?' \
77
- 'access_token=123%7Cs&format=json&properties=app_id'
78
- ).to_return(:body => '"{\"app_id\":\"123\"}"')
79
-
80
- RestGraph.new(:app_id => '123', :secret => 's').
81
- secret_old_rest('admin.getAppProperties', :properties => 'app_id').
82
- should == {'app_id' => '123'}
83
- end
84
-
85
74
  should 'use an secret access_token' do
86
75
  stub_request(:get,
87
76
  'https://api.facebook.com/method/admin.getAppProperties?' \
@@ -92,15 +81,4 @@ describe RestGraph do
92
81
  secret_old_rest('admin.getAppProperties', :properties => 'app_id').
93
82
  should == {'app_id' => '123'}
94
83
  end
95
-
96
- should 'not parse twice in strict mode' do
97
- stub_request(:get,
98
- 'https://api.facebook.com/method/admin.getAppProperties?' \
99
- 'access_token=123%7Cs&format=json&properties=app_id'
100
- ).to_return(:body => '"{\"app_id\":\"123\"}"')
101
-
102
- RestGraph.new(:app_id => '123', :secret => 's', :strict => true).
103
- secret_old_rest('admin.getAppProperties', :properties => 'app_id').
104
- should == '{"app_id":"123"}'
105
- end
106
84
  end
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  describe RestGraph do
9
9
  after do
10
- WebMock.reset_webmock
10
+ WebMock.reset!
11
11
  RR.verify
12
12
  end
13
13
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 6
7
+ - 7
8
8
  - 0
9
- version: 1.6.0
9
+ version: 1.7.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Cardinal Blue
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-19 00:00:00 +08:00
18
+ date: 2010-12-30 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -179,8 +179,8 @@ dependencies:
179
179
  segments:
180
180
  - 3
181
181
  - 5
182
- - 1
183
- version: 3.5.1
182
+ - 4
183
+ version: 3.5.4
184
184
  type: :development
185
185
  version_requirements: *id011
186
186
  description: A super simple Facebook Open Graph API client
@@ -190,7 +190,6 @@ executables: []
190
190
  extensions: []
191
191
 
192
192
  extra_rdoc_files:
193
- - .specification
194
193
  - CHANGES
195
194
  - CONTRIBUTORS
196
195
  - Gemfile
@@ -200,7 +199,6 @@ extra_rdoc_files:
200
199
  - TODO
201
200
  - rest-graph.gemspec
202
201
  files:
203
- - .specification
204
202
  - CHANGES
205
203
  - CONTRIBUTORS
206
204
  - Gemfile
@@ -234,6 +232,7 @@ files:
234
232
  - init.rb
235
233
  - lib/rest-graph.rb
236
234
  - lib/rest-graph/auto_load.rb
235
+ - lib/rest-graph/autoload.rb
237
236
  - lib/rest-graph/load_config.rb
238
237
  - lib/rest-graph/rails_util.rb
239
238
  - lib/rest-graph/test_util.rb
@@ -1,309 +0,0 @@
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