fb_graph 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
data/fb_graph.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "0.7.1"
8
+ s.version = "0.7.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nov matake"]
@@ -2,8 +2,9 @@ module FbGraph
2
2
  class Album < Node
3
3
  include Connections::Photos
4
4
  include Connections::Comments
5
+ include Connections::Likes
5
6
 
6
- attr_accessor :from, :name, :description, :location, :link, :privacy, :count, :created_time, :updated_time, :comments
7
+ attr_accessor :from, :name, :description, :location, :link, :privacy, :count, :created_time, :updated_time
7
8
 
8
9
  def initialize(identifier, attributes = {})
9
10
  super
data/lib/fb_graph/link.rb CHANGED
@@ -2,7 +2,7 @@ module FbGraph
2
2
  class Link < Node
3
3
  include Connections::Comments
4
4
 
5
- attr_accessor :from, :link, :caption, :description, :icon, :picture, :message, :created_time
5
+ attr_accessor :from, :link, :name, :caption, :description, :icon, :picture, :message, :created_time
6
6
 
7
7
  def initialize(identifier, attributes = {})
8
8
  super
@@ -13,11 +13,12 @@ module FbGraph
13
13
  FbGraph::User.new(from.delete(:id), from)
14
14
  end
15
15
  end
16
+ @name = attributes[:name]
16
17
  @link = attributes[:link]
17
18
  @caption = attributes[:caption]
18
19
  @description = attributes[:description]
19
20
  @icon = attributes[:icon]
20
- @picture = attributes[:picture]
21
+ @picture = attributes[:picture] # NOTE: this is external image, so isn't connection.
21
22
  @message = attributes[:message]
22
23
  if attributes[:created_time]
23
24
  @created_time = Time.parse(attributes[:created_time]).utc
data/lib/fb_graph/page.rb CHANGED
@@ -15,14 +15,17 @@ module FbGraph
15
15
  include Connections::Events
16
16
  extend Searchable
17
17
 
18
- attr_accessor :name, :link, :category, :founded, :company_overview, :mission, :products, :fan_count
18
+ attr_accessor :name, :username, :link, :category, :founded, :company_overview, :mission, :products, :fan_count
19
19
 
20
20
  def initialize(identifier, attributes = {})
21
21
  super
22
22
  @name = attributes[:name]
23
+ @username = attributes[:username]
23
24
  @link = attributes[:link]
24
25
  @category = attributes[:category]
25
- @founded = attributes[:founded]
26
+ if (founded = attributes[:founded])
27
+ @founded = Date.parse(founded)
28
+ end
26
29
  @company_overview = attributes[:company_overview]
27
30
  @mission = attributes[:mission]
28
31
  if (products = attributes[:products])
@@ -3,7 +3,7 @@ module FbGraph
3
3
  include Connections::Comments
4
4
  include Connections::Likes
5
5
 
6
- attr_accessor :from, :tags, :name, :picture, :source, :height, :width, :link, :created_time, :updated_time
6
+ attr_accessor :from, :tags, :name, :picture, :icon, :source, :height, :width, :link, :created_time, :updated_time
7
7
 
8
8
  def initialize(identifier, attributes = {})
9
9
  super
@@ -25,6 +25,7 @@ module FbGraph
25
25
  # "name" in GET & "message" in POST
26
26
  @name = attributes[:name] || attributes[:message]
27
27
  @picture = attributes[:picture]
28
+ @icon = attributes[:icon]
28
29
  @source = attributes[:source]
29
30
  @height = attributes[:height]
30
31
  @width = attributes[:width]
@@ -15,18 +15,38 @@ describe FbGraph::Album, '.new' do
15
15
  :link => 'http://www.facebook.com/album/12345',
16
16
  :count => 10,
17
17
  :created_time => '2009-12-29T15:24:50+0000',
