mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
basic user edges done
This commit is contained in:
parent
1fd1825e03
commit
c5d529be13
7 changed files with 76 additions and 0 deletions
12
lib/fb_graph2/edge/pokes.rb
Normal file
12
lib/fb_graph2/edge/pokes.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module FbGraph2
|
||||||
|
class Edge
|
||||||
|
module Pokes
|
||||||
|
def pokes(params = {})
|
||||||
|
pokes = self.edge :pokes, params
|
||||||
|
pokes.collect do |poke|
|
||||||
|
Struct::Poke.new poke
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
lib/fb_graph2/edge/scores.rb
Normal file
12
lib/fb_graph2/edge/scores.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module FbGraph2
|
||||||
|
class Edge
|
||||||
|
module Scores
|
||||||
|
def scores(params = {})
|
||||||
|
scores = self.edge :scores, params
|
||||||
|
scores.collect do |score|
|
||||||
|
Struct::Score.new score
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
18
lib/fb_graph2/edge/videos.rb
Normal file
18
lib/fb_graph2/edge/videos.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
module FbGraph2
|
||||||
|
class Edge
|
||||||
|
module Videos
|
||||||
|
def videos(*args)
|
||||||
|
params = args.extract_options!
|
||||||
|
videos = self.edge :videos, params, edge_scope: args.first
|
||||||
|
videos.collect do |video|
|
||||||
|
Video.new(video[:id], video).authenticate self.access_token
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def video!(params = {})
|
||||||
|
video = post params, edge: :videos
|
||||||
|
Video.new(video[:id], params.merge(video)).authenticate self.access_token
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
10
lib/fb_graph2/struct/poke.rb
Normal file
10
lib/fb_graph2/struct/poke.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module FbGraph2
|
||||||
|
class Struct
|
||||||
|
class Poke < Struct
|
||||||
|
register_attributes(
|
||||||
|
time: [:created_time],
|
||||||
|
user: [:from, :to]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
lib/fb_graph2/struct/score.rb
Normal file
11
lib/fb_graph2/struct/score.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
module FbGraph2
|
||||||
|
class Struct
|
||||||
|
class Poke < Struct
|
||||||
|
register_attributes(
|
||||||
|
raw: [:score],
|
||||||
|
user: [:user],
|
||||||
|
application: [:application]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -22,10 +22,13 @@ module FbGraph2
|
||||||
include Edge::Permissions
|
include Edge::Permissions
|
||||||
include Edge::Picture
|
include Edge::Picture
|
||||||
include Edge::Photos
|
include Edge::Photos
|
||||||
|
include Edge::Pokes
|
||||||
include Edge::Posts
|
include Edge::Posts
|
||||||
|
include Edge::Scores
|
||||||
include Edge::Statuses
|
include Edge::Statuses
|
||||||
include Edge::Tagged
|
include Edge::Tagged
|
||||||
include Edge::Television
|
include Edge::Television
|
||||||
|
include Edge::Videos
|
||||||
|
|
||||||
register_attributes(
|
register_attributes(
|
||||||
raw: [
|
raw: [
|
||||||
|
|
10
lib/fb_graph2/video.rb
Normal file
10
lib/fb_graph2/video.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module FbGraph2
|
||||||
|
class Video < Node
|
||||||
|
register_attributes(
|
||||||
|
raw: [:description, :embed_html, :icon, :length, :name, :picture, :source],
|
||||||
|
time: [:created_time, :updated_time],
|
||||||
|
profile: [:from],
|
||||||
|
custom: [:format, :thumbnails]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue