fbgraph 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest CHANGED
@@ -1,12 +1,20 @@
1
+ Manifest
1
2
  README
3
+ README.textile
2
4
  Rakefile
5
+ TODO.list
6
+ fbgraph.gemspec
3
7
  lib/fbgraph.rb
4
8
  lib/fbgraph/authorization.rb
5
9
  lib/fbgraph/base.rb
6
10
  lib/fbgraph/client.rb
11
+ lib/fbgraph/realtime.rb
7
12
  lib/fbgraph/search.rb
8
13
  lib/fbgraph/selection.rb
9
14
  specs/lib/fbauth/authorization_spec.rb
10
15
  specs/lib/fbauth/base_spec.rb
16
+ specs/lib/fbauth/client_spec.rb
17
+ specs/lib/fbauth/realtime_spec.rb
11
18
  specs/lib/fbauth/search_spec.rb
12
- Manifest
19
+ specs/lib/fbauth/selection_spec.rb
20
+ specs/spec_helper.rb
data/README.textile ADDED
@@ -0,0 +1,214 @@
1
+ h2. FBGRaph
2
+
3
+ p. Facebook Open Graph API Gem.
4
+
5
+ h2. Installation
6
+
7
+ notextile. <code> gem install fbgraph</code>
8
+
9
+ p. Be sure to require it
10
+
11
+ notextile. <code>require "fbgraph"</code>
12
+
13
+ p. or add this line into Gemfile for Rails 3
14
+
15
+ notextile. <code>gem "fbgraph"</code>
16
+
17
+
18
+ h2. Example Apps
19
+
20
+ "Rails 3 Example":http://github.com/nsanta/fbgraph_example
21
+
22
+ h2. Usage
23
+
24
+ p. FBGraph supports the most (no analytics yet) features of Facebook Open Graph API: developers.facebook.com/docs/reference/api/
25
+
26
+ h3. Initialization
27
+
28
+ p. Without a token (for authorization)
29
+
30
+ notextile. <code>client = FBGraph::Client.new(:client_id => 'client_id',:secret_id =>'secret_id')</code>
31
+
32
+ p. With a token
33
+
34
+ notextile. <code>client = FBGraph::Client.new(:client_id => 'client_id',:secret_id =>'secret_id' ,:token => token)</code>
35
+
36
+ p. All methods are chainable
37
+
38
+ Examples:
39
+
40
+ notextile. <code>client.selection.me.photos.until(Time.now.to_s).since(3.days.ago).limit(10).info</code>
41
+
42
+ notextile. <code>client.selection.user('id').videos.offset(10).info</code>
43
+
44
+ notextile. <code>client.search.query('q').on('users').limit(20).info</code>
45
+
46
+ h3. Authorization
47
+
48
+ h4. client.authorization.authorize_url
49
+
50
+ p. returns the authorize url
51
+
52
+ notextile. <code> redirect_to client.authorization.authorize_url(:redirect_uri => callback_url , :scope => 'email,user_photos,friends_photos')</code>
53
+
54
+ h4. client.authorization.process_callback
55
+
56
+ p. process the callback and returns the access token
57
+
58
+ notextile. <code> access_token = client.authorization.process_callback(params[:code], :redirect_uri => callback_url)</code>
59
+
60
+
61
+ h3. Selection
62
+
63
+ h4. Accessing objects with connection types.
64
+
65
+ p. All objects and their connections can be accesed
66
+
67
+ Examples:
68
+
69
+ notextile. <code> client.selection.me.home.info!</code>
70
+
71
+ notextile. <code> client.selection.user('id').photos.info!</code>
72
+
73
+ notextile. <code> client.selection.photo('id').comments.info!</code>
74
+
75
+ notextile. <code> client.selection.page('id').info!</code>
76
+
77
+ p. Also you can get results of more than 1 objects
78
+
79
+ Example:
80
+
81
+ notextile. <code> client.selection.user([id1,id2,id3]).info!</code>
82
+
83
+
84
+ h4. client.selection.info!
85
+
86
+ p. request with GET for information and return the response parsed with JSON. You can disable the parsing passing false as a first and unique parameter
87
+
88
+ notextile. <code> user_info = client.selection.me.info! </code>
89
+
90
+
91
+ h3. Publishing
92
+
93
+ h4. client.selection.publish!
94
+
95
+ p. request with POST for publishing and return the response parsed with JSON. You can disable the parsing passing false as a first and unique parameter
96
+
97
+ notextile. <code> client.selection.post('id').comments.params(:message => 'comment test').publish! </code>
98
+
99
+ p. OR
100
+
101
+ notextile. <code> client.selection.post('id').comments.publish!(:message => 'comment test') </code>
102
+
103
+
104
+ h3. Deletion
105
+
106
+ h4. client.selection.delete!
107
+
108
+ p. request with DELETE for deletion and return the response parsed with JSON. You can disable the parsing passing false as a first and unique parameter
109
+
110
+ notextile. <code> client.selection.post('id').delete!</code>
111
+
112
+
113
+ h3. Picture
114
+
115
+
116
+ h4. client.selection.picture
117
+
118
+ p. return the url of the object picture
119
+
120
+ notextile. <code> client.selection.me.picture </code>
121
+
122
+
123
+ h3. Paging
124
+
125
+ h4. client.selection.limit
126
+
127
+
128
+ notextile. <code> client.selection.me.photos.limit(3).info! </code>
129
+
130
+ h4. client.selection.offset
131
+
132
+
133
+ notextile. <code> client.selection.me.photos.offset(10).info! </code>
134
+
135
+ h4. client.selection.until
136
+
137
+
138
+ notextile. <code> client.selection.me.photos.until(Time.now.to_s).info! </code>
139
+
140
+ h4. client.selection.since
141
+
142
+
143
+ notextile. <code> client.selection.me.photos.since(3.days.ago).info! </code>
144
+
145
+
146
+ h3. Search
147
+
148
+ h4. client.search.query('query').info!
149
+
150
+ p. Get the search results
151
+
152
+ notextile. <code> results = client.search.query('facebook').info! </code>
153
+
154
+
155
+ h4. client.search.query('query')on('type').info!
156
+
157
+ p. Get the search results by type
158
+
159
+ notextile. <code> results = client.search.query('facebook').on('home').info! </code>
160
+
161
+ h3. RealTime Updates
162
+
163
+ h4. client.realtime.user
164
+
165
+ h4. client.realtime.permissions
166
+
167
+ h4. client.realtime.errors
168
+
169
+ p. Set the object to be subscribed, modified or unsubscribed
170
+
171
+ h4. client.realtime.fields('email,picture')
172
+
173
+ p. Set the objects fields
174
+
175
+
176
+ h4. client.realtime.callback_url(url)
177
+
178
+ p. Set the callback url
179
+
180
+
181
+ h4. client.realtime.verify_token(token)
182
+
183
+ p. Set the verify token (optional)
184
+
185
+ h4. client.realtime.subscribe!
186
+
187
+ p. Send the request for add/modify a subscription for realtime Updates.
188
+
189
+
190
+ Examples:
191
+
192
+ notextile. <code> results = client.realtime.user.fields('email,picture').callback_url(url).verify_token('token').subscribe! </code>
193
+
194
+ notextile. <code> results = client.realtime.permissions.fields('read_stream').callback_url(url).subscribe! </code>
195
+
196
+ If you want delete a subscirpition, you can use the delete! method.
197
+
198
+ Examples:
199
+
200
+ notextile. <code> results = client.realtime.user.delete!</code>
201
+
202
+
203
+ h3. Analytics
204
+
205
+ h4. TODO
206
+
207
+ h3. Advanced
208
+
209
+ h4. not documented yet
210
+
211
+
212
+ h2. Contributions
213
+
214
+ p. Just do a pull request with the repo in sync.
data/Rakefile CHANGED
@@ -2,11 +2,11 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('fbgraph', '0.0.4') do |p|
5
+ Echoe.new('fbgraph', '0.0.5') 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']
11
+ p.development_dependencies = ['oauth2' , 'json']
12
12
  end