18
- :updated_time => '2010-01-02T15:37:41+0000'
18
+ :updated_time => '2010-01-02T15:37:41+0000',
19
+ :comments => {
20
+ :data => [{
21
+ :id => '909694472945_418735',
22
+ :from => {
23
+ :id => '520739622',
24
+ :name => 'Alison Marie Weber',
25
+ },
26
+ :message => 'Love all the pix!',
27
+ :created_time => '2009-08-15T14:57:36+0000'
28
+ }]
29
+ }
19
30
  }
20
31
  album = FbGraph::Album.new(attributes.delete(:id), attributes)
21
- album.identifier.should == '12345'
22
- album.from.should == FbGraph::User.new('23456', :name => 'nov matake')
23
- album.name.should == 'album 1'
24
- album.description.should == 'an album for fb_graph test'
25
- album.location.should == 'Tokyo, Japan'
26
- album.link.should == 'http://www.facebook.com/album/12345'
27
- album.count.should == 10
28
- album.created_time.should == Time.parse('2009-12-29T15:24:50+0000')
29
- album.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
32
+ album.identifier.should == '12345'
33
+ album.from.should == FbGraph::User.new('23456', :name => 'nov matake')
34
+ album.name.should == 'album 1'
35
+ album.description.should == 'an album for fb_graph test'
36
+ album.location.should == 'Tokyo, Japan'
37
+ album.link.should == 'http://www.facebook.com/album/12345'
38
+ album.count.should == 10
39
+ album.created_time.should == Time.parse('2009-12-29T15:24:50+0000')
40
+ album.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
41
+ album.comments.should == [FbGraph::Comment.new(
42
+ '909694472945_418735',
43
+ :from => {
44
+ :id => '520739622',
45
+ :name => 'Alison Marie Weber',
46
+ },
47
+ :message => 'Love all the pix!',
48
+ :created_time => '2009-08-15T14:57:36+0000'
49
+ )]
30
50
  end
31
51
 
32
52
  it 'should support page as from' do
@@ -10,6 +10,11 @@ describe FbGraph::Link, '.new' do
10
10
  :name => 'nov matake'
11
11
  },
12
12
  :link => 'http://www.facebook.com/link/12345',
13
+ :name => 'name',
14
+ :caption => 'caption',
15
+ :description => 'description',
16
+ :icon => 'http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif',
17
+ :picture => 'http://i.ytimg.com/vi/JA068qeB0oM/2.jpg',
13
18
  :message => 'check this out!',
14
19
  :created_time => '2010-01-02T15:37:41+0000'
15
20
  }
@@ -17,7 +22,12 @@ describe FbGraph::Link, '.new' do
17
22
  link.identifier.should == '12345'
18
23
  link.from.should == FbGraph::User.new('23456', :name => 'nov matake')
19
24
  link.link.should == 'http://www.facebook.com/link/12345'
20
- link.message.should == 'check this out!'
25
+ link.name.should == 'name'
26
+ link.caption.should == 'caption'
27
+ link.description.should == 'description'
28
+ link.icon.should == 'http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif'
29
+ link.picture.should == 'http://i.ytimg.com/vi/JA068qeB0oM/2.jpg'
30
+ link.message.should == 'check this out!'
21
31
  link.created_time.should == Time.parse('2010-01-02T15:37:41+0000')
22
32
  end
23
33
 
@@ -12,7 +12,8 @@ describe FbGraph::Note, '.new' do
12
12
  :subject => 'TODO',
13
13
  :message => 'later or never',
14
14
  :created_time => '2010-01-02T15:37:40+0000',
15
- :updated_time => '2010-01-02T15:37:41+0000'
15
+ :updated_time => '2010-01-02T15:37:41+0000',
16
+ :icon => 'http://static.ak.fbcdn.net/rsrc.php/z7NSY/hash/ajh5dbgz.gif'
16
17
  }
17
18
  note = FbGraph::Note.new(attributes.delete(:id), attributes)
18
19
  note.identifier.should == '12345'
@@ -21,6 +22,7 @@ describe FbGraph::Note, '.new' do
21
22
  note.message.should == 'later or never'
22
23
  note.created_time.should == Time.parse('2010-01-02T15:37:40+0000')
