fb_graph2 0.0.1 → 0.0.2
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/achievement.rb +16 -0
- data/lib/fb_graph2/album.rb +10 -0
- data/lib/fb_graph2/attribute_assigner.rb +2 -0
- data/lib/fb_graph2/edge/achievements.rb +12 -0
- data/lib/fb_graph2/edge/activities.rb +12 -0
- data/lib/fb_graph2/edge/albums.rb +12 -0
- data/lib/fb_graph2/edge/books.rb +12 -0
- data/lib/fb_graph2/edge/events.rb +13 -0
- data/lib/fb_graph2/edge/family.rb +12 -0
- data/lib/fb_graph2/edge/friend_lists.rb +13 -0
- data/lib/fb_graph2/edge/games.rb +12 -0
- data/lib/fb_graph2/edge/groups.rb +12 -0
- data/lib/fb_graph2/edge/home.rb +12 -0
- data/lib/fb_graph2/edge/interests.rb +12 -0
- data/lib/fb_graph2/edge/likes.rb +17 -0
- data/lib/fb_graph2/edge/links.rb +12 -0
- data/lib/fb_graph2/edge/movies.rb +12 -0
- data/lib/fb_graph2/edge/music.rb +12 -0
- data/lib/fb_graph2/edge/posts.rb +12 -0
- data/lib/fb_graph2/edge/statuses.rb +12 -0
- data/lib/fb_graph2/edge/tagged.rb +12 -0
- data/lib/fb_graph2/edge/television.rb +12 -0
- data/lib/fb_graph2/event.rb +15 -0
- data/lib/fb_graph2/friend_list.rb +7 -0
- data/lib/fb_graph2/group.rb +18 -0
- data/lib/fb_graph2/node.rb +1 -0
- data/lib/fb_graph2/page.rb +2 -1
- data/lib/fb_graph2/user.rb +22 -2
- data/spec/fb_graph2/edge/accounts_spec.rb +1 -1
- data/spec/fb_graph2/edge/feed_spec.rb +22 -0
- data/spec/mock_json/success_with_id.json +3 -0
- data/spec/spec_helper/mock_graph.rb +4 -2
- metadata +29 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2611fb2baed301de340cfdbfa644d4f0253ad59a
|
4
|
+
data.tar.gz: 19d3d36952bc4ddfaef0d53c9e7615274a0937c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e35b7fd13586d1fff033a477b8778f9f1081f8f6488bc26d0d0ab3eeb135c507a2099a599e9baea5e86bffb3af9d0f6d647750a353abc688555a7fed7eee57d
|
7
|
+
data.tar.gz: aa88f0f71ebe57734aa1612dae49e32031faa369810959bcd552fc1c16b48456d01751e57acd726403d2dec9544ae7780101a17a195e6a0b82a26e7662463c9f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Achievement < Node
|
3
|
+
register_attributes(
|
4
|
+
raw: [:type, :no_feed_story],
|
5
|
+
time: [:publish_time],
|
6
|
+
application: [:application],
|
7
|
+
user: [:from],
|
8
|
+
custom: [:data]
|
9
|
+
)
|
10
|
+
|
11
|
+
def initialize(id, attributes = {})
|
12
|
+
super
|
13
|
+
# TODO: handle custom attributes.
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Edge
|
3
|
+
module Achievements
|
4
|
+
def achievements(params = {})
|
5
|
+
achievements = self.edge :achievements, params
|
6
|
+
achievements.collect do |achievement|
|
7
|
+
Achievement.new(achievement[:id], achievement).authenticate self.access_token
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Edge
|
3
|
+
module Events
|
4
|
+
def events(*args)
|
5
|
+
params = args.extract_options!
|
6
|
+
events = self.edge :events, params, edge_scope: args.first
|
7
|
+
events.collect do |event|
|
8
|
+
Event.new(event[:id], event).authenticate self.access_token
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Edge
|
3
|
+
module FriendLists
|
4
|
+
def friend_lists(params = {})
|
5
|
+
friend_lists = self.edge :friendlists, params
|
6
|
+
friend_lists.collect do |friend_list|
|
7
|
+
FriendList.new(friend_list[:id], friend_list).authenticate self.access_token
|
8
|
+
end
|
9
|
+
end
|
10
|
+
alias_method :friendlists, :friend_lists
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Edge
|
3
|
+
module Likes
|
4
|
+
def likes(params = {})
|
5
|
+
pages = self.edge :likes, params
|
6
|
+
pages.collect do |page|
|
7
|
+
Page.new(page[:id], page).authenticate self.access_token
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def liked?(page_id, params = {})
|
12
|
+
pages = self.edge :likes, params, edge_scope: page_id
|
13
|
+
pages.present?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Event < Node
|
3
|
+
register_attributes(
|
4
|
+
raw: [:description, :is_date_only, :location, :name, :privacy, :ticket_uri, :timezone],
|
5
|
+
time: [:end_time, :start_time, :updated_time],
|
6
|
+
page: [:venue],
|
7
|
+
custom: [:cover, :owner, :parent_group]
|
8
|
+
)
|
9
|
+
|
10
|
+
def initialize(id, attributes = {})
|
11
|
+
super
|
12
|
+
# TODO: handle custom attributes.
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module FbGraph2
|
2
|
+
class Group < Node
|
3
|
+
register_attributes(
|
4
|
+
raw: [
|
5
|
+
:description, :email, :icon, :link, :name, :privacy,
|
6
|
+
# NOTE: in groups edge context
|
7
|
+
:administrator, :bookmark_order, :unread
|
8
|
+
],
|
9
|
+
time: [:updated_time],
|
10
|
+
custom: [:cover, :owner, :parent]
|
11
|
+
)
|
12
|
+
|
13
|
+
def initialize(id, attributes = {})
|
14
|
+
super
|
15
|
+
# TODO: handle custom attributes.
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/fb_graph2/node.rb
CHANGED
data/lib/fb_graph2/page.rb
CHANGED
@@ -6,9 +6,10 @@ module FbGraph2
|
|
6
6
|
:current_location, :description, :directed_by, :founded, :general_info, :general_manager, :hometown,
|
7
7
|
:is_permanently_closed, :is_published, :is_unclaimed, :likes, :link, :mission, :name, :phone, :press_contact,
|
8
8
|
:products, :talking_about_count, :username, :website, :were_here_count,
|
9
|
-
# only within /:user_id/accounts context
|
9
|
+
# NOTE: only within /:user_id/accounts context
|
10
10
|
:perms
|
11
11
|
],
|
12
|
+
time: [:created_time],
|
12
13
|
date: [:birthday],
|
13
14
|
page: [:best_page],
|
14
15
|
custom: [
|
data/lib/fb_graph2/user.rb
CHANGED
@@ -1,14 +1,34 @@
|
|
1
1
|
module FbGraph2
|
2
2
|
class User < Node
|
3
3
|
include Edge::Accounts
|
4
|
-
include Edge::
|
4
|
+
include Edge::Achievements
|
5
|
+
include Edge::Activities
|
6
|
+
include Edge::Albums
|
7
|
+
include Edge::Books
|
8
|
+
include Edge::Events
|
9
|
+
include Edge::Family
|
5
10
|
include Edge::Feed
|
11
|
+
include Edge::FriendLists
|
12
|
+
include Edge::Friends
|
13
|
+
include Edge::Games
|
14
|
+
include Edge::Home
|
15
|
+
include Edge::Interests
|
16
|
+
include Edge::Likes
|
17
|
+
include Edge::Links
|
18
|
+
include Edge::Movies
|
19
|
+
include Edge::Music
|
20
|
+
include Edge::Posts
|
21
|
+
include Edge::Statuses
|
22
|
+
include Edge::Tagged
|
23
|
+
include Edge::Television
|
6
24
|
|
7
25
|
register_attributes(
|
8
26
|
raw: [
|
9
27
|
:about, :bio, :email, :first_name, :gender, :installed, :is_verified, :link, :locale,
|
10
28
|
:middle_name, :name, :name_format, :political, :quotes, :relationship_status, :religion,
|
11
|
-
:timezone, :third_party_id, :verified, :website
|
29
|
+
:timezone, :third_party_id, :verified, :website,
|
30
|
+
# NOTE: in family edge context
|
31
|
+
:relationship
|
12
32
|
],
|
13
33
|
time: [:updated_time], # NOTE: undocumented attribute
|
14
34
|
date: [:birthday],
|
@@ -5,7 +5,7 @@ describe FbGraph2::Edge::Accounts do
|
|
5
5
|
describe '#accounts' do
|
6
6
|
let(:me) { FbGraph2::User.me('token') }
|
7
7
|
it 'should return pages with page token' do
|
8
|
-
accounts = mock_graph :get, 'me/accounts', 'user/accounts' do
|
8
|
+
accounts = mock_graph :get, 'me/accounts', 'user/accounts', access_token: 'token' do
|
9
9
|
me.accounts
|
10
10
|
end
|
11
11
|
account = accounts.first
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph2::Edge::Feed do
|
4
|
+
context 'included in User' do
|
5
|
+
let(:me) { FbGraph2::User.me('token') }
|
6
|
+
|
7
|
+
describe '#feed' do
|
8
|
+
it :TODO
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'feed!' do
|
12
|
+
it 'should return FbGraph2::Post with posted params' do
|
13
|
+
post = mock_graph :post, 'me/feed', 'success_with_id', access_token: 'token' do
|
14
|
+
me.feed! message: 'hello'
|
15
|
+
end
|
16
|
+
post.should be_instance_of FbGraph2::Post
|
17
|
+
post.id.should == 'created_object_id'
|
18
|
+
post.message.should == 'hello'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -39,8 +39,10 @@ module MockGraph
|
|
39
39
|
def request_for(method, options = {})
|
40
40
|
request = {}
|
41
41
|
if options[:access_token]
|
42
|
-
|
43
|
-
|
42
|
+
request[:headers] ||= {}
|
43
|
+
request[:headers] = {
|
44
|
+
authorization: "Bearer #{options[:access_token]}"
|
45
|
+
}
|
44
46
|
end
|
45
47
|
if options[:params]
|
46
48
|
case method
|
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.0.2
|
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-05-
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -137,13 +137,37 @@ files:
|
|
137
137
|
- VERSION
|
138
138
|
- fb_graph2.gemspec
|
139
139
|
- lib/fb_graph2.rb
|
140
|
+
- lib/fb_graph2/achievement.rb
|
141
|
+
- lib/fb_graph2/album.rb
|
140
142
|
- lib/fb_graph2/application.rb
|
141
143
|
- lib/fb_graph2/attribute_assigner.rb
|
142
144
|
- lib/fb_graph2/collection.rb
|
143
145
|
- lib/fb_graph2/edge.rb
|
144
146
|
- lib/fb_graph2/edge/accounts.rb
|
147
|
+
- lib/fb_graph2/edge/achievements.rb
|
148
|
+
- lib/fb_graph2/edge/activities.rb
|
149
|
+
- lib/fb_graph2/edge/albums.rb
|
150
|
+
- lib/fb_graph2/edge/books.rb
|
151
|
+
- lib/fb_graph2/edge/events.rb
|
152
|
+
- lib/fb_graph2/edge/family.rb
|
145
153
|
- lib/fb_graph2/edge/feed.rb
|
154
|
+
- lib/fb_graph2/edge/friend_lists.rb
|
146
155
|
- lib/fb_graph2/edge/friends.rb
|
156
|
+
- lib/fb_graph2/edge/games.rb
|
157
|
+
- lib/fb_graph2/edge/groups.rb
|
158
|
+
- lib/fb_graph2/edge/home.rb
|
159
|
+
- lib/fb_graph2/edge/interests.rb
|
160
|
+
- lib/fb_graph2/edge/likes.rb
|
161
|
+
- lib/fb_graph2/edge/links.rb
|
162
|
+
- lib/fb_graph2/edge/movies.rb
|
163
|
+
- lib/fb_graph2/edge/music.rb
|
164
|
+
- lib/fb_graph2/edge/posts.rb
|
165
|
+
- lib/fb_graph2/edge/statuses.rb
|
166
|
+
- lib/fb_graph2/edge/tagged.rb
|
167
|
+
- lib/fb_graph2/edge/television.rb
|
168
|
+
- lib/fb_graph2/event.rb
|
169
|
+
- lib/fb_graph2/friend_list.rb
|
170
|
+
- lib/fb_graph2/group.rb
|
147
171
|
- lib/fb_graph2/node.rb
|
148
172
|
- lib/fb_graph2/page.rb
|
149
173
|
- lib/fb_graph2/post.rb
|
@@ -151,11 +175,13 @@ files:
|
|
151
175
|
- lib/fb_graph2/request_filter/debugger.rb
|
152
176
|
- lib/fb_graph2/user.rb
|
153
177
|
- spec/fb_graph2/edge/accounts_spec.rb
|
178
|
+
- spec/fb_graph2/edge/feed_spec.rb
|
154
179
|
- spec/fb_graph2/node_spec.rb
|
155
180
|
- spec/fb_graph2/node_subclass_spec.rb
|
156
181
|
- spec/fb_graph2/page_spec.rb
|
157
182
|
- spec/fb_graph2/user_spec.rb
|
158
183
|
- spec/fb_graph2_spec.rb
|
184
|
+
- spec/mock_json/success_with_id.json
|
159
185
|
- spec/mock_json/user/accounts.json
|
160
186
|
- spec/mock_json/user/me.json
|
161
187
|
- spec/spec_helper.rb
|
@@ -180,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
206
|
version: '0'
|
181
207
|
requirements: []
|
182
208
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.2.
|
209
|
+
rubygems_version: 2.2.2
|
184
210
|
signing_key:
|
185
211
|
specification_version: 4
|
186
212
|
summary: Facebook Graph API v2.0 Wrapper in Ruby
|