data/TODO.list ADDED
@@ -0,0 +1,7 @@
1
+ - Tests
2
+ - README
3
+ - Documentation
4
+ - Analytics
5
+ - Integrate with facebooker
6
+ - Pluginizable
7
+
data/fbgraph.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fbgraph}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
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.date = %q{2010-05-10}
9
+ s.date = %q{2010-05-11}
10
10
  s.description = %q{A Gem for Facebook Open Graph API}
11
11
  s.email = %q{nicolas55ar@gmail.com}
12
- s.extra_rdoc_files = ["README", "lib/fbgraph.rb", "lib/fbgraph/authorization.rb", "lib/fbgraph/base.rb", "lib/fbgraph/client.rb", "lib/fbgraph/search.rb", "lib/fbgraph/selection.rb"]
13
- s.files = ["README", "Rakefile", "lib/fbgraph.rb", "lib/fbgraph/authorization.rb", "lib/fbgraph/base.rb", "lib/fbgraph/client.rb", "lib/fbgraph/search.rb", "lib/fbgraph/selection.rb", "specs/lib/fbauth/authorization_spec.rb", "specs/lib/fbauth/base_spec.rb", "specs/lib/fbauth/search_spec.rb", "Manifest", "fbgraph.gemspec"]
12
+ 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"]
13
+ s.files = ["Manifest", "README", "README.textile", "Rakefile", "TODO.list", "fbgraph.gemspec", "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", "specs/lib/fbauth/authorization_spec.rb", "specs/lib/fbauth/base_spec.rb", "specs/lib/fbauth/client_spec.rb", "specs/lib/fbauth/realtime_spec.rb", "specs/lib/fbauth/search_spec.rb", "specs/lib/fbauth/selection_spec.rb", "specs/spec_helper.rb"]
14
14
  s.homepage = %q{http://github.com/nsanta/fbgraph}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fbgraph", "--main", "README"]
16
16
  s.require_paths = ["lib"]
@@ -24,10 +24,13 @@ Gem::Specification.new do |s|
24
24
 
25
25
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
26
  s.add_development_dependency(%q<oauth2>, [">= 0"])
27
+ s.add_development_dependency(%q<json>, [">= 0"])
27
28
  else
28
29
  s.add_dependency(%q<oauth2>, [">= 0"])
30
+ s.add_dependency(%q<json>, [">= 0"])
29
31
  end
30
32
  else
31
33
  s.add_dependency(%q<oauth2>, [">= 0"])
34
+ s.add_dependency(%q<json>, [">= 0"])
32
35
  end
33
36
  end
data/lib/fbgraph/base.rb CHANGED
@@ -2,7 +2,7 @@ module FBGraph
2
2
 
3
3
  class Base
4
4
 
5
- attr_reader :objects , :connection_type
5
+ attr_reader :objects , :connection_type
6
6
 
7
7
  def initialize(client)
8
8
  @client = client
@@ -22,18 +22,26 @@ module FBGraph
22
22
  return self
23
23
  end
24
24
 
25
- def params(params)
26
- @params = params
25
+ def params= (ps)
26
+ @params = ps
27
27
  return self
28
28
  end
29
-
30
29
 
31
- def info(parsed = true)
30
+ def params
31
+ @params
32
+ end
33
+
34
+ def param (pm)
35
+ @params.merge!(pm)
36
+ return self
37
+ end
38
+
39
+ def info!(parsed = true)
32
40
  if @objects.is_a? Array
33
- @params.merge!({:ids => ids.join(',')})
34
- uri = "/"
41
+ @params.merge!({:ids => @objects.join(',')})
42
+ uri = build_open_graph_path(nil,nil, @params)
35
43
  elsif @objects.is_a? String
36
- uri = build_open_graph_path(@objects , @connection_type)
44
+ uri = build_open_graph_path(@objects , @connection_type, @params)
37
45
  end
38
46
  puts "FBGRAPH [GET]: #{uri}"
39
47
  result = @client.consumer.get(uri)
@@ -41,7 +49,7 @@ module FBGraph
41
49
  end
42
50
 
43
51
 
44
- def publish(data = {},parsed = true)
52
+ def publish!(data = {},parsed = true)
45
53
  @params.merge!(data)
46
54
  uri = build_open_graph_path(@objects , @connection_type)
47
55
  puts "FBGRAPH [POST]: #{uri}"
@@ -49,7 +57,7 @@ module FBGraph
49
57
  return parsed ? JSON.parse(result) : result
50
58
  end
51
59
 
52
- def delete(parsed = true)
60
+ def delete!(parsed = true)
53
61
  uri = build_open_graph_path(@objects , nil)
54
62
  puts "FBGRAPH [DELETE]: #{uri}"
55
63
  result = @client.consumer.delete(uri , @params)
@@ -62,7 +70,6 @@ module FBGraph
62
70
  @params[:#{paging}] = value
63
71
  end
64
72
  PAGING
65
-
66
73
  end
67
74
 
68
75
 
@@ -25,6 +25,10 @@ module FBGraph
25
25
  def search
26
26
  FBGraph::Search.new(self)
27
27
  end
28
+
29
+ def realtime
30
+ FBGraph::Realtime.new(self)
31
+ end
28
32
 
29
33
 
30
34
  def oauth_client
@@ -0,0 +1,48 @@
1
+ module FBGraph
2
+ class Realtime < Base
3
+
4
+ def initialize(client)
5
+ @objects = 'subscriptions'
6
+ super(client)
7
+ end
8
+
9
+
10
+ OBJECTS = %w(user permissions errors).freeze
11
+
12
+ OBJECTS.each do |object|
13
+ class_eval <<-METHOD
14
+ def #{object}
15
+ @params[:object] = "#{object}"
16
+ self
17
+ end
18
+ METHOD
19
+ end
20
+
21
+ def fields(fs = "email,picture")
22
+ @params[:fields] = fs
23
+ self
24
+ end
25
+
26
+ def callback_url(url)
27
+ @params[:callback_url] = url
28
+ self
29
+ end
30
+
31
+ def veryfy_token(token)
32
+ @params[:veryfy_token] = token
33
+ self
34
+ end
35
+
36
+
37
+ alias_method :subscribe! , :publish!
38
+
39
+ private
40
+
41
+ def build_open_graph_path(objects,connection_type = nil , params = {})
42
+ request = "/" + [objects , connection_type].compact.join('/')
43
+ request += "?"+params.to_a.map{|p| p.join('=')}.join('&') unless params.empty?
44
+ request
45
+ end
46
+
47
+ end
48
+ end
@@ -1,8 +1,12 @@
1
1
  module FBGraph
2
2
  class Search < Base
3
+
4
+ def initialize(client)
5
+ @objects = 'search'
6
+ super(client)
7
+ end
3
8
 
4
9
  def query(q)
5
- @objects = 'search'
6
10
  @params = {:q => q}
7
11
  return self
8
12
  end
data/lib/fbgraph.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  require 'oauth2'
2
-
2
+ require 'json'
3
3
 
4
4
  require 'fbgraph/client'
5
5
  require 'fbgraph/base'
6
6
  require 'fbgraph/authorization'
7
7
  require 'fbgraph/selection'
8
8
  require 'fbgraph/search'
9
-
10
-
9
+ require 'fbgraph/realtime'
@@ -0,0 +1,46 @@
1
+ require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")
2
+
3
+ describe FBGraph do
4
+ describe FBGraph::Authorization do
5
+
6
+ before :each do
7
+ @client_id = 'client_id'
8
+ @secret_id = 'secret_id'
9
+ @client = FBGraph::Client.new(:client_id => @client_id,
10
+ :secret_id => @secret_id)
11
+ @authorization = FBGraph::Authorization.new(@client)
12
+ end
13
+
14
+ describe 'initialization' do
15
+ it 'should set the client' do
16
+ @authorization.instance_variable_get("@client").should == @client
17
+ end
18
+ end
19
+
20
+ describe "instance methods" do
21
+ describe '.authorize_url' do
22
+ it 'should return the authorization url' do
23
+ @authorization.authorize_url(:redirect_uri => 'redirect/to/path' ,
24
+ :scope => 'email,user_photos,friends_photos').should == "https://graph.facebook.com/oauth/authorize?scope=email%2Cuser_photos%2Cfriends_photos&client_id=client_id&type=web_server&redirect_uri=redirect%2Fto%2Fpath"
25
+ end
26
+ end
27
+ describe "process_callback" do
28
+ before :each do
29
+ @consumer = mock('Consumer' , :token => 'code')
30
+ options = {:redirect_uri => 'redirect/to/path'}
31
+ @client.stub!(:oauth_client)
32
+ @client.oauth_client.stub!(:web_server)
33
+ @client.oauth_client.web_server.stub!(:get_access_token).with(@consumer.token, options).and_return(@consumer)
34
+ @token = @authorization.process_callback(@consumer.token, options)
35
+ end
36
+ it 'should return the access_token' do
37
+ @token.should == @consumer.token
38
+ end
39
+ it 'should set the consumer' do
40
+ @client.consumer.should == @consumer
41
+ end
42
+ end
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,110 @@
1
+ require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")
2
+
3
+ describe FBGraph do
4
+ describe FBGraph::Authorization do
5
+
6
+ before :each do
7
+ @client_id = 'client_id'
8
+ @secret_id = 'secret_id'
9
+ @client = FBGraph::Client.new(:client_id => @client_id,
10
+ :secret_id => @secret_id,
11
+ :token => 'token')
12
+ @base = FBGraph::Base.new(@client)
13
+ end
14
+
15
+ describe 'initialization' do
16
+ it 'should set the client' do
17
+ @base.instance_variable_get("@client").should == @client
18
+ end
19
+ it 'should params be empty' do
20
+ @base.params.should be_empty
21
+ end
22
+ end
23
+
24
+ describe "instance methods" do
25
+ describe 'find' do
26
+ it 'should objects set with "id"' do
27
+ @base.find('id').objects.should == 'id'
28
+ end
29
+ end
30
+
31
+ describe 'connection' do
32
+ it 'should set connection_type to "type"' do
33
+ @base.connection('type').connection_type.should == 'type'
34
+ end
35
+ end
36
+
37
+ describe 'params=' do
38
+ it 'should set params to {:fields => "fields"}' do
39
+ @base.params = {:fields => "fields"}
40
+ @base.params.should == {:fields => "fields"}
41
+ end
42
+ end
43
+
44
+ describe 'params' do
45
+ it 'should return params' do
46
+ @base.params = {:fields => "fields"}
47
+ @base.params.should == {:fields => "fields"}
48
+ end
49
+ end
50
+
51
+ describe 'param' do
52
+ it 'should merge the passed param' do
53
+ @base.params = {:fields => "fields"}
54
+ @base.param(:merged => true)
55
+ @base.params.should == {:fields => "fields" , :merged => true}
56
+ end
57
+ end
58
+
59
+ describe 'info!' do
60
+ describe 'when object is an array' do
61
+ it 'should request with the path "/?ids=1,2,3"' do
62
+ uri = "/?ids?=1,2,3"
63
+ @base.find([1,2,3])
64
+ @client.consumer.stub!(:get).with(uri).and_return('')
65
+ @base.info!(false)
66
+ end
67
+ end
68
+
69
+ describe 'when object is a string' do
70
+
71
+ it 'should request with the path "/123"' do
72
+ uri = "/123"
73
+ @base.find('123')
74
+ @client.consumer.stub!(:get).with(uri).and_return('')
75
+ @base.info!(false)
76
+ end
77
+
78
+ describe 'when a connection is passed' do
79
+ it 'should request with the path "/123/home"' do
80
+ uri = "/123/home"
81
+ @base.find('123').connection('home')
82
+ @client.consumer.stub!(:get).with(uri).and_return('')
83
+ @base.info!(false)
84
+ end
85
+ end
86
+
87
+ describe 'when params are passed' do
88
+ it 'should request with the path "/123?fields=name,picture"' do
89
+ uri = "/123?fields=name,picture"
90
+ @base.find('123')
91
+ @base.params = {:fields => "name,picture"}
92
+ @client.consumer.stub!(:get).with(uri).and_return('')
93
+ @base.info!(false)
94
+ end
95
+ end
96
+ end
97
+ end
98
+
99
+ describe 'publish!' do
100
+
101
+ end
102
+
103
+ describe 'delete!' do
104
+
105
+ end
106
+
107
+ end
108
+
109
+ end
110
+ end
@@ -0,0 +1,84 @@
1
+ require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")
2
+
3
+ describe FBGraph do
4
+ describe FBGraph::Client do
5
+ describe "initialization" do
6
+ before :each do
7
+ @client_id = 'client_id'
8
+ @secret_id = 'secret_id'
9
+ end
10
+ describe 'default' do
11
+
12
+ before :each do
13
+ @client = FBGraph::Client.new(:client_id => @client_id,
14
+ :secret_id => @secret_id)
15
+ end
16
+
17
+ it 'should set the client_id' do
18
+ @client.client_id.should == @client_id
19
+ end
20
+ it 'should set the secret_id' do
21
+ @client.secret_id.should == @secret_id
22
+ end
23
+ it 'should set the facebook_uri ' do
24
+ @client.facebook_uri.should == "https://graph.facebook.com"
25
+ end
26
+ end
27
+
28
+ describe 'when token is present' do
29
+ before :each do
30
+ @token = 'token'
31
+ @client = FBGraph::Client.new(:client_id => @client_id,
32
+ :secret_id => @secret_id,
33
+ :token => @token)
34
+ end
35
+
36
+ it 'should set the access_token' do
37
+ @client.access_token.should == @token
38
+ end
39
+ it 'should set the consumer client' do
40
+ @client.consumer.class.should == OAuth2::AccessToken
41
+ end
42
+ end
43
+ end
44
+
45
+
46
+ describe "instance methods" do
47
+ before :each do
48
+ @client_id = 'client_id'
49
+ @secret_id = 'secret_id'
50
+ @client = FBGraph::Client.new(:client_id => @client_id,
51
+ :secret_id => @secret_id)
52
+ end
53
+ describe '.authorization' do
54
+ it 'should return a FBGraph::Authorization object' do
55
+ @client.authorization.class.should == FBGraph::Authorization
56
+ end
57
+ end
58
+
59
+ describe '.selection' do
60
+ it 'should return a FBGraph::Selection object' do
61
+ @client.selection.class.should == FBGraph::Selection
62
+ end
63
+ end
64
+
65
+ describe '.search' do
66
+ it 'should return a FBGraph::Search object' do
67
+ @client.search.class.should == FBGraph::Search
68
+ end
69
+ end
70
+
71
+ describe '.realtime' do
72
+ it 'should return a FBGraph::Search object' do
73
+ @client.realtime.class.should == FBGraph::Realtime
74
+ end
75
+ end
76
+
77
+ describe '.oauth_client' do
78
+ it 'should return a OAuth2::Client object' do
79
+ @client.oauth_client.class.should == OAuth2::Client
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")
2
+
3
+ describe FBGraph do
4
+ describe FBGraph::RealTime do
5
+
6
+ before :each do
7
+ @client_id = 'client_id'
8
+ @secret_id = 'secret_id'
9
+ @client = FBGraph::Client.new(:client_id => @client_id,
10
+ :secret_id => @secret_id)
11
+ @search = FBGraph::Search.new(@client)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,48 @@
1
+ require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")
2
+
3
+ describe FBGraph do
4
+ describe FBGraph::Search do
5
+
6
+ before :each do
7
+ @client_id = 'client_id'
8
+ @secret_id = 'secret_id'
9
+ @client = FBGraph::Client.new(:client_id => @client_id,
10
+ :secret_id => @secret_id)
11
+ @search = FBGraph::Search.new(@client)
12
+ end
13
+
14
+ describe "initialization" do
15
+ it "should set @object with 'search'" do
16
+ @search.objects.should == 'search'
17
+ end
18
+ end
19
+
20
+
21
+ describe 'instance methods' do
22
+
23
+ describe '.query' do
24
+ before(:each) do
25
+ @result = @search.query('query')
26
+ end
27
+ it 'should return self' do
28
+ @result.should == @search
29
+ end
30
+ it "should assign in params[:q] 'query'" do
31
+ @search.params[:q].should == 'query'
32
+ end
33
+ end
34
+ describe '.on' do
35
+ before(:each) do
36
+ @result = @search.on('type')
37
+ end
38
+ it 'should return self' do
39
+ @result.should == @search
40
+ end
41
+ it "should assign in params[:type] 'type'" do
42
+ @search.params[:type].should == 'type'
43
+ end
44
+ end
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__),"../../../lib/fbgraph")
2
+
3
+ describe FBGraph do
4
+ describe FBGraph::RealTime do
5
+
6
+ before :each do
7
+ @client_id = 'client_id'
8
+ @secret_id = 'secret_id'
9
+ @client = FBGraph::Client.new(:client_id => @client_id,
10
+ :secret_id => @secret_id)
11
+ @search = FBGraph::Search.new(@client)
12
+ end
13
+ end
14
+ end
File without changes
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nicolas Santa
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-10 00:00:00 -03:00
17
+ date: 2010-05-11 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -29,6 +29,18 @@ dependencies:
29
29
  version: "0"