23
24
  note.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
25
+ note.icon.should == 'http://static.ak.fbcdn.net/rsrc.php/z7NSY/hash/ajh5dbgz.gif'
24
26
  end
25
27
 
26
28
  it 'should support page as from' do
@@ -1,5 +1,41 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
+ describe FbGraph::Page, '.new' do
4
+ it 'should setup all supported attributes' do
5
+ attributes = {
6
+ :id => '19292868552',
7
+ :name => 'Facebook Platform',
8
+ :founded => 'May 2007',
9
+ :category => 'Technology',
10
+ :username => 'platform',
11
+ :mission => 'To make the web more open and social.',
12
+ :products => "Facebook Application Programming Interface (API)\nFacebook Query Language (FQL)\nFacebook Markup Language (FBML)\nFacebook JavaScript (FBJS)\nFacebook Connect\n",
13
+ :fan_count => 578246,
14
+ :company_overview => 'Facebook Platform enables anyone to build social applications on Facebook and the web.',
15
+ :link => 'http://www.facebook.com/platform',
16
+ :picture => 'http://profile.ak.fbcdn.net/profile-ak-snc1/object3/1566/8/s19292868552_1660.jpg'
17
+ }
18
+ page = FbGraph::Page.new(attributes.delete(:id), attributes)
19
+ page.identifier.should == '19292868552'
20
+ page.name.should == 'Facebook Platform'
21
+ page.founded.should == Date.new(2007, 5)
22
+ page.category.should == 'Technology'
23
+ page.username.should == 'platform'
24
+ page.mission.should == 'To make the web more open and social.'
25
+ page.products.should == [
26
+ 'Facebook Application Programming Interface (API)',
27
+ 'Facebook Query Language (FQL)',
28
+ 'Facebook Markup Language (FBML)',
29
+ 'Facebook JavaScript (FBJS)',
30
+ 'Facebook Connect'
31
+ ]
32
+ page.fan_count.should == 578246
33
+ page.company_overview.should == 'Facebook Platform enables anyone to build social applications on Facebook and the web.'
34
+ page.link.should == 'http://www.facebook.com/platform'
35
+ page.picture.should == 'https://graph.facebook.com/19292868552/picture' # use connection
36
+ end
37
+ end
38
+
3
39
  describe FbGraph::Page, '.fetch' do
4
40
  before(:all) do
5
41
  fake_json(:get, 'platform', 'pages/platform_public')
@@ -20,6 +20,7 @@ describe FbGraph::Photo, '.new' do
20
20
  },
21
21
  :name => 'photo 1',
22
22
  :picture => 'http://www.facebook.com/matake/picture/album_size',
23
+ :icon => 'http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif',
23
24
  :source => 'http://www.facebook.com/matake/picture/original_size',
24
25
  :height => 100,
25
26
  :width => 200,
@@ -38,6 +39,7 @@ describe FbGraph::Photo, '.new' do
38
39
  :created_time => '2010-01-10T15:37:40+0000'
39
40
  )]
40
41
  photo.picture.should == 'http://www.facebook.com/matake/picture/album_size'
42
+ photo.icon.should == 'http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif'
41
43
  photo.source.should == 'http://www.facebook.com/matake/picture/original_size'
42
44
  photo.height.should == 100
43
45
  photo.width.should == 200
@@ -1,6 +1,10 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
3
  describe FbGraph::Post, '.new' do
4
+ it 'should setup all supported attributes' do
5
+ # TODO
6
+ end
7
+
4
8
  it 'should support page as from' do
5
9
  page_post = FbGraph::Post.new('12345', :from => {
6
10
  :id => '23456',
@@ -1,6 +1,10 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
3
  describe FbGraph::User, '.new' do
4
+ it 'should setup all supported attributes' do
5
+ # TODO
6
+ end
7
+
4
8
  it 'should support year-hidden birthday' do
5
9
  user = FbGraph::User.new(12345, :birthday => '12/13')
6
10
  user.birthday.year.should == 0
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake