fb_graph 1.0.1 → 1.0.2

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 nov matake
1
+ Copyright (c) 2010 nov matake
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ A full-stack Facebook Graph API wrapper in Ruby.
8
8
 
9
9
  == Resources
10
10
 
11
- * View RDoc on RDoc.info (http://rdoc.info/github/nov/fb_graph/master/frames)
11
+ * View RDoc on RDoc.info (http://rdoc.info/github/nov/fb_graph)
12
12
  * View Source on GitHub (http://github.com/nov/fb_graph)
13
13
  * Report Issues on GitHub (http://github.com/nov/fb_graph/issues)
14
14
  * Facebook fan page (http://www.facebook.com/pages/FbGraph/117513961602338)
@@ -24,12 +24,20 @@ Plus, you can play an Rails sample app here. http://fbgraphsample.heroku.com/
24
24
 
25
25
  ==== Basic Objects
26
26
 
27
+ user = FbGraph::User.me(ACCESS_TOKEN)
28
+
27
29
  user = FbGraph::User.fetch('matake')
28
30
  user.name # => 'Nov Matake'
29
31
  user.picture # => 'https://graph.facebook.com/matake/picture'
30
32
 
31
- # User.new doesn't fetch the user's profile info
32
- me = User.new('me', :access_token => YOUR_ACCESS_TOKEN)
33
+ # fb_graph doesn't access to Graph API until you call "fetch"
34
+ user = FbGraph::User.new('matake', :access_token => YOUR_ACCESS_TOKEN)
35
+ user.identifier # => "matake"
36
+ user.name # => nil
37
+ user.link # => nil
38
+ user.fetch
39
+ user.name # => "Nov Matake"
40
+ user.description # => "http://www.facebook.com/matake"
33
41
 
34
42
  page = FbGraph::Page.fetch('smartfmteam')
35
43
  page.name # => 'smart.fm'
@@ -222,6 +230,69 @@ You can also see http://github.com/nov/fb_graph_sample for more details Rails3 s
222
230
  app = FbGraph::Application.new(YOUR_APP_ID, :secret => YOUR_APPLICATION_SECRET)
223
231
  app.insights # => Array of FbGraph::Insight
224
232
 
233
+ == Documents
234
+
235
+ Currently fb_graph isn't so well documented.
236
+
237
+ I'm continuously updating RDoc now, but writing all documents <b>in English</b> is heavy task for me.
238
+
239
+ Please see RDoc.info (http://rdoc.info/github/nov/fb_graph), and if the document is missing or hard to understand, please contact me on github.
240
+
241
+ I'll add more documents or sample code.
242
+
243
+ === Objects
244
+
245
+ * FbGraph::Album[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Album]
246
+ * FbGraph::Application[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Application]
247
+ * FbGraph::Checkin[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Checkin]
248
+ * FbGraph::Comment[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Comment]
249
+ * FbGraph::Event[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Event]
250
+ * FbGraph::Group[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Group]
251
+ * FbGraph::Insight[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Insight]
252
+ * FbGraph::Link[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Link]
253
+ * FbGraph::Note[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Note]
254
+ * FbGraph::Page[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Page]
255
+ * FbGraph::Photo[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Photo]
256
+ * FbGraph::Post[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Post]
257
+ * FbGraph::Status[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Status]
258
+ * FbGraph::Subscription[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Subscription]
259
+ * FbGraph::User[http://rdoc.info/github/nov/fb_graph/master/FbGraph/User]
260
+ * FbGraph::Video[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Video]
261
+
262
+ === Connections
263
+
264
+ * FbGraph::Connections::Accounts[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Accounts]
265
+ * FbGraph::Connections::Activities[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Activities]
266
+ * FbGraph::Connections::Albums[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Albums]
267
+ * FbGraph::Connections::Attending[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Attending]
268
+ * FbGraph::Connections::Books[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Books]
269
+ * FbGraph::Connections::Checkins[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Checkins]
270
+ * FbGraph::Connections::Comments[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Comments]
271
+ * FbGraph::Connections::Declined[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Declined]
272
+ * FbGraph::Connections::Events[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Events]
273
+ * FbGraph::Connections::Feed[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Feed]
274
+ * FbGraph::Connections::Friends[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Friends]
275
+ * FbGraph::Connections::Groups[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Groups]
276
+ * FbGraph::Connections::Home[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Home]
277
+ * FbGraph::Connections::Insights[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Insights]
278
+ * FbGraph::Connections::Interests[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Interests]
279
+ * FbGraph::Connections::Invited[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Invited]
280
+ * FbGraph::Connections::Likes[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Likes]
281
+ * FbGraph::Connections::Links[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Links]
282
+ * FbGraph::Connections::Maybe[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Maybe]
283
+ * FbGraph::Connections::Members[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Members]
284
+ * FbGraph::Connections::Movies[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Movies]
285
+ * FbGraph::Connections::Music[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Music]
286
+ * FbGraph::Connections::Noreply[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Noreply]
287
+ * FbGraph::Connections::Notes[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Notes]
288
+ * FbGraph::Connections::Photos[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Photos]
289
+ * FbGraph::Connections::Picture[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Picture]
290
+ * FbGraph::Connections::Statuses[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Statuses]
291
+ * FbGraph::Connections::Subscriptions[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Subscriptions]
292
+ * FbGraph::Connections::Tagged[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Tagged]
293
+ * FbGraph::Connections::Television[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Television]
294
+ * FbGraph::Connections::Videos[http://rdoc.info/github/nov/fb_graph/master/FbGraph/Connections/Videos]
295
+
225
296
  == Note on Patches/Pull Requests
226
297
 
227
298
  * Fork the project.
data/Rakefile CHANGED
@@ -5,8 +5,8 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = 'fb_graph'
8
- gem.summary = %Q{A Ruby wrapper for Facebook Graph API}
9
- gem.description = %Q{A Ruby wrapper for Facebook Graph API}
8
+ gem.summary = %Q{A full-stack Facebook Graph API wrapper in Ruby.}
9
+ gem.description = %Q{A full-stack Facebook Graph API wrapper in Ruby.}
10
10
  gem.email = 'nov@matake.jp'
11
11
  gem.homepage = 'http://github.com/nov/fb_graph'
12
12
  gem.authors = ['nov matake']
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
data/fb_graph.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.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"]
12
- s.date = %q{2010-09-08}
13
- s.description = %q{A Ruby wrapper for Facebook Graph API}
12
+ s.date = %q{2010-09-13}
13
+ s.description = %q{A full-stack Facebook Graph API wrapper in Ruby.}
14
14
  s.email = %q{nov@matake.jp}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -232,7 +232,7 @@ Gem::Specification.new do |s|
232
232
  s.rdoc_options = ["--charset=UTF-8"]
233
233
  s.require_paths = ["lib"]
234
234
  s.rubygems_version = %q{1.3.7}
235
- s.summary = %q{A Ruby wrapper for Facebook Graph API}
235
+ s.summary = %q{A full-stack Facebook Graph API wrapper in Ruby.}
236
236
  s.test_files = [
237
237
  "spec/fb_graph/album_spec.rb",
238
238
  "spec/fb_graph/application_spec.rb",
@@ -1,4 +1,97 @@
1
1
  module FbGraph
2
+ # = Authentication
3
+ #
4
+ # * Access token is required to fetch album info.
5
+ #
6
+ # = Attributes
7
+ #
8
+ # +from+:: FbGraph::User or FbGraph::Page
9
+ # +name+:: String
10
+ # +description+:: String
11
+ # +location+:: String <em>ex.) "NYC"</em>
12
+ # +link+:: String
13
+ # +privacy+:: String <em>ex.) "everyone"</em>
14
+ # +count+:: Integer
15
+ # +created_time+:: Time (UTC)
16
+ # +updated_time+:: Time (UTC)
17
+ #
18
+ # = Connections
19
+ #
20
+ # +photos+:: Array of FbGraph::Photo
21
+ # +comments+:: Array of FbGraph::Comment
22
+ # +likes+:: Array of FbGraph::Page
23
+ #
24
+ # = Examples
25
+ #
26
+ # == Fetch album info
27
+ #
28
+ # album = FbGraph::Album.new(ALBUM_ID)
29
+ # album.fetch(:access_token => ACCESS_TOKEN)
30
+ #
31
+ # or
32
+ #
33
+ # FbGraph::album.fetch(ALBUM_ID, :access_token => ACCESS_TOKEN)
34
+ #
35
+ # == Fetch connection
36
+ #
37
+ # photos = album.photos
38
+ # likes = album.likes
39
+ # comments = album.comments
40
+ #
41
+ # === Pagination
42
+ #
43
+ # photos = album.photos
44
+ # photos_next = photos.next
45
+ # photos_previous = photos.previous
46
+ # photos = album.photos(:since => '2010-09-01', :until => '2010-10-01')
47
+ # photos = album.photos(:offset => 20, :limit => 20)
48
+ #
49
+ # == Creat new album
50
+ #
51
+ # See RDoc for FbGraph::Connections::Albums
52
+ #
53
+ # == Upload a photo
54
+ #
55
+ # album.photo!(
56
+ # :image => File.new(File.join(File.dirname(__FILE__), 'nov.gif')),
57
+ # :name => "name",
58
+ # :message => 'message'
59
+ # )
60
+ #
61
+ # == Post a comment
62
+ #
63
+ # album.comment!(
64
+ # :access_token => ACCESS_TOKEN,
65
+ # :message => 'Hey, I\'m testing you!'
66
+ # )
67
+ #
68
+ # == Delete a comment
69
+ #
70
+ # comment = album.comments.last
71
+ # comment.destroy
72
+ #
73
+ # == Like and unlike
74
+ #
75
+ # album.like!
76
+ # album.unlike!
77
+ #
78
+ # = Notes
79
+ #
80
+ # == Attribute +from+
81
+ #
82
+ # Both facebook user and page can have albums, so +from+ can be either FbGraph::User or FbGraph::Page.
83
+ # * When you called +ablums+ connection of FbGraph::User, all +from+ should be FbGraph::User.
84
+ # * When you called +ablums+ connection of FbGraph::Page, all +from+ should be FbGraph::Page.
85
+ # * When you fetched an album by objedt id, +from+ can be either FbGraph::User or FbGraph::Page.
86
+ #
87
+ # == Cached +comments+
88
+ #
89
+ # When album object fetched, several comments are included in the response.
90
+ # So first time you called +album.comments+, those cached comments will be returned.
91
+ # If you put any option parameter like +album.comments(:access_token => ACCESS_TOKEN)+,
92
+ # fb_graph ignores those cached comments and fetch comments via Graph API.
93
+ #
94
+ # <em>If cached "album.comments" are blank, probably the album has no comments yet.</em>
2
95
  class Album < Node
3
96
  include Connections::Photos
4
97
  include Connections::Comments
@@ -8,8 +101,8 @@ module FbGraph
8
101
 
9
102
  def initialize(identifier, attributes = {})
10
103
  super
11
- if (from = attributes[:from])
12
- @from = if from[:category]
104
+ @from = if (from = attributes[:from])
105
+ if from[:category]
13
106
  FbGraph::Page.new(from.delete(:id), from)
14
107
  else
15
108
  FbGraph::User.new(from.delete(:id), from)
@@ -26,11 +119,11 @@ module FbGraph
26
119
  @link = attributes[:link]
27
120
  @privacy = attributes[:privacy]
28
121
  @count = attributes[:count]
29
- if attributes[:created_time]
30
- @created_time = Time.parse(attributes[:created_time]).utc
122
+ @created_time = if attributes[:created_time]
123
+ Time.parse(attributes[:created_time]).utc
31
124
  end
32
- if attributes[:updated_time]
33
- @updated_time = Time.parse(attributes[:updated_time]).utc
125
+ @updated_time = if attributes[:updated_time]
126
+ Time.parse(attributes[:updated_time]).utc
34
127
  end
35
128
 
36
129
  # cached connection
@@ -25,6 +25,23 @@ module FbGraph
25
25
  @secret = attributes[:secret]
26
26
  end
27
27
 
28
+ # == Get OAuth access token
29
+ #
30
+ # Obtain an OAuth access token associated with your application via the OAuth Client Credentials Flow.
31
+ #
32
+ # ref) http://developers.facebook.com/docs/api#analytics
33
+ #
34
+ # app = FbGraph::Application.new(APP_ID)
35
+ # app.get_access_token
36
+ # # => access token as String
37
+ # app.access_token # once get_access_token is called, access token is cached.
38
+ # # => access token as String
39
+ #
40
+ # This method is automatically called when access token needed and application secret has already given.
41
+ #
42
+ # app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
43
+ # app.subscriptions # get_access_token is called automatically
44
+ # # => Array of FbGraph::Subscription
28
45
  def get_access_token(secret = nil)
29
46
  self.secret ||= secret
30
47
  auth = FbGraph::Auth.new(self.identifier, self.secret)
@@ -2,6 +2,8 @@ require 'digest/md5'
2
2
 
3
3
  module FbGraph
4
4
  class Auth
5
+ # NOTE:
6
+ # If you want access token, use FbGraph::Auth.new(APP_ID, APP_SECRET, :cookie => {..}) instead
5
7
  class Cookie
6
8
  def self.parse(client, cookie)
7
9
  fb_cookie_string = if cookie.is_a?(Hash)
data/lib/fb_graph/auth.rb CHANGED
@@ -1,4 +1,19 @@
1
1
  module FbGraph
2
+ # = Parse & verify facebook auth cookie
3
+ #
4
+ # Used with Facebook JavaScript SDK
5
+ #
6
+ # app = FbGraph::Auth.new(APP_ID, APP_SECRET)
7
+ # app.from_cookie(cookie_hash)
8
+ # auth.access_token
9
+ # # => OAuth2::AccessToken (not String!)
10
+ # auth.user # only initialized
11
+ # auth.user.fetch # fetch whole profile
12
+ #
13
+ # This method is called automatically if cookie is given when initializing
14
+ #
15
+ # auth = FbGraph::Auth.new(APP_ID, APP_SECRET, :cookie => {..})
16
+ # auth.access_token # already parsed
2
17
  class Auth
3
18
  class VerificationFailed < FbGraph::Exception; end
4
19
 
@@ -31,10 +31,10 @@ module FbGraph
31
31
  end
32
32
  end
33
33
 
34
- # = Search for recent check-ins for an authorized user and his or her friends:
34
+ # == Search for recent check-ins for an authorized user and his or her friends:
35
35
  #
36
36
  # FbGraph::Checkin.search(:access_token => ACCESS_TOKEN)
37
- # => Array of FbGraph::Checkin
37
+ # # => Array of FbGraph::Checkin
38
38
  def self.search(options = {})
39
39
  # NOTE:
40
40
  # checkin search doesn't support "q=***" parameter
@@ -1,15 +1,51 @@
1
1
  module FbGraph
2
2
  module Connections
3
+ # = What's "accounts"?
4
+ #
5
+ # Pages owned by the current user.
6
+ #
7
+ # ref) http://developers.facebook.com/docs/api#impersonation
8
+ #
9
+ # = Authentication
10
+ #
11
+ # * Access token is required.
12
+ # * "manage_pages" permission is optional.
13
+ #
14
+ # If the "manage_pages" permission has been granted,
15
+ # this connection also yields access_tokens that can be used to query the Graph API on behalf of the page.
16
+ #
17
+ # ref) http://developers.facebook.com/docs/reference/api/user
18
+ #
19
+ # = Connected with
20
+ #
21
+ # * FbGraph::User
22
+ #
23
+ # == Fetch
24
+ #
25
+ # pages = FbGraph::User.me(ACCESS_TOKEN).accounts
26
+ # # => array of FbGraph::Page
27
+ # pages.first.access_token
28
+ # # => String if "manage_pages" permission has been granted, nil if not.
29
+ #
30
+ # = Notes
31
+ #
32
+ # == Access token of the page
33
+ #
34
+ # Using given access token, you can do those things as the page, not as yourself.
35
+ #
36
+ # * update the page's wall
37
+ # * create new page's album and upload photos into it
38
+ # * create and manage an event
39
+ # * etc.
40
+ #
41
+ # See RDoc for FbGraph::Page for more details.
42
+ #
43
+ # page = FbGraph::User.me(ACCESS_TOKEN).accounts.first
44
+ # page.access_token
45
+ # # => given because "manage_pages" permission has been granted.
46
+ # page.feed!(:message => 'Updating via FbGraph')
47
+ # # => update the page's wall, not the user's wall
3
48
  module Accounts
4
- # == Fetching Pages owned by the current user.
5
- #
6
- # If the manage_pages permission has been granted,
7
- # this connection also yields access_tokens that can be used to query the Graph API on behalf of the page.
8
- #
9
- # ref) http://developers.facebook.com/docs/reference/api/user
10
- #
11
- # FbGraph::User.me(ACCESS_TOKEN).accounts
12
- # => array of FbGraph::Page
13
49
  def accounts(options = {})
14
50
  accounts = self.connection(:accounts, options)
15
51
  accounts.map! do |account|
@@ -1,5 +1,80 @@
1
1
  module FbGraph
2
2
  module Connections
3
+ # = Authentication
4
+ #
5
+ # * Access token is required to fetch/create albums.
6
+ # * "publish_stream" permissin is required to create new album.
7
+ #
8
+ # = Connected with
9
+ #
10
+ # * FbGraph::Application
11
+ # * FbGraph::USer
12
+ # * FbGraph::Page
13
+ #
14
+ # = Example
15
+ #
16
+ # == Fetch albums
17
+ #
18
+ # me = FbGraph::User.me(ACCESS_TOKEN)
19
+ # me.albums
20
+ # # => Array of FbGraph::Album
21
+ #
22
+ # page = FbGraph::Page.new('fb_graph')
23
+ # page.albums
24
+ # # => Array of FbGraph::Album
25
+ #
26
+ # == Create an album
27
+ #
28
+ # me = FbGraph::User.me(ACCESS_TOKEN)
29
+ # album = me.album!(
30
+ # :name => 'FbGraph test',
31
+ # :message => 'hello world!',
32
+ # :description => 'hello world!'
33
+ # )
34
+ #
35
+ # page = FbGraph::Page.new('fb_graph', :access_token => ACCESS_TOKEN)
36
+ # album = page.album!(
37
+ # :name => 'FbGraph test',
38
+ # :message => 'hello world!',
39
+ # :description => 'hello world!'
40
+ # )
41
+ #
42
+ # = Notes
43
+ #
44
+ # == Attributes after created
45
+ #
46
+ # Only attributes you specified are saved in the created album object.
47
+ # If you want to access any other attributes, you need to fetch the album info via Graph API.
48
+ #
49
+ # me = FbGraph::User.me(ACCESS_TOKEN)
50
+ # album = me.album!(
51
+ # :name => 'FbGraph test',
52
+ # :message => 'hello world!',
53
+ # :description => 'hello world!'
54
+ # )
55
+ # album.name # => 'FbGraoh test'
56
+ # album.from # => nil
57
+ # album.created_time # => nil
58
+ # album.fetch
59
+ # album.from # => me
60
+ # album.created_time # => Sun Sep 12 01:18:36 +0900 2010
61
+ #
62
+ # == Bug of Graph API
63
+ #
64
+ # According facebook's document, the key for +description+ should be +description+ both when fetching and creating,
65
+ # but actually you need to use +message+ instead of +description+ only when creating.
66
+ # It probably facebook's bug, and it might be fixed suddenly.
67
+ # I highly recommend to send same value both as +description+ and +message+ when creating,
68
+ # then your code will work without any code change.
69
+ #
70
+ # ref) http://developers.facebook.com/docs/reference/api/album
71
+ #
72
+ # me = FbGraph::User.me(ACCESS_TOKEN)
73
+ # album = me.album!(
74
+ # :name => 'FbGraph test',
75
+ # :message => 'hello world!',
76
+ # :description => 'hello world!'
77
+ # )
3
78
  module Albums
4
79
  def albums(options = {})
5
80
  albums = self.connection(:albums, options)
@@ -1,6 +1,6 @@
1
1
  module FbGraph
2
2
  class Education
3
- include FbGraph::Comparison
3
+ include Comparison
4
4
 
5
5
  attr_accessor :school, :degree, :year, :concentration
6
6
 
data/lib/fb_graph/page.rb CHANGED
@@ -25,7 +25,7 @@ module FbGraph
25
25
  @link = attributes[:link]
26
26
  @category = attributes[:category]
27
27
  if (founded = attributes[:founded])
28
- @founded = Date.parse(founded)
28
+ @founded = Date.parse(founded) rescue Date.new(founded.to_i)
29
29
  end
30
30
  @company_overview = attributes[:company_overview]
31
31
  @mission = attributes[:mission]
data/lib/fb_graph/tag.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module FbGraph
2
2
  class Tag
3
- include FbGraph::Comparison
3
+ include Comparison
4
4
 
5
5
  attr_accessor :user, :x, :y, :created_time
6
6
 
@@ -1,6 +1,6 @@
1
1
  module FbGraph
2
2
  class Venue
3
- include FbGraph::Comparison
3
+ include Comparison
4
4
 
5
5
  attr_accessor :street, :city, :state, :zip, :country, :latitude, :longitude
6
6
 
data/lib/fb_graph/work.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module FbGraph
2
2
  class Work
3
- include FbGraph::Comparison
3
+ include Comparison
4
4
 
5
5
  attr_accessor :employer, :location, :position, :start_date, :end_date
6
6
 
@@ -7,7 +7,9 @@
7
7
  "id": "579612276"
8
8
  },
9
9
  "name": "\u30e2\u30d0\u30a4\u30eb\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9",
10
+ "description": "hello facebookers!",
10
11
  "link": "http://www.facebook.com/album.php?aid=25463&id=579612276",
12
+ "location": "NYC",
11
13
  "privacy": "everyone",
12
14
  "count": 3,
13
15
  "created_time": "2008-07-27T11:38:15+0000",
@@ -26,7 +26,9 @@ context 'when included by FbGraph::User' do
26
26
  :name => 'Nov Matake'
27
27
  },
28
28
  :name => 'モバイルアップロード',
29
+ :description => 'hello facebookers!',
29
30
  :link => 'http://www.facebook.com/album.php?aid=25463&id=579612276',
31
+ :location => 'NYC',
30
32
  :count => 3,
31
33
  :privacy => 'everyone',
32
34
  :created_time => '2008-07-27T11:38:15+0000',
@@ -34,6 +34,11 @@ describe FbGraph::Page, '.new' do
34
34
  page.link.should == 'http://www.facebook.com/platform'
35
35
  page.picture.should == 'https://graph.facebook.com/19292868552/picture' # use connection
36
36
  end
37
+
38
+ it 'should allow invalid date as founded' do
39
+ page = FbGraph::Page.new(12345, :founded => "2004")
40
+ page.founded.should == Date.new(2004, 1, 1)
41
+ end
37
42
  end
38
43
 
39
44
  describe FbGraph::Page, '.fetch' do
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-08 00:00:00 +09:00
18
+ date: 2010-09-13 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -119,7 +119,7 @@ dependencies:
119
119
  version: "0"
120
120
  type: :development
121
121
  version_requirements: *id007
122
- description: A Ruby wrapper for Facebook Graph API
122
+ description: A full-stack Facebook Graph API wrapper in Ruby.
123
123
  email: nov@matake.jp
124
124
  executables: []
125
125
 
@@ -372,7 +372,7 @@ rubyforge_project:
372
372
  rubygems_version: 1.3.7
373
373
  signing_key:
374
374
  specification_version: 3
375
- summary: A Ruby wrapper for Facebook Graph API
375
+ summary: A full-stack Facebook Graph API wrapper in Ruby.
376
376
  test_files:
377
377
  - spec/fb_graph/album_spec.rb
378
378
  - spec/fb_graph/application_spec.rb