30
30
  type: :development
31
31
  version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: json
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :development
43
+ version_requirements: *id002
32
44
  description: A Gem for Facebook Open Graph API
33
45
  email: nicolas55ar@gmail.com
34
46
  executables: []
@@ -37,26 +49,36 @@ extensions: []
37
49
 
38
50
  extra_rdoc_files:
39
51
  - README
52
+ - README.textile
53
+ - TODO.list
40
54
  - lib/fbgraph.rb
41
55
  - lib/fbgraph/authorization.rb
42
56
  - lib/fbgraph/base.rb
43
57
  - lib/fbgraph/client.rb
58
+ - lib/fbgraph/realtime.rb
44
59
  - lib/fbgraph/search.rb
45
60
  - lib/fbgraph/selection.rb
46
61
  files:
62
+ - Manifest
47
63
  - README
64
+ - README.textile
48
65
  - Rakefile
66
+ - TODO.list
67
+ - fbgraph.gemspec
49
68
  - lib/fbgraph.rb
50
69
  - lib/fbgraph/authorization.rb
51
70
  - lib/fbgraph/base.rb
52
71
  - lib/fbgraph/client.rb
72
+ - lib/fbgraph/realtime.rb
53
73
  - lib/fbgraph/search.rb
54
74
  - lib/fbgraph/selection.rb
55
75
  - specs/lib/fbauth/authorization_spec.rb
56
76
  - specs/lib/fbauth/base_spec.rb
77
+ - specs/lib/fbauth/client_spec.rb
78
+ - specs/lib/fbauth/realtime_spec.rb
57
79
  - specs/lib/fbauth/search_spec.rb
58
- - Manifest
59
- - fbgraph.gemspec
80
+ - specs/lib/fbauth/selection_spec.rb
81
+ - specs/spec_helper.rb
60
82
  has_rdoc: true
61
83
  homepage: http://github.com/nsanta/fbgraph
62
84
  licenses: []