fb_graph 1.7.4 → 1.7.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/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/fb_graph/album.rb +9 -0
- data/lib/fb_graph/connections/picture.rb +2 -3
- data/spec/fb_graph/album_spec.rb +75 -54
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fb_graph (1.7.
|
4
|
+
fb_graph (1.7.4)
|
5
5
|
rack-oauth2 (>= 0.6.5)
|
6
6
|
|
7
7
|
GEM
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
json (1.5.1)
|
17
17
|
mime-types (1.16)
|
18
18
|
rack (1.2.2)
|
19
|
-
rack-oauth2 (0.6.
|
19
|
+
rack-oauth2 (0.6.9)
|
20
20
|
activesupport (>= 2.3)
|
21
21
|
attr_required (>= 0.0.3)
|
22
22
|
i18n
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.5
|
data/lib/fb_graph/album.rb
CHANGED
@@ -3,6 +3,7 @@ module FbGraph
|
|
3
3
|
include Connections::Photos
|
4
4
|
include Connections::Comments
|
5
5
|
include Connections::Likes
|
6
|
+
include Connections::Picture
|
6
7
|
|
7
8
|
attr_accessor :from, :name, :description, :location, :link, :privacy, :count, :created_time, :updated_time, :type
|
8
9
|
|
@@ -38,5 +39,13 @@ module FbGraph
|
|
38
39
|
# cached connection
|
39
40
|
@_comments_ = Collection.new(attributes[:comments])
|
40
41
|
end
|
42
|
+
|
43
|
+
def picture_with_access_token(size = nil)
|
44
|
+
raise Unauthorized.new('Album picture connection requires an access token') unless self.access_token
|
45
|
+
_endpoint_ = URI.parse picture_without_access_token(size)
|
46
|
+
_endpoint_.query = [_endpoint_.query, {:access_token => self.access_token.to_s}.to_query].compact.join('&')
|
47
|
+
_endpoint_.to_s
|
48
|
+
end
|
49
|
+
alias_method_chain :picture, :access_token
|
41
50
|
end
|
42
51
|
end
|
data/spec/fb_graph/album_spec.rb
CHANGED
@@ -1,63 +1,84 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe FbGraph::Album
|
3
|
+
describe FbGraph::Album do
|
4
4
|
|
5
|
-
|
6
|
-
attributes
|
7
|
-
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
:
|
22
|
-
:
|
23
|
-
|
24
|
-
:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
describe '.new' do
|
6
|
+
it 'should setup all supported attributes' do
|
7
|
+
attributes = {
|
8
|
+
:id => '12345',
|
9
|
+
:from => {
|
10
|
+
:id => '23456',
|
11
|
+
:name => 'nov matake'
|
12
|
+
},
|
13
|
+
:name => 'album 1',
|
14
|
+
:description => 'an album for fb_graph test',
|
15
|
+
:location => 'Tokyo, Japan',
|
16
|
+
:link => 'http://www.facebook.com/album/12345',
|
17
|
+
:count => 10,
|
18
|
+
:type => 'normal',
|
19
|
+
:created_time => '2009-12-29T15:24:50+0000',
|
20
|
+
:updated_time => '2010-01-02T15:37:41+0000',
|
21
|
+
:comments => {
|
22
|
+
:data => [{
|
23
|
+
:id => '909694472945_418735',
|
24
|
+
:from => {
|
25
|
+
:id => '520739622',
|
26
|
+
:name => 'Alison Marie Weber',
|
27
|
+
},
|
28
|
+
:message => 'Love all the pix!',
|
29
|
+
:created_time => '2009-08-15T14:57:36+0000'
|
30
|
+
}]
|
31
|
+
}
|
30
32
|
}
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
33
|
+
album = FbGraph::Album.new(attributes.delete(:id), attributes)
|
34
|
+
album.identifier.should == '12345'
|
35
|
+
album.from.should == FbGraph::User.new('23456', :name => 'nov matake')
|
36
|
+
album.name.should == 'album 1'
|
37
|
+
album.description.should == 'an album for fb_graph test'
|
38
|
+
album.location.should == 'Tokyo, Japan'
|
39
|
+
album.link.should == 'http://www.facebook.com/album/12345'
|
40
|
+
album.count.should == 10
|
41
|
+
album.type.should == 'normal'
|
42
|
+
album.created_time.should == Time.parse('2009-12-29T15:24:50+0000')
|
43
|
+
album.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
|
44
|
+
album.comments.should == [FbGraph::Comment.new(
|
45
|
+
'909694472945_418735',
|
46
|
+
:from => {
|
47
|
+
:id => '520739622',
|
48
|
+
:name => 'Alison Marie Weber',
|
49
|
+
},
|
50
|
+
:message => 'Love all the pix!',
|
51
|
+
:created_time => '2009-08-15T14:57:36+0000'
|
52
|
+
)]
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should support page as from' do
|
56
|
+
page_album = FbGraph::Album.new('12345', :from => {
|
57
|
+
:id => '23456',
|
58
|
+
:name => 'Smart.fm',
|
59
|
+
:category => 'Web Site'
|
60
|
+
})
|
61
|
+
page_album.from.should == FbGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
|
62
|
+
end
|
52
63
|
end
|
53
64
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
65
|
+
describe '#picture' do
|
66
|
+
let(:album) { FbGraph::Album.new('12345') }
|
67
|
+
subject { album }
|
68
|
+
|
69
|
+
context 'when access token is given' do
|
70
|
+
before { album.access_token = 'access_token' }
|
71
|
+
its(:picture) { should == File.join(FbGraph::ROOT_URL, '12345/picture?access_token=access_token') }
|
72
|
+
it 'should support size' do
|
73
|
+
album.picture(:small).should == File.join(FbGraph::ROOT_URL, '12345/picture?type=small&access_token=access_token')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'otherwise' do
|
78
|
+
it do
|
79
|
+
expect { album.picture }.should raise_error(FbGraph::Unauthorized)
|
80
|
+
end
|
81
|
+
end
|
61
82
|
end
|
62
83
|
|
63
84
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.7.
|
5
|
+
version: 1.7.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- nov matake
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-11 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack-oauth2
|