fb_graph2 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/fb_graph2/auth.rb +1 -1
- data/lib/fb_graph2/edge/invitable_friends.rb +2 -2
- data/lib/fb_graph2/edge/notifications.rb +1 -2
- data/lib/fb_graph2/edge/taggable_friends.rb +12 -0
- data/lib/fb_graph2/node.rb +5 -1
- data/lib/fb_graph2/struct/friend.rb +10 -0
- data/lib/fb_graph2/user.rb +1 -0
- data/spec/fb_graph2/edge/invitable_friends_spec.rb +2 -2
- data/spec/fb_graph2/edge/taggable_friends_spec.rb +18 -0
- data/spec/fb_graph2/user_spec.rb +13 -0
- data/spec/mock_json/user/me_with_ext_attrs.json +65 -0
- data/spec/mock_json/user/taggable_friends.json +27 -0
- metadata +7 -3
- data/lib/fb_graph2/struct/invitable_friend.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5d3c2c9db1f215157ae1db4631bc68713a8acd
|
4
|
+
data.tar.gz: 4bdda11d0b45da1de00c6d047c0aaa18d0bcebcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da28587bf9edf922972307a8d163f42e8e3df5d27a468104c6080d293f81c2371ab945d14b805aa9df7936366ec4f0182e028785d83538d1e3f4da57de0dd17
|
7
|
+
data.tar.gz: a5618e8d32e7f9d6a51c7a9f56e6c14054c9db4ceb2e105c5ea8607731673f50453cc972296b72f48568263d27bed64b7b13249db5055ad0a9974a18d62fe62b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/fb_graph2/auth.rb
CHANGED
@@ -3,8 +3,8 @@ module FbGraph2
|
|
3
3
|
module InvitableFriends
|
4
4
|
def invitable_friends(params = {})
|
5
5
|
invitable_friends = self.edge :invitable_friends, params
|
6
|
-
invitable_friends.collect do |
|
7
|
-
Struct::
|
6
|
+
invitable_friends.collect do |friend|
|
7
|
+
Struct::Friend.new friend
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/fb_graph2/node.rb
CHANGED
@@ -112,7 +112,11 @@ module FbGraph2
|
|
112
112
|
_response_ = _response_.with_indifferent_access if _response_.respond_to? :with_indifferent_access
|
113
113
|
case response.status
|
114
114
|
when 200...300
|
115
|
-
_response_
|
115
|
+
if _response_.respond_to?(:include?) && _response_.include?(:success)
|
116
|
+
_response_[:success]
|
117
|
+
else
|
118
|
+
_response_
|
119
|
+
end
|
116
120
|
else
|
117
121
|
raise Exception.detect(response.status, _response_, response.headers)
|
118
122
|
end
|
data/lib/fb_graph2/user.rb
CHANGED
@@ -4,13 +4,13 @@ describe FbGraph2::Edge::InvitableFriends do
|
|
4
4
|
context 'included in User' do
|
5
5
|
describe '#invitable_friends' do
|
6
6
|
let(:me) { FbGraph2::User.me('token') }
|
7
|
-
it 'should return an Array of FbGraph2::Struct::
|
7
|
+
it 'should return an Array of FbGraph2::Struct::Friend' do
|
8
8
|
users = mock_graph :get, 'me/invitable_friends', 'user/invitable_friends', access_token: 'token' do
|
9
9
|
me.invitable_friends
|
10
10
|
end
|
11
11
|
users.should_not be_blank
|
12
12
|
users.each do |user|
|
13
|
-
user.should be_instance_of FbGraph2::Struct::
|
13
|
+
user.should be_instance_of FbGraph2::Struct::Friend
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph2::Edge::TaggableFriends do
|
4
|
+
context 'included in User' do
|
5
|
+
describe '#taggable_friends' do
|
6
|
+
let(:me) { FbGraph2::User.me('token') }
|
7
|
+
it 'should return an Array of FbGraph2::Struct::Friend' do
|
8
|
+
users = mock_graph :get, 'me/taggable_friends', 'user/taggable_friends', access_token: 'token' do
|
9
|
+
me.taggable_friends
|
10
|
+
end
|
11
|
+
users.should_not be_blank
|
12
|
+
users.each do |user|
|
13
|
+
user.should be_instance_of FbGraph2::Struct::Friend
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/fb_graph2/user_spec.rb
CHANGED
@@ -18,6 +18,19 @@ describe FbGraph2::User do
|
|
18
18
|
end
|
19
19
|
me.should be_instance_of klass
|
20
20
|
end
|
21
|
+
|
22
|
+
context 'when ext attrs included' do
|
23
|
+
it 'should success to parse' do
|
24
|
+
me = mock_graph :get, 'me', 'user/me_with_ext_attrs' do
|
25
|
+
klass.me('token').fetch
|
26
|
+
end
|
27
|
+
[
|
28
|
+
:age_range, :context, :currency, :devices
|
29
|
+
].each do |key|
|
30
|
+
me.send(key).should be_present
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
21
34
|
end
|
22
35
|
end
|
23
36
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
{
|
2
|
+
"age_range": {
|
3
|
+
"min": 21
|
4
|
+
},
|
5
|
+
"context": {
|
6
|
+
"mutual_friends": {
|
7
|
+
"data": [],
|
8
|
+
"summary": {
|
9
|
+
"total_count": 245
|
10
|
+
}
|
11
|
+
},
|
12
|
+
"mutual_likes": {
|
13
|
+
"data": [{
|
14
|
+
"category": "Product/service",
|
15
|
+
"name": "GSMA Mobile World Congress",
|
16
|
+
"id": "177607143648"
|
17
|
+
}, {
|
18
|
+
"category": "Business/economy website",
|
19
|
+
"name": "デザイナーズSOHOオフィスなら【SOHO東京】",
|
20
|
+
"id": "140108926038346"
|
21
|
+
}, {
|
22
|
+
"category": "Real estate",
|
23
|
+
"category_list": [{
|
24
|
+
"id": "198327773511962",
|
25
|
+
"name": "Real Estate"
|
26
|
+
}],
|
27
|
+
"name": "ジョイライフスタイル",
|
28
|
+
"id": "117500321741291"
|
29
|
+
}, {
|
30
|
+
"category": "Internet/software",
|
31
|
+
"category_list": [{
|
32
|
+
"id": "10101472279007861",
|
33
|
+
"name": "Internet/Software"
|
34
|
+
}],
|
35
|
+
"name": "Engineerrise",
|
36
|
+
"id": "565244630160593"
|
37
|
+
}, {
|
38
|
+
"category": "Electronics",
|
39
|
+
"name": "Rapiro",
|
40
|
+
"id": "124199987785627"
|
41
|
+
}],
|
42
|
+
"paging": {
|
43
|
+
"next": "https://graph.facebook.com/v2.0/579612276?pretty=1&fields=context.fields(mutual_likes.limit(5).after(MTI0MTk5OTg3Nzg1NjI3))",
|
44
|
+
"cursors": {
|
45
|
+
"before": "MTc3NjA3MTQzNjQ4",
|
46
|
+
"after": "MTI0MTk5OTg3Nzg1NjI3"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"summary": {
|
50
|
+
"total_count": 89
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"currency": {
|
55
|
+
"currency_offset": 1,
|
56
|
+
"usd_exchange": 0.0097614,
|
57
|
+
"usd_exchange_inverse": 102.4443215113,
|
58
|
+
"user_currency": "JPY"
|
59
|
+
},
|
60
|
+
"devices": [{
|
61
|
+
"hardware": "iPhone",
|
62
|
+
"os": "iOS"
|
63
|
+
}],
|
64
|
+
"id": "579612276"
|
65
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"data": [{
|
3
|
+
"id": "AVm6afobc20T0wATmCYRk_CNymo_44MQW8yMBwpgDFAQ18iF9feZpDEDmwfmcjSBSSuYkFfD5fx77g_uJRF0fmQ7AR2kObX8biP4wzN7UMpbYQ",
|
4
|
+
"name": "Shingo Yamanaka",
|
5
|
+
"picture": {
|
6
|
+
"data": {
|
7
|
+
"is_silhouette": false,
|
8
|
+
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpf1/t1.0-1/c0.15.85.85/s50x50/1468668_10152037195781416_2050550170_s.jpg"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}, {
|
12
|
+
"id": "AVnJiIlmAtrWJ106ErRPlLZNy8_Hd4mfmuQBrbGm4tuFS_ENvyYdVxTwgesXE5Wp2ICtxcPHzkA4Y4BJAWwJqyUie2ZDKQeKn9mnjPCVAUr8Lg",
|
13
|
+
"name": "Hayashi Tatsuya",
|
14
|
+
"picture": {
|
15
|
+
"data": {
|
16
|
+
"is_silhouette": false,
|
17
|
+
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xaf1/t1.0-1/c79.38.479.479/s50x50/388771_10150501378984825_523522119_n.jpg"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}],
|
21
|
+
"paging": {
|
22
|
+
"cursors": {
|
23
|
+
"before": "QVZra09GaExkNndsM1J5eVpuQ2dWS1hLV3FBb0dqRTh3dC1PVXJIZE8ya0JzbV9kUDZXcWZEdUtUZFNHejcxeGlWZ3JjZjZjdkIwMWdtSWtHZGpGVE8wTWZ5cUdNUm5NWWw3c2hSTEtPZ19ySmc=",
|
24
|
+
"after": "QVZrdlNsUHItNExPY1JIUVdlZ3BDZlFCTHFFMUl6YVhnVG5fRVlBLVV0QThUMFBmRnZNQkVQWVg2VkRBQWhRa3RyemVQUFhscWxBVERYZU15SExZbG50Z0RTQUtfVno5VjRjT3VUb2J5NGg1VFE="
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- lib/fb_graph2/edge/static_resources.rb
|
222
222
|
- lib/fb_graph2/edge/statuses.rb
|
223
223
|
- lib/fb_graph2/edge/subscriptions.rb
|
224
|
+
- lib/fb_graph2/edge/taggable_friends.rb
|
224
225
|
- lib/fb_graph2/edge/tagged.rb
|
225
226
|
- lib/fb_graph2/edge/tagged_places.rb
|
226
227
|
- lib/fb_graph2/edge/tags.rb
|
@@ -258,9 +259,9 @@ files:
|
|
258
259
|
- lib/fb_graph2/struct/currency.rb
|
259
260
|
- lib/fb_graph2/struct/device.rb
|
260
261
|
- lib/fb_graph2/struct/education.rb
|
262
|
+
- lib/fb_graph2/struct/friend.rb
|
261
263
|
- lib/fb_graph2/struct/group_file.rb
|
262
264
|
- lib/fb_graph2/struct/image_source.rb
|
263
|
-
- lib/fb_graph2/struct/invitable_friend.rb
|
264
265
|
- lib/fb_graph2/struct/location.rb
|
265
266
|
- lib/fb_graph2/struct/parking.rb
|
266
267
|
- lib/fb_graph2/struct/payment_options.rb
|
@@ -316,6 +317,7 @@ files:
|
|
316
317
|
- spec/fb_graph2/edge/shared_posts_spec.rb
|
317
318
|
- spec/fb_graph2/edge/statuses_spec.rb
|
318
319
|
- spec/fb_graph2/edge/subscriptions_spec.rb
|
320
|
+
- spec/fb_graph2/edge/taggable_friends_spec.rb
|
319
321
|
- spec/fb_graph2/edge/television_spec.rb
|
320
322
|
- spec/fb_graph2/edge/test_users_spec.rb
|
321
323
|
- spec/fb_graph2/edge/videos_spec.rb
|
@@ -360,6 +362,7 @@ files:
|
|
360
362
|
- spec/mock_json/user/likes.json
|
361
363
|
- spec/mock_json/user/links.json
|
362
364
|
- spec/mock_json/user/me.json
|
365
|
+
- spec/mock_json/user/me_with_ext_attrs.json
|
363
366
|
- spec/mock_json/user/movies.json
|
364
367
|
- spec/mock_json/user/music.json
|
365
368
|
- spec/mock_json/user/notifications.json
|
@@ -370,6 +373,7 @@ files:
|
|
370
373
|
- spec/mock_json/user/posts.json
|
371
374
|
- spec/mock_json/user/scores.json
|
372
375
|
- spec/mock_json/user/statuses.json
|
376
|
+
- spec/mock_json/user/taggable_friends.json
|
373
377
|
- spec/mock_json/user/television.json
|
374
378
|
- spec/mock_json/user/videos.json
|
375
379
|
- spec/spec_helper.rb
|