fb_graph 1.6.5 → 1.6.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.5
1
+ 1.6.7
data/fb_graph.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.6.5"
8
+ s.version = "1.6.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nov matake"]
12
- s.date = %q{2011-04-01}
12
+ s.date = %q{2011-04-22}
13
13
  s.description = %q{A full-stack Facebook Graph API wrapper in Ruby.}
14
14
  s.email = %q{nov@matake.jp}
15
15
  s.extra_rdoc_files = [
@@ -116,6 +116,7 @@ Gem::Specification.new do |s|
116
116
  "lib/fb_graph/work.rb",
117
117
  "spec/fake_json/albums/photos/matake_private.json",
118
118
  "spec/fake_json/albums/photos/post_with_valid_access_token.json",
119
+ "spec/fake_json/applications/feed/public.json",
119
120
  "spec/fake_json/applications/subscriptions/fb_graph_private.json",
120
121
  "spec/fake_json/applications/test_users/created.json",
121
122
  "spec/fake_json/applications/test_users/private.json",
@@ -157,6 +158,9 @@ Gem::Specification.new do |s|
157
158
  "spec/fake_json/posts/no_comments.json",
158
159
  "spec/fake_json/posts/platform_private.json",
159
160
  "spec/fake_json/posts/platform_public.json",
161
+ "spec/fake_json/posts/to_application.json",
162
+ "spec/fake_json/posts/to_event.json",
163
+ "spec/fake_json/posts/to_group.json",
160
164
  "spec/fake_json/query/user/with_invalid_token.json",
161
165
  "spec/fake_json/query/user/with_valid_token.json",
162
166
  "spec/fake_json/query/user/without_token.json",
@@ -311,7 +315,6 @@ Gem::Specification.new do |s|
311
315
  "spec/fb_graph/video_spec.rb",
312
316
  "spec/fb_graph/work_spec.rb",
313
317
  "spec/helpers/fake_json_helper.rb",
314
- "spec/restclient_with_ssl_support_spec.rb",
315
318
  "spec/spec.opts",
316
319
  "spec/spec_helper.rb"
317
320
  ]
@@ -407,7 +410,6 @@ Gem::Specification.new do |s|
407
410
  "spec/fb_graph/video_spec.rb",
408
411
  "spec/fb_graph/work_spec.rb",
409
412
  "spec/helpers/fake_json_helper.rb",
410
- "spec/restclient_with_ssl_support_spec.rb",
411
413
  "spec/spec_helper.rb"
412
414
  ]
413
415
 
data/lib/fb_graph/node.rb CHANGED
@@ -25,8 +25,11 @@ module FbGraph
25
25
  Connection.new(self, connection, options.merge(:collection => collection))
26
26
  end
27
27
 
28
+ def update(options = {})
29
+ post(options)
30
+ end
31
+
28
32
  def destroy(options = {})
29
- options[:access_token] ||= self.access_token if self.access_token
30
33
  delete(options)
31
34
  end
32
35
 
@@ -107,7 +110,7 @@ module FbGraph
107
110
  _response_ = _response_.with_indifferent_access
108
111
  if _response_[:error]
109
112
  case _response_[:error][:type]
110
- when 'OAuthAccessTokenException', 'QueryParseException', 'OAuthInvalidRequestException', 'OAuthInvalidTokenException', 'OAuthException'
113
+ when /OAuth/
111
114
  raise Unauthorized.new(_response_[:error][:message])
112
115
  else
113
116
  raise BadRequest.new("#{_response_[:error][:type]} :: #{_response_[:error][:message]}")
data/lib/fb_graph/post.rb CHANGED
@@ -25,8 +25,7 @@ module FbGraph
25
25
  elsif to[:version]
26
26
  Group.new(to.delete(:id), to)
27
27
  else
28
- case attributes[:context]
29
- when Application
28
+ if attributes[:context] == Application
30
29
  Application.new(to.delete(:id), to)
31
30
  else
32
31
  User.new(to.delete(:id), to)
