fb_graph 2.7.5 → 2.7.6
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/VERSION +1 -1
- data/fb_graph.gemspec +1 -1
- data/lib/fb_graph.rb +1 -0
- data/lib/fb_graph/ad_connection_object.rb +3 -3
- data/lib/fb_graph/application.rb +1 -0
- data/lib/fb_graph/connections/reviews.rb +12 -0
- data/lib/fb_graph/question.rb +1 -1
- data/lib/fb_graph/review.rb +22 -0
- data/spec/fb_graph/ad_connection_object_spec.rb +17 -17
- data/spec/fb_graph/application_spec.rb +10 -0
- data/spec/fb_graph/connections/picture_spec.rb +3 -3
- data/spec/fb_graph/connections/reviews_spec.rb +15 -0
- data/spec/fb_graph/review_spec.rb +36 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ddbc9d52318ccd237c600eb21cde8b60025e4b8
|
4
|
+
data.tar.gz: 7aeab18dd996ee47a46f8ff7b3123aa51995a9a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66d264f673017f54f114539eedc07783d24f7e3ec5b22dcac5961dd267df8a684d267e2a7d9c403b0f9e095c0e75b30c6b715acedb9542cf6d95b748c99369ba
|
7
|
+
data.tar.gz: 1e3ba7a44f04ec56022f14facd63b50f0c4ef9dfd5da5a815c3861fe5a6d89be69f777b962191a4275edd3281d9329ad3f841c54feea59c1dd3d9a60b2abd9ce
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.6
|
data/fb_graph.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency "rcov", ">= 0.9"
|
24
24
|
end
|
25
25
|
s.add_development_dependency "rspec", ">= 2"
|
26
|
-
s.add_development_dependency "fb_graph-mock", ">= 0.1
|
26
|
+
s.add_development_dependency "fb_graph-mock", ">= 1.0.1"
|
27
27
|
s.add_development_dependency "actionpack", ">= 3.0.6"
|
28
28
|
end
|
data/lib/fb_graph.rb
CHANGED
@@ -9,7 +9,7 @@ module FbGraph
|
|
9
9
|
:place => 6,
|
10
10
|
:domain => 7
|
11
11
|
}
|
12
|
-
|
12
|
+
|
13
13
|
SUPPORTED_PLATFORM_TYPES = {
|
14
14
|
:web => 1,
|
15
15
|
:canvas => 2,
|
@@ -18,14 +18,14 @@ module FbGraph
|
|
18
18
|
:ipad => 5,
|
19
19
|
:android => 6
|
20
20
|
}
|
21
|
-
|
21
|
+
|
22
22
|
def initialize(identifier, attributes = {})
|
23
23
|
super
|
24
24
|
|
25
25
|
%w(name url type tabs picture).each do |field|
|
26
26
|
send("#{field}=", attributes[field.to_sym])
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
if self.type == TYPES[:application]
|
30
30
|
%w(is_game og_actions og_namespace og_objects supported_platforms).each do |field|
|
31
31
|
send("#{field}=", attributes[field.to_sym])
|
data/lib/fb_graph/application.rb
CHANGED
data/lib/fb_graph/question.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Review < Node
|
3
|
+
attr_accessor :from, :to, :message, :rating, :created_time
|
4
|
+
|
5
|
+
def initialize(identifier, attributes = {})
|
6
|
+
super
|
7
|
+
|
8
|
+
@from = if (from = attributes[:from])
|
9
|
+
User.new from[:id], from
|
10
|
+
end
|
11
|
+
@to = if (to = attributes[:to])
|
12
|
+
Application.new to[:id], to
|
13
|
+
end
|
14
|
+
@message = attributes[:message]
|
15
|
+
@rating = attributes[:rating]
|
16
|
+
|
17
|
+
if attributes[:created_time]
|
18
|
+
@created_time = Time.parse(attributes[:created_time]).utc
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -16,7 +16,7 @@ describe FbGraph::AdConnectionObject, '.new' do
|
|
16
16
|
"http://www.facebook.com/MyPage?sk=app_2373072222" => "Discussions"
|
17
17
|
},
|
18
18
|
:picture => "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41591_354545238178_3195000_s.jpg"
|
19
|
-
}
|
19
|
+
}
|
20
20
|
ad_connection = FbGraph::AdConnectionObject.new(attributes.delete(:id), attributes)
|
21
21
|
ad_connection.identifier.should == 354545238888
|
22
22
|
ad_connection.name.should == "MyPage"
|
@@ -28,30 +28,30 @@ describe FbGraph::AdConnectionObject, '.new' do
|
|
28
28
|
ad_connection.picture.should == "http://profile.ak.fbcdn.net/hprofile-ak-snc4/41591_354545238178_3195000_s.jpg"
|
29
29
|
ad_connection.tabs.should be_instance_of(Hash)
|
30
30
|
ad_connection.tabs["http://www.facebook.com/MyPage?sk=wall"].should == "Wall"
|
31
|
-
|
31
|
+
|
32
32
|
application_attributes = {
|
33
|
-
:id => 354545238889,
|
33
|
+
:id => 354545238889,
|
34
34
|
:is_game => false,
|
35
|
-
:name => "MyApp",
|
35
|
+
:name => "MyApp",
|
36
36
|
:og_actions => [{
|
37
|
-
:connected_objects => ["planes"],
|
38
|
-
:display_name => "Yaw",
|
39
|
-
:name => "app_name_space:yaw",
|
37
|
+
:connected_objects => ["planes"],
|
38
|
+
:display_name => "Yaw",
|
39
|
+
:name => "app_name_space:yaw",
|
40
40
|
:properties => []
|
41
|
-
}],
|
42
|
-
:og_namespace => "app_name_space",
|
41
|
+
}],
|
42
|
+
:og_namespace => "app_name_space",
|
43
43
|
:og_objects => [{
|
44
|
-
:display_name => "Plane",
|
45
|
-
:name => "planes",
|
44
|
+
:display_name => "Plane",
|
45
|
+
:name => "planes",
|
46
46
|
:properties => []
|
47
|
-
}],
|
48
|
-
:picture => "https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/y0/r/XsEg9L6Ie5_.jpg",
|
49
|
-
:supported_platforms => [2],
|
47
|
+
}],
|
48
|
+
:picture => "https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/y0/r/XsEg9L6Ie5_.jpg",
|
49
|
+
:supported_platforms => [2],
|
50
50
|
:tabs => [],
|
51
51
|
:type => 2,
|
52
52
|
:url => "http://apps.facebook.com/test_app/"
|
53
53
|
}
|
54
|
-
|
54
|
+
|
55
55
|
ad_connection = FbGraph::AdConnectionObject.new(application_attributes.delete(:id), application_attributes)
|
56
56
|
ad_connection.identifier.should == 354545238889
|
57
57
|
ad_connection.is_game.should == false
|
@@ -60,8 +60,8 @@ describe FbGraph::AdConnectionObject, '.new' do
|
|
60
60
|
ad_connection.og_actions.first.should be_instance_of(Hash)
|
61
61
|
ad_connection.og_namespace.should == "app_name_space"
|
62
62
|
ad_connection.og_objects.should be_instance_of(Array)
|
63
|
-
ad_connection.og_objects.first.should be_instance_of(Hash)
|
64
|
-
ad_connection.object.identifier.should == 354545238889
|
63
|
+
ad_connection.og_objects.first.should be_instance_of(Hash)
|
64
|
+
ad_connection.object.identifier.should == 354545238889
|
65
65
|
ad_connection.picture.should == "https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/y0/r/XsEg9L6Ie5_.jpg"
|
66
66
|
ad_connection.supported_platforms.should == [2]
|
67
67
|
ad_connection.tabs.should == []
|
@@ -248,4 +248,14 @@ describe FbGraph::Application do
|
|
248
248
|
it_behaves_like :token_debugger
|
249
249
|
end
|
250
250
|
end
|
251
|
+
|
252
|
+
describe '#reviews' do
|
253
|
+
it 'gets the reviews for this application' do
|
254
|
+
mock_graph :get, 'client_id/reviews', 'applications/reviews' do
|
255
|
+
app_reviews = app.reviews
|
256
|
+
app_reviews.count.should == 25
|
257
|
+
app_reviews.first.identifier.should == '10150351582136960'
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
251
261
|
end
|
@@ -24,7 +24,7 @@ describe FbGraph::Connections::Picture do
|
|
24
24
|
|
25
25
|
it 'should support width and height options at the same time' do
|
26
26
|
# Because we can't be sure of order of arguments and order by itself doesn't matter
|
27
|
-
FbGraph::User.new('matake').picture(:width => 13, :height => 37).should satisfy { |uri|
|
27
|
+
FbGraph::User.new('matake').picture(:width => 13, :height => 37).should satisfy { |uri|
|
28
28
|
[
|
29
29
|
File.join(FbGraph::ROOT_URL, "matake/picture?width=13&height=37"),
|
30
30
|
File.join(FbGraph::ROOT_URL, "matake/picture?height=37&width=13")
|
@@ -65,13 +65,13 @@ describe FbGraph::Connections::Picture do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should support width and height options at the same time' do
|
68
|
-
FbGraph::Page.new('platform').picture(:width => 13, :height => 37).should satisfy { |uri|
|
68
|
+
FbGraph::Page.new('platform').picture(:width => 13, :height => 37).should satisfy { |uri|
|
69
69
|
[
|
70
70
|
File.join(FbGraph::ROOT_URL, "platform/picture?width=13&height=37"),
|
71
71
|
File.join(FbGraph::ROOT_URL, "platform/picture?height=37&width=13")
|
72
72
|
].include? uri
|
73
73
|
}
|
74
|
-
end
|
74
|
+
end
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph::Connections::Reviews do
|
4
|
+
describe "#reviews" do
|
5
|
+
it "returns reviews for Facebook Application" do
|
6
|
+
mock_graph :get, '2439131959/reviews', 'applications/reviews' do
|
7
|
+
app_reviews = FbGraph::Application.new('2439131959').reviews
|
8
|
+
app_reviews.class.should == FbGraph::Connection
|
9
|
+
app_reviews.each do |review|
|
10
|
+
review.should be_instance_of(FbGraph::Review)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph::Review do
|
4
|
+
describe '.new' do
|
5
|
+
let(:attributes) do
|
6
|
+
{
|
7
|
+
id: '10150326116771960',
|
8
|
+
from: {
|
9
|
+
name: 'Erin Bennett',
|
10
|
+
id: '3326740'
|
11
|
+
},
|
12
|
+
to: {
|
13
|
+
name: 'Graffiti',
|
14
|
+
namespace: 'graffitiwall',
|
15
|
+
id: '2439131959'
|
16
|
+
},
|
17
|
+
message: 'awesome!',
|
18
|
+
rating: 5,
|
19
|
+
created_time: '2011-10-16T06:50:04+0000'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
subject do
|
23
|
+
FbGraph::Review.new attributes[:id], attributes
|
24
|
+
end
|
25
|
+
|
26
|
+
its(:from) do
|
27
|
+
should == FbGraph::User.new('3326740', name: 'Erin Bennett')
|
28
|
+
end
|
29
|
+
its(:to) do
|
30
|
+
should == FbGraph::Application.new('2439131959', name: 'Graffiti', namespace: 'graffitiwall')
|
31
|
+
end
|
32
|
+
its(:rating) { should == 5 }
|
33
|
+
its(:message) { should == 'awesome!' }
|
34
|
+
its(:created_time) { should == Time.parse('2011-10-16T06:50:04+0000') }
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.1
|
117
|
+
version: 1.0.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.1
|
124
|
+
version: 1.0.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: actionpack
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -249,6 +249,7 @@ files:
|
|
249
249
|
- lib/fb_graph/connections/question_options.rb
|
250
250
|
- lib/fb_graph/connections/questions.rb
|
251
251
|
- lib/fb_graph/connections/reach_estimates.rb
|
252
|
+
- lib/fb_graph/connections/reviews.rb
|
252
253
|
- lib/fb_graph/connections/roles.rb
|
253
254
|
- lib/fb_graph/connections/scores.rb
|
254
255
|
- lib/fb_graph/connections/senders.rb
|
@@ -310,6 +311,7 @@ files:
|
|
310
311
|
- lib/fb_graph/question.rb
|
311
312
|
- lib/fb_graph/question_option.rb
|
312
313
|
- lib/fb_graph/reach_estimate.rb
|
314
|
+
- lib/fb_graph/review.rb
|
313
315
|
- lib/fb_graph/role.rb
|
314
316
|
- lib/fb_graph/score.rb
|
315
317
|
- lib/fb_graph/searchable.rb
|
@@ -417,6 +419,7 @@ files:
|
|
417
419
|
- spec/fb_graph/connections/question_options_spec.rb
|
418
420
|
- spec/fb_graph/connections/questions_spec.rb
|
419
421
|
- spec/fb_graph/connections/reach_estimates_spec.rb
|
422
|
+
- spec/fb_graph/connections/reviews_spec.rb
|
420
423
|
- spec/fb_graph/connections/roles_spec.rb
|
421
424
|
- spec/fb_graph/connections/scores_spec.rb
|
422
425
|
- spec/fb_graph/connections/senders_spec.rb
|
@@ -473,6 +476,7 @@ files:
|
|
473
476
|
- spec/fb_graph/query_spec.rb
|
474
477
|
- spec/fb_graph/question_spec.rb
|
475
478
|
- spec/fb_graph/reach_estimate_spec.rb
|
479
|
+
- spec/fb_graph/review_spec.rb
|
476
480
|
- spec/fb_graph/searchable_spec.rb
|
477
481
|
- spec/fb_graph/seriarization_spec.rb
|
478
482
|
- spec/fb_graph/status_spec.rb
|
@@ -598,6 +602,7 @@ test_files:
|
|
598
602
|
- spec/fb_graph/connections/question_options_spec.rb
|
599
603
|
- spec/fb_graph/connections/questions_spec.rb
|
600
604
|
- spec/fb_graph/connections/reach_estimates_spec.rb
|
605
|
+
- spec/fb_graph/connections/reviews_spec.rb
|
601
606
|
- spec/fb_graph/connections/roles_spec.rb
|
602
607
|
- spec/fb_graph/connections/scores_spec.rb
|
603
608
|
- spec/fb_graph/connections/senders_spec.rb
|
@@ -654,6 +659,7 @@ test_files:
|
|
654
659
|
- spec/fb_graph/query_spec.rb
|
655
660
|
- spec/fb_graph/question_spec.rb
|
656
661
|
- spec/fb_graph/reach_estimate_spec.rb
|
662
|
+
- spec/fb_graph/review_spec.rb
|
657
663
|
- spec/fb_graph/searchable_spec.rb
|
658
664
|
- spec/fb_graph/seriarization_spec.rb
|
659
665
|
- spec/fb_graph/status_spec.rb
|