fb_graph 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/fb_graph/connections/scores.rb +22 -0
- data/lib/fb_graph/event.rb +1 -0
- data/lib/fb_graph/score.rb +16 -0
- data/lib/fb_graph/user.rb +1 -0
- data/lib/fb_graph.rb +1 -0
- data/spec/fb_graph/connections/scores_spec.rb +40 -0
- data/spec/mock_json/users/scores/sample.json +15 -0
- metadata +23 -17
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.4
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module FbGraph
|
2
|
+
module Connections
|
3
|
+
module Scores
|
4
|
+
def scores(options = {})
|
5
|
+
scores = self.connection :scores, options
|
6
|
+
scores.map! do |score|
|
7
|
+
Score.new score[:id], score.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def score!(score, options = {})
|
14
|
+
post options.merge(:connection => :scores, :score => score)
|
15
|
+
end
|
16
|
+
|
17
|
+
def unscore!(options = {})
|
18
|
+
destroy options.merge(:connection => :scores)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/fb_graph/event.rb
CHANGED
@@ -7,6 +7,7 @@ module FbGraph
|
|
7
7
|
include Connections::Attending
|
8
8
|
include Connections::Declined
|
9
9
|
include Connections::Picture
|
10
|
+
include Connections::Videos
|
10
11
|
extend Searchable
|
11
12
|
|
12
13
|
attr_accessor :owner, :name, :description, :start_time, :end_time, :location, :venue, :privacy, :updated_time
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Score < Node
|
3
|
+
attr_accessor :user, :score, :application
|
4
|
+
|
5
|
+
def initialize(identifier, attributes = {})
|
6
|
+
super
|
7
|
+
if user = attributes[:user]
|
8
|
+
@user = User.new(user[:id], user)
|
9
|
+
end
|
10
|
+
if app = attributes[:application]
|
11
|
+
@application = Application.new(app[:id], app)
|
12
|
+
end
|
13
|
+
@score = attributes[:score]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/fb_graph/user.rb
CHANGED
data/lib/fb_graph.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph::Connections::Scores do
|
4
|
+
let(:user) { FbGraph::User.new('matake', :access_token => 'user_access_token') }
|
5
|
+
let(:app) { FbGraph::Application.new('FbGraph', :access_token => 'app_access_token') }
|
6
|
+
|
7
|
+
describe '#scores' do
|
8
|
+
it 'should return an Array of Score' do
|
9
|
+
mock_graph :get, 'matake/scores', 'users/scores/sample', :access_token => 'user_access_token' do
|
10
|
+
scores = user.scores
|
11
|
+
scores.should be_a Array
|
12
|
+
scores.should_not be_blank
|
13
|
+
scores.each do |score|
|
14
|
+
score.should be_instance_of FbGraph::Score
|
15
|
+
score.user.should be_instance_of FbGraph::User
|
16
|
+
score.application.should be_instance_of FbGraph::Application
|
17
|
+
score.score.should be_a Integer
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#score!' do
|
24
|
+
it 'should return true' do
|
25
|
+
mock_graph :post, 'matake/scores', 'true', :access_token => 'app_access_token', :params => {
|
26
|
+
:score => '10'
|
27
|
+
} do
|
28
|
+
user.score!(10, :access_token => app.access_token).should be_true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#unscore!' do
|
34
|
+
it 'should return true' do
|
35
|
+
mock_graph :delete, 'matake/scores', 'true', :access_token => 'app_access_token' do
|
36
|
+
user.unscore!(:access_token => app.access_token).should be_true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-15 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httpclient
|
16
|
-
requirement: &
|
16
|
+
requirement: &70109471211300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.2.0.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70109471211300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack-oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &70109471210800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.9.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70109471210800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70109471655900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.8'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70109471655900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cover_me
|
49
|
-
requirement: &
|
49
|
+
requirement: &70109471654980 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.2.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70109471654980
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70109471654140 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '2'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70109471654140
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
|
-
requirement: &
|
71
|
+
requirement: &70109471653060 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70109471653060
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: actionpack
|
82
|
-
requirement: &
|
82
|
+
requirement: &70109471651740 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 3.0.6
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70109471651740
|
91
91
|
description: A full-stack Facebook Graph API wrapper in Ruby.
|
92
92
|
email: nov@matake.jp
|
93
93
|
executables: []
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/fb_graph/connections/questions.rb
|
192
192
|
- lib/fb_graph/connections/reach_estimates.rb
|
193
193
|
- lib/fb_graph/connections/reviews.rb
|
194
|
+
- lib/fb_graph/connections/scores.rb
|
194
195
|
- lib/fb_graph/connections/senders.rb
|
195
196
|
- lib/fb_graph/connections/settings.rb
|
196
197
|
- lib/fb_graph/connections/statuses.rb
|
@@ -242,6 +243,7 @@ files:
|
|
242
243
|
- lib/fb_graph/question_option.rb
|
243
244
|
- lib/fb_graph/reach_estimate.rb
|
244
245
|
- lib/fb_graph/review.rb
|
246
|
+
- lib/fb_graph/score.rb
|
245
247
|
- lib/fb_graph/searchable.rb
|
246
248
|
- lib/fb_graph/searchable/result.rb
|
247
249
|
- lib/fb_graph/serialization.rb
|
@@ -334,6 +336,7 @@ files:
|
|
334
336
|
- spec/fb_graph/connections/questions_spec.rb
|
335
337
|
- spec/fb_graph/connections/reach_estimates_spec.rb
|
336
338
|
- spec/fb_graph/connections/reviews_spec.rb
|
339
|
+
- spec/fb_graph/connections/scores_spec.rb
|
337
340
|
- spec/fb_graph/connections/senders_spec.rb
|
338
341
|
- spec/fb_graph/connections/settings_spec.rb
|
339
342
|
- spec/fb_graph/connections/statuses_spec.rb
|
@@ -566,6 +569,7 @@ files:
|
|
566
569
|
- spec/mock_json/users/posts/arjun_private.json
|
567
570
|
- spec/mock_json/users/posts/arjun_public.json
|
568
571
|
- spec/mock_json/users/questions/sample.json
|
572
|
+
- spec/mock_json/users/scores/sample.json
|
569
573
|
- spec/mock_json/users/statuses/arjun_private.json
|
570
574
|
- spec/mock_json/users/statuses/arjun_public.json
|
571
575
|
- spec/mock_json/users/tagged/arjun_private.json
|
@@ -599,7 +603,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
599
603
|
version: '0'
|
600
604
|
requirements: []
|
601
605
|
rubyforge_project:
|
602
|
-
rubygems_version: 1.8.
|
606
|
+
rubygems_version: 1.8.12
|
603
607
|
signing_key:
|
604
608
|
specification_version: 3
|
605
609
|
summary: A full-stack Facebook Graph API wrapper in Ruby.
|
@@ -679,6 +683,7 @@ test_files:
|
|
679
683
|
- spec/fb_graph/connections/questions_spec.rb
|
680
684
|
- spec/fb_graph/connections/reach_estimates_spec.rb
|
681
685
|
- spec/fb_graph/connections/reviews_spec.rb
|
686
|
+
- spec/fb_graph/connections/scores_spec.rb
|
682
687
|
- spec/fb_graph/connections/senders_spec.rb
|
683
688
|
- spec/fb_graph/connections/settings_spec.rb
|
684
689
|
- spec/fb_graph/connections/statuses_spec.rb
|
@@ -911,6 +916,7 @@ test_files:
|
|
911
916
|
- spec/mock_json/users/posts/arjun_private.json
|
912
917
|
- spec/mock_json/users/posts/arjun_public.json
|
913
918
|
- spec/mock_json/users/questions/sample.json
|
919
|
+
- spec/mock_json/users/scores/sample.json
|
914
920
|
- spec/mock_json/users/statuses/arjun_private.json
|
915
921
|
- spec/mock_json/users/statuses/arjun_public.json
|
916
922
|
- spec/mock_json/users/tagged/arjun_private.json
|