@@ -0,0 +1,34 @@
1
+ {
2
+ "data": [{
3
+ "id": "134145643294322_191067404268812",
4
+ "from": {
5
+ "name": "Jr Nov",
6
+ "id": "1575327134"
7
+ },
8
+ "to": {
9
+ "data": [{
10
+ "name": "gem sample",
11
+ "id": "134145643294322"
12
+ }]
13
+ },
14
+ "message": "test test",
15
+ "type": "status",
16
+ "created_time": "2011-03-31T23:21:11+0000",
17
+ "updated_time": "2011-03-31T23:21:11+0000"
18
+ },
19
+ {
20
+ "id": "134145643294322_191067017602184",
21
+ "from": {
22
+ "name": "gem sample",
23
+ "id": "134145643294322"
24
+ },
25
+ "message": "test test",
26
+ "type": "status",
27
+ "created_time": "2011-03-31T23:18:46+0000",
28
+ "updated_time": "2011-03-31T23:18:46+0000"
29
+ }],
30
+ "paging": {
31
+ "previous": "https:\/\/graph.facebook.com\/134145643294322\/feed?limit=25&since=1301613671",
32
+ "next": "https:\/\/graph.facebook.com\/134145643294322\/feed?limit=25&until=1301613526"
33
+ }
34
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "id": "134145643294322_191067404268812",
3
+ "from": {
4
+ "name": "Jr Nov",
5
+ "id": "1575327134"
6
+ },
7
+ "to": {
8
+ "data": [{
9
+ "name": "gem sample",
10
+ "id": "134145643294322"
11
+ }]
12
+ },
13
+ "message": "test test",
14
+ "type": "status",
15
+ "created_time": "2011-03-31T23:21:11+0000",
16
+ "updated_time": "2011-03-31T23:21:11+0000"
17
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "id": "179404338773526_179404485440178",
3
+ "from": {
4
+ "name": "Nov Matake",
5
+ "id": "579612276"
6
+ },
7
+ "to": {
8
+ "data": [{
9
+ "name": "test",
10
+ "start_time": "2011-04-01T13:00:00",
11
+ "end_time": "2011-04-01T16:00:00",
12
+ "location": "\u305f\u307e\u304c\u308f",
13
+ "id": "179404338773526"
14
+ }]
15
+ },
16
+ "message": "test",
17
+ "type": "status",
18
+ "created_time": "2011-03-31T23:11:51+0000",
19
+ "updated_time": "2011-03-31T23:11:51+0000"
20
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "id": "135853383133307_175451429173502",
3
+ "from": {
4
+ "name": "Nishihara Hironori",
5
+ "id": "1272049161"
6
+ },
7
+ "to": {
8
+ "data": [
9
+ {
10
+ "version": 1,
11
+ "name": "07drecoms",
12
+ "id": "135853383133307"
13
+ }
14
+ ]
15
+ },
16
+ "message": "\u68ee\u6c38\u771f\u5f13\uff06\u6643",
17
+ "picture": "http://photos-a.ak.fbcdn.net/hphotos-ak-snc6/197134_1916368790222_1272049161_2239915_6558122_s.jpg",
18
+ "link": "http://www.facebook.com/photo.php?fbid=1916368790222&set=o.135853383133307",
19
+ "icon": "http://b.static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
20
+ "actions": [
21
+ {
22
+ "name": "Comment",
23
+ "link": "http://www.facebook.com/135853383133307/posts/175451429173502"
24
+ },
25
+ {
26
+ "name": "Like",
27
+ "link": "http://www.facebook.com/135853383133307/posts/175451429173502"
28
+ }
29
+ ],
30
+ "type": "photo",
31
+ "object_id": "1916368790222",
32
+ "created_time": "2011-03-31T23:35:12+0000",
33
+ "updated_time": "2011-03-31T23:35:12+0000",
34
+ "likes": {
35
+ "data": [
36
+ {
37
+ "name": "Yoshihiro Tsuchiya",
38
+ "id": "507869302"
39
+ },
40
+ {
41
+ "name": "Asami Morita",
42
+ "id": "100000996033938"
43
+ },
44
+ {
45
+ "name": "Keisuke Kimura",
46
+ "id": "100001417419834"
47
+ },
48
+ {
49
+ "name": "Daichi Totani",
50
+ "id": "1043778469"
51
+ }
52
+ ],
53
+ "count": 6
54
+ },
55
+ "comments": {
56
+ "data": [
57
+ {
58
+ "id": "135853383133307_175451429173502_176252145760097",
59
+ "from": {
60
+ "name": "Hidemi Hirakawa",
61
+ "id": "100001909772144"
62
+ },
63
+ "message": "\u30e2\u30c3\u30ea(\u7b11)\u8a00\u3044\u306b\u304f\u3059\u304e\u308b\uff01",
64
+ "created_time": "2011-03-31T16:16:42+0000"
65
+ },
66
+ {
67
+ "id": "135853383133307_175451429173502_176333432418635",
68
+ "from": {
69
+ "name": "Akira Masuzawa",
70
+ "id": "523602341"
71
+ },
72
+ "message": "\u30de\u30c3\u30b9\u3067\u3001\u5909\u308f\u3089\u3093\u3087\uff01\uff01",
73
+ "created_time": "2011-03-31T23:35:12+0000"
74
+ }
75
+ ],
76
+ "count": 17
77
+ }
78
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "error": {
3
- "type": "QueryParseException",
3
+ "type": "OAuthException",
4
4
  "message": "An active access token must be used to query information about the current user."
5
5
  }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "error": {
3
- "type": "QueryParseException",
3
+ "type": "OAuthException",
4
4
  "message": "An active access token must be used to query information about the current user."
5
5
  }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "error": {
3
- "type": "QueryParseException",
3
+ "type": "OAuthException",
4
4
  "message": "An active access token must be used to query information about the current user."
5
5
  }
6
6
  }
