fb_graph 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fb_graph.gemspec +3 -2
- data/lib/fb_graph/application.rb +6 -6
- data/lib/fb_graph/checkin.rb +1 -1
- data/lib/fb_graph/connections/insights.rb +1 -1
- data/lib/fb_graph/connections/subscriptions.rb +51 -0
- data/lib/fb_graph/node.rb +2 -0
- data/lib/fb_graph/subscription.rb +8 -4
- data/lib/fb_graph.rb +1 -0
- metadata +6 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
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 = "0.
|
8
|
+
s.version = "0.8.0"
|
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{2010-09-
|
12
|
+
s.date = %q{2010-09-08}
|
13
13
|
s.description = %q{A Ruby wrapper for Facebook Graph API}
|
14
14
|
s.email = %q{nov@matake.jp}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -64,6 +64,7 @@ Gem::Specification.new do |s|
|
|
64
64
|
"lib/fb_graph/connections/picture.rb",
|
65
65
|
"lib/fb_graph/connections/posts.rb",
|
66
66
|
"lib/fb_graph/connections/statuses.rb",
|
67
|
+
"lib/fb_graph/connections/subscriptions.rb",
|
67
68
|
"lib/fb_graph/connections/tagged.rb",
|
68
69
|
"lib/fb_graph/connections/television.rb",
|
69
70
|
"lib/fb_graph/connections/videos.rb",
|
data/lib/fb_graph/application.rb
CHANGED
@@ -11,18 +11,18 @@ module FbGraph
|
|
11
11
|
include Connections::Videos
|
12
12
|
include Connections::Notes
|
13
13
|
include Connections::Events
|
14
|
-
|
14
|
+
include Connections::Subscriptions
|
15
15
|
include Connections::Insights
|
16
16
|
|
17
17
|
attr_accessor :name, :description, :category, :link, :secret
|
18
18
|
|
19
19
|
def initialize(client_id, attributes = {})
|
20
20
|
super
|
21
|
-
@name
|
22
|
-
@description
|
23
|
-
@category
|
24
|
-
@link
|
25
|
-
@secret
|
21
|
+
@name = attributes[:name]
|
22
|
+
@description = attributes[:description]
|
23
|
+
@category = attributes[:category]
|
24
|
+
@link = attributes[:link]
|
25
|
+
@secret = attributes[:secret]
|
26
26
|
end
|
27
27
|
|
28
28
|
def get_access_token(secret = nil)
|
data/lib/fb_graph/checkin.rb
CHANGED
@@ -5,7 +5,7 @@ module FbGraph
|
|
5
5
|
options[:access_token] ||= self.access_token || get_access_token(options[:secret])
|
6
6
|
insights = self.connection(:insights, options)
|
7
7
|
insights.map! do |insight|
|
8
|
-
|
8
|
+
Insight.new(insight.merge(:access_token => options[:access_token]))
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module FbGraph
|
2
|
+
module Connections
|
3
|
+
module Subscriptions
|
4
|
+
# == Fetch current subscriptions
|
5
|
+
#
|
6
|
+
# app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
|
7
|
+
# app.subscriptions
|
8
|
+
# => Array of FbGraph::Subscriptions
|
9
|
+
def subscriptions(options = {})
|
10
|
+
options[:access_token] ||= self.access_token || get_access_token(options[:secret])
|
11
|
+
subscriptions = self.connection(:subscriptions, options)
|
12
|
+
subscriptions.map! do |subscription|
|
13
|
+
Subscription.new(subscription.merge(:access_token => options[:access_token]))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# == Subscribe
|
18
|
+
#
|
19
|
+
# Subscriber have to setup PubSubHubbub subscriber endpoint.
|
20
|
+
# See details at "Subscription Verification" in the Facebook API document.
|
21
|
+
# ref) http://developers.facebook.com/docs/api/realtime
|
22
|
+
#
|
23
|
+
# app.subscribe!(
|
24
|
+
# :object => "user",
|
25
|
+
# :fields => "name,email",
|
26
|
+
# :callback_url => "http://fbgraphsample.heroku.com/subscription",
|
27
|
+
# :verify_token => "Define by yourself"
|
28
|
+
# )
|
29
|
+
# => Array of FbGraph::Subscriptions
|
30
|
+
def subscribe!(options = {})
|
31
|
+
options[:access_token] ||= self.access_token || get_access_token(options[:secret])
|
32
|
+
post(options.merge(:connection => 'subscriptions'))
|
33
|
+
end
|
34
|
+
|
35
|
+
# == Subscribe
|
36
|
+
#
|
37
|
+
# Delete all of your subscriptions.
|
38
|
+
# If you specify an object parameter, it will only delete the corresponding subscription.
|
39
|
+
# ref) http://developers.facebook.com/docs/api/realtime
|
40
|
+
#
|
41
|
+
# app.unsubscribe!(
|
42
|
+
# :object => "user"
|
43
|
+
# )
|
44
|
+
# => Array of FbGraph::Subscriptions
|
45
|
+
def unsubscribe!(options = {})
|
46
|
+
options[:access_token] ||= self.access_token || get_access_token(options[:secret])
|
47
|
+
destroy(options.merge(:connection => 'subscriptions'))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/fb_graph/node.rb
CHANGED
@@ -99,6 +99,8 @@ module FbGraph
|
|
99
99
|
# I've posted this issue on their forum, so hopefully I'll get a document about Graph API error responses.
|
100
100
|
# ref) http://forum.developers.facebook.com/viewtopic.php?pid=228256#p228256
|
101
101
|
raise FbGraph::NotFound.new('Graph API returned false, so probably it means your requested object is not found.')
|
102
|
+
when 'null'
|
103
|
+
nil
|
102
104
|
else
|
103
105
|
_response_ = JSON.parse(response.body).with_indifferent_access
|
104
106
|
if _response_[:error]
|
@@ -1,10 +1,14 @@
|
|
1
1
|
module FbGraph
|
2
|
-
class Subscription
|
2
|
+
class Subscription
|
3
|
+
include FbGraph::Comparison
|
4
|
+
|
3
5
|
attr_accessor :object, :fields, :callback_url, :active
|
4
6
|
|
5
|
-
def initialize(
|
6
|
-
|
7
|
-
|
7
|
+
def initialize(attributes = {})
|
8
|
+
@object = attributes[:object]
|
9
|
+
@fields = attributes[:fields]
|
10
|
+
@callback_url = attributes[:callback_url]
|
11
|
+
@active = attributes[:active]
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
data/lib/fb_graph.rb
CHANGED
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:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
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: 2010-09-
|
18
|
+
date: 2010-09-08 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/fb_graph/connections/picture.rb
|
177
177
|
- lib/fb_graph/connections/posts.rb
|
178
178
|
- lib/fb_graph/connections/statuses.rb
|
179
|
+
- lib/fb_graph/connections/subscriptions.rb
|
179
180
|
- lib/fb_graph/connections/tagged.rb
|
180
181
|
- lib/fb_graph/connections/television.rb
|
181
182
|
- lib/fb_graph/connections/videos.rb
|