fbgraph 0.0.5 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +4 -0
- data/README.textile +20 -1
- data/Rakefile +7 -2
- data/fbgraph.gemspec +9 -4
- data/lib/fbgraph.rb +2 -0
- data/lib/fbgraph/base.rb +8 -3
- data/lib/fbgraph/selection.rb +4 -2
- data/specs/lib/fbauth/authorization_spec.rb +1 -1
- data/specs/lib/fbauth/base_spec.rb +27 -4
- data/specs/lib/fbauth/client_spec.rb +1 -1
- data/specs/lib/fbauth/realtime_spec.rb +2 -2
- data/specs/lib/fbauth/search_spec.rb +1 -1
- data/specs/lib/fbauth/selection_spec.rb +22 -4
- data/specs/spec_helper.rb +2 -0
- metadata +39 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
data/README.textile
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
-
h2. FBGRaph
|
1
|
+
h2. FBGRaph (0.0.8)
|
2
2
|
|
3
3
|
p. Facebook Open Graph API Gem.
|
4
4
|
|
5
|
+
|
6
|
+
h2. Resources
|
7
|
+
|
8
|
+
* "View RDoc on RDoc.info":http://rdoc.info/projects/nsanta/fbgraph
|
9
|
+
|
10
|
+
* "View Source on GitHub":http://github.com/nsanta/fbgraph
|
11
|
+
|
12
|
+
* "Report Issues on GitHub":http://github.com/nsanta/fbgraph/issues
|
13
|
+
|
14
|
+
|
5
15
|
h2. Installation
|
6
16
|
|
7
17
|
notextile. <code> gem install fbgraph</code>
|
@@ -212,3 +222,12 @@ h4. not documented yet
|
|
212
222
|
h2. Contributions
|
213
223
|
|
214
224
|
p. Just do a pull request with the repo in sync.
|
225
|
+
|
226
|
+
|
227
|
+
h2. Contributors
|
228
|
+
|
229
|
+
"Victor Costan":http://github.com/costan
|
230
|
+
|
231
|
+
"Mark Bates":http://github.com/markbates
|
232
|
+
|
233
|
+
|
data/Rakefile
CHANGED
@@ -2,11 +2,16 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('fbgraph', '0.0.
|
5
|
+
Echoe.new('fbgraph', '0.0.8') do |p|
|
6
6
|
p.description = "A Gem for Facebook Open Graph API"
|
7
7
|
p.url = "http://github.com/nsanta/fbgraph"
|
8
8
|
p.author = "Nicolas Santa"
|
9
9
|
p.email = "nicolas55ar@gmail.com"
|
10
10
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
-
p.development_dependencies = ['oauth2' , 'json']
|
11
|
+
# p.development_dependencies = ['oauth2' , 'json']
|
12
|
+
p.runtime_dependencies = ['oauth2' , 'json', 'hashie']
|
13
|
+
end
|
14
|
+
|
15
|
+
Spec::Rake::SpecTask.new(:rspec) do |t|
|
16
|
+
t.spec_files = FileList[File.join(File.dirname(__FILE__), 'specs', '**', '*_spec.rb')]
|
12
17
|
end
|
data/fbgraph.gemspec
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{fbgraph}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.8"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Nicolas Santa"]
|
9
|
-
s.
|
9
|
+
s.cert_chain = ["/home/nicolas/certs/gem-public_cert.pem"]
|
10
|
+
s.date = %q{2010-05-29}
|
10
11
|
s.description = %q{A Gem for Facebook Open Graph API}
|
11
12
|
s.email = %q{nicolas55ar@gmail.com}
|
12
13
|
s.extra_rdoc_files = ["README", "README.textile", "TODO.list", "lib/fbgraph.rb", "lib/fbgraph/authorization.rb", "lib/fbgraph/base.rb", "lib/fbgraph/client.rb", "lib/fbgraph/realtime.rb", "lib/fbgraph/search.rb", "lib/fbgraph/selection.rb"]
|
@@ -16,6 +17,7 @@ Gem::Specification.new do |s|
|
|
16
17
|
s.require_paths = ["lib"]
|
17
18
|
s.rubyforge_project = %q{fbgraph}
|
18
19
|
s.rubygems_version = %q{1.3.6}
|
20
|
+
s.signing_key = %q{/home/nicolas/certs/gem-private_key.pem}
|
19
21
|
s.summary = %q{A Gem for Facebook Open Graph API}
|
20
22
|
|
21
23
|
if s.respond_to? :specification_version then
|
@@ -23,14 +25,17 @@ Gem::Specification.new do |s|
|
|
23
25
|
s.specification_version = 3
|
24
26
|
|
25
27
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.
|
27
|
-
s.
|
28
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0"])
|
29
|
+
s.add_runtime_dependency(%q<json>, [">= 0"])
|
30
|
+
s.add_runtime_dependency(%q<hashie>, [">= 0"])
|
28
31
|
else
|
29
32
|
s.add_dependency(%q<oauth2>, [">= 0"])
|
30
33
|
s.add_dependency(%q<json>, [">= 0"])
|
34
|
+
s.add_dependency(%q<hashie>, [">= 0"])
|
31
35
|
end
|
32
36
|
else
|
33
37
|
s.add_dependency(%q<oauth2>, [">= 0"])
|
34
38
|
s.add_dependency(%q<json>, [">= 0"])
|
39
|
+
s.add_dependency(%q<hashie>, [">= 0"])
|
35
40
|
end
|
36
41
|
end
|
data/lib/fbgraph.rb
CHANGED
data/lib/fbgraph/base.rb
CHANGED
@@ -45,7 +45,7 @@ module FBGraph
|
|
45
45
|
end
|
46
46
|
puts "FBGRAPH [GET]: #{uri}"
|
47
47
|
result = @client.consumer.get(uri)
|
48
|
-
return
|
48
|
+
return parse_json(result, parsed)
|
49
49
|
end
|
50
50
|
|
51
51
|
|
@@ -54,20 +54,21 @@ module FBGraph
|
|
54
54
|
uri = build_open_graph_path(@objects , @connection_type)
|
55
55
|
puts "FBGRAPH [POST]: #{uri}"
|
56
56
|
result = @client.consumer.post(uri , @params)
|
57
|
-
return
|
57
|
+
return parse_json(result, parsed)
|
58
58
|
end
|
59
59
|
|
60
60
|
def delete!(parsed = true)
|
61
61
|
uri = build_open_graph_path(@objects , nil)
|
62
62
|
puts "FBGRAPH [DELETE]: #{uri}"
|
63
63
|
result = @client.consumer.delete(uri , @params)
|
64
|
-
return
|
64
|
+
return parse_json(result, parsed)
|
65
65
|
end
|
66
66
|
|
67
67
|
%w(limit offset until since).each do |paging|
|
68
68
|
class_eval <<-PAGING
|
69
69
|
def #{paging}(value)
|
70
70
|
@params[:#{paging}] = value
|
71
|
+
self
|
71
72
|
end
|
72
73
|
PAGING
|
73
74
|
end
|
@@ -75,6 +76,10 @@ module FBGraph
|
|
75
76
|
|
76
77
|
private
|
77
78
|
|
79
|
+
def parse_json(result, parsed)
|
80
|
+
return parsed ? Hashie::Mash.new(JSON.parse(result)) : result
|
81
|
+
end
|
82
|
+
|
78
83
|
def build_open_graph_path(objects,connection_type = nil , params = {})
|
79
84
|
request = "/" + [objects , connection_type].compact.join('/')
|
80
85
|
request += "?"+params.to_a.map{|p| p.join('=')}.join('&') unless params.empty?
|
data/lib/fbgraph/selection.rb
CHANGED
@@ -5,7 +5,7 @@ module FBGraph
|
|
5
5
|
|
6
6
|
CONNECTION_TYPES = %w(home photos comments feed noreply
|
7
7
|
maybe invited attending declined picture
|
8
|
-
members
|
8
|
+
members tagged links groups albums
|
9
9
|
statuses videos notes posts events friends
|
10
10
|
activities interests music books movies television
|
11
11
|
likes inbox outbox updates).freeze
|
@@ -39,7 +39,9 @@ module FBGraph
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def picture
|
42
|
-
@client.facebook_uri + build_open_graph_path(@objects , 'picture')
|
42
|
+
uri = @client.facebook_uri + build_open_graph_path(@objects , 'picture')
|
43
|
+
return uri unless @client.consumer
|
44
|
+
uri + '?access_token=' + @client.consumer.token
|
43
45
|
end
|
44
46
|
|
45
47
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe FBGraph do
|
4
4
|
describe FBGraph::Authorization do
|
@@ -59,7 +59,7 @@ describe FBGraph do
|
|
59
59
|
describe 'info!' do
|
60
60
|
describe 'when object is an array' do
|
61
61
|
it 'should request with the path "/?ids=1,2,3"' do
|
62
|
-
uri = "/?ids
|
62
|
+
uri = "/?ids=1,2,3"
|
63
63
|
@base.find([1,2,3])
|
64
64
|
@client.consumer.stub!(:get).with(uri).and_return('')
|
65
65
|
@base.info!(false)
|
@@ -97,11 +97,34 @@ describe FBGraph do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
describe 'publish!' do
|
100
|
-
|
100
|
+
describe 'when is passed params before invocation' do
|
101
|
+
it 'should request with the path "/123" and params {:extra => "extra" }' do
|
102
|
+
uri = "/123"
|
103
|
+
@base.find('123')
|
104
|
+
@base.params = {:extra => "extra" }
|
105
|
+
@client.consumer.stub!(:post).with(uri , @base.params).and_return('')
|
106
|
+
@base.publish!({}, false)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
describe 'when is passed params on invocation' do
|
110
|
+
it 'should request with the path "/123" and params {:extra => "extra" }' do
|
111
|
+
uri = "/123"
|
112
|
+
@base.find('123')
|
113
|
+
ps = {:extra => "extra" }
|
114
|
+
@client.consumer.stub!(:post).with(uri , ps).and_return('')
|
115
|
+
@base.publish!(ps , false)
|
116
|
+
end
|
117
|
+
end
|
101
118
|
end
|
102
119
|
|
103
120
|
describe 'delete!' do
|
104
|
-
|
121
|
+
it 'should request with the path "/123" and params {:extra => "extra" }' do
|
122
|
+
uri = "/123"
|
123
|
+
@base.find('123')
|
124
|
+
@base.params = {:extra => "extra" }
|
125
|
+
@client.consumer.stub!(:delete).with(uri , @base.params).and_return('')
|
126
|
+
@base.delete!(false)
|
127
|
+
end
|
105
128
|
end
|
106
129
|
|
107
130
|
end
|
@@ -1,14 +1,32 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe FBGraph do
|
4
|
-
describe FBGraph::
|
4
|
+
describe FBGraph::Selection do
|
5
5
|
|
6
6
|
before :each do
|
7
7
|
@client_id = 'client_id'
|
8
8
|
@secret_id = 'secret_id'
|
9
|
+
@token = 'token'
|
9
10
|
@client = FBGraph::Client.new(:client_id => @client_id,
|
10
|
-
:secret_id => @secret_id
|
11
|
-
|
11
|
+
:secret_id => @secret_id,
|
12
|
+
:token => @token)
|
13
|
+
@selection = FBGraph::Selection.new(@client)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "when asking for an object's picture" do
|
17
|
+
it "should append the access token" do
|
18
|
+
@selection.me.picture.should ==
|
19
|
+
"https://graph.facebook.com/me/picture?access_token=#{@token}"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should not append an access token if none is available" do
|
23
|
+
client = FBGraph::Client.new(:client_id => @client_id,
|
24
|
+
:secret_id => @secret_id)
|
25
|
+
selection = FBGraph::Selection.new(client)
|
26
|
+
|
27
|
+
selection.me.picture.should ==
|
28
|
+
"https://graph.facebook.com/me/picture"
|
29
|
+
end
|
12
30
|
end
|
13
31
|
end
|
14
32
|
end
|
data/specs/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,16 +5,37 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 8
|
9
|
+
version: 0.0.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nicolas Santa
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
|
-
cert_chain:
|
15
|
+
cert_chain:
|
16
|
+
- |
|
17
|
+
-----BEGIN CERTIFICATE-----
|
18
|
+
MIIDODCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtuaWNv
|
19
|
+
bGFzNTVhcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
20
|
+
Y29tMB4XDTEwMDUwNzE4MzUwOFoXDTExMDUwNzE4MzUwOFowQjEUMBIGA1UEAwwL
|
21
|
+
bmljb2xhczU1YXIxFTATBgoJkiaJk/Is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 00:00:00 -03:00
|
18
39
|
default_executable:
|
19
40
|
dependencies:
|
20
41
|
- !ruby/object:Gem::Dependency
|
@@ -27,7 +48,7 @@ dependencies:
|
|
27
48
|
segments:
|
28
49
|
- 0
|
29
50
|
version: "0"
|
30
|
-
type: :
|
51
|
+
type: :runtime
|
31
52
|
version_requirements: *id001
|
32
53
|
- !ruby/object:Gem::Dependency
|
33
54
|
name: json
|
@@ -39,8 +60,20 @@ dependencies:
|
|
39
60
|
segments:
|
40
61
|
- 0
|
41
62
|
version: "0"
|
42
|
-
type: :
|
63
|
+
type: :runtime
|
43
64
|
version_requirements: *id002
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: hashie
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :runtime
|
76
|
+
version_requirements: *id003
|
44
77
|
description: A Gem for Facebook Open Graph API
|
45
78
|
email: nicolas55ar@gmail.com
|
46
79
|
executables: []
|
metadata.gz.sig
ADDED
Binary file
|