@@ -139,4 +139,43 @@ describe FbGraph::Post, '#fetch' do
139
139
  end
140
140
  end
141
141
 
142
+ end
143
+
144
+ describe FbGraph::Post, '#to' do
145
+ subject { post.to.first }
146
+
147
+ context 'when include Event' do
148
+ before do
149
+ fake_json(:get, 'to_event', 'posts/to_event')
150
+ end
151
+ let(:post) { FbGraph::Post.fetch('to_event') }
152
+ it { should be_instance_of FbGraph::Event }
153
+ end
154
+
155
+ context 'when include Application' do
156
+ context 'when fetched as Application#feed' do
157
+ before do
158
+ fake_json(:get, 'app/feed', 'applications/feed/public')
159
+ end
160
+ let(:post) { FbGraph::Application.new('app').feed.first }
161
+ it { should be_instance_of FbGraph::Application }
162
+ end
163
+
164
+ context 'otherwize' do # no way to detect this case..
165
+ before do
166
+ fake_json(:get, 'to_application', 'posts/to_application')
167
+ end
168
+ let(:post) { FbGraph::Post.fetch('to_application') }
169
+ it { should be_instance_of FbGraph::User }
170
+ end
171
+ end
172
+
173
+ context 'when include Group' do
174
+ before do
175
+ fake_json(:get, 'to_group?access_token=access_token', 'posts/to_group')
176
+ end
177
+ let(:post) { FbGraph::Post.fetch('to_group', :access_token => 'access_token') }
178
+ it { should be_instance_of FbGraph::Group }
179
+ end
180
+
142
181
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 5
10
- version: 1.6.5
9
+ - 7
10
+ version: 1.6.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-01 00:00:00 +09:00
18
+ date: 2011-04-22 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -233,6 +233,7 @@ files:
233
233
  - lib/fb_graph/work.rb
234
234
  - spec/fake_json/albums/photos/matake_private.json
235
235
  - spec/fake_json/albums/photos/post_with_valid_access_token.json
236
+ - spec/fake_json/applications/feed/public.json
236
237
  - spec/fake_json/applications/subscriptions/fb_graph_private.json
237
238
  - spec/fake_json/applications/test_users/created.json
238
239
  - spec/fake_json/applications/test_users/private.json
@@ -274,6 +275,9 @@ files:
274
275
  - spec/fake_json/posts/no_comments.json
275
276
  - spec/fake_json/posts/platform_private.json
276
277
  - spec/fake_json/posts/platform_public.json
278
+ - spec/fake_json/posts/to_application.json
279
+ - spec/fake_json/posts/to_event.json
280
+ - spec/fake_json/posts/to_group.json
277
281
  - spec/fake_json/query/user/with_invalid_token.json
278
282
  - spec/fake_json/query/user/with_valid_token.json
279
283
  - spec/fake_json/query/user/without_token.json
@@ -428,7 +432,6 @@ files:
428
432
  - spec/fb_graph/video_spec.rb
429
433
  - spec/fb_graph/work_spec.rb
430
434
  - spec/helpers/fake_json_helper.rb
431
- - spec/restclient_with_ssl_support_spec.rb
432
435
  - spec/spec.opts
433
436
  - spec/spec_helper.rb
434
437
  has_rdoc: true
@@ -553,5 +556,4 @@ test_files:
553
556
  - spec/fb_graph/video_spec.rb
554
557
  - spec/fb_graph/work_spec.rb
555
558
  - spec/helpers/fake_json_helper.rb
556
- - spec/restclient_with_ssl_support_spec.rb
557
559
  - spec/spec_helper.rb
@@ -1,23 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'spec_helper')
2
-
3
- describe RestClient do
4
- before do
5
- module RestClient
6
- class Request
7
- def self.execute(options = {})
8
- if options[:verify_ssl] == OpenSSL::SSL::VERIFY_PEER
9
- :secure
10
- else
11
- :insecure
12
- end
13
- end
14
- end
15
- end
16
- end
17
-
18
- it 'should support SSL' do
19
- [:get, :post, :put, :delete].each do |method|
20
- RestClient.send(method, 'https://example.com', {}).should == :secure
21
- end
22
- end
23
- end