fb_graph 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.1
1
+ 1.3.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.3.1"
8
+ s.version = "1.3.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"]
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
49
49
  "lib/fb_graph/connections/feed.rb",
50
50
  "lib/fb_graph/connections/friend_lists.rb",
51
51
  "lib/fb_graph/connections/friends.rb",
52
+ "lib/fb_graph/connections/games.rb",
52
53
  "lib/fb_graph/connections/groups.rb",
53
54
  "lib/fb_graph/connections/home.rb",
54
55
  "lib/fb_graph/connections/insights.rb",
@@ -171,6 +172,7 @@ Gem::Specification.new do |s|
171
172
  "spec/fake_json/users/friends/arjun_public.json",
172
173
  "spec/fake_json/users/friends/me_private.json",
173
174
  "spec/fake_json/users/friends/me_public.json",
175
+ "spec/fake_json/users/games/matake_private.json",
174
176
  "spec/fake_json/users/groups/matake_private.json",
175
177
  "spec/fake_json/users/groups/matake_public.json",
176
178
  "spec/fake_json/users/home/arjun_private.json",
@@ -217,6 +219,7 @@ Gem::Specification.new do |s|
217
219
  "spec/fb_graph/connections/feed_spec.rb",
218
220
  "spec/fb_graph/connections/friend_lists_spec.rb",
219
221
  "spec/fb_graph/connections/friends_spec.rb",
222
+ "spec/fb_graph/connections/games_spec.rb",
220
223
  "spec/fb_graph/connections/groups_spec.rb",
221
224
  "spec/fb_graph/connections/home_spec.rb",
222
225
  "spec/fb_graph/connections/insights_spec.rb",
@@ -251,6 +254,7 @@ Gem::Specification.new do |s|
251
254
  "spec/fb_graph/note_spec.rb",
252
255
  "spec/fb_graph/page_spec.rb",
253
256
  "spec/fb_graph/photo_spec.rb",
257
+ "spec/fb_graph/place_spec.rb",
254
258
  "spec/fb_graph/post_spec.rb",
255
259
  "spec/fb_graph/privacy_spec.rb",
256
260
  "spec/fb_graph/project_spec.rb",
@@ -295,6 +299,7 @@ Gem::Specification.new do |s|
295
299
  "spec/fb_graph/connections/feed_spec.rb",
296
300
  "spec/fb_graph/connections/friend_lists_spec.rb",
297
301
  "spec/fb_graph/connections/friends_spec.rb",
302
+ "spec/fb_graph/connections/games_spec.rb",
298
303
  "spec/fb_graph/connections/groups_spec.rb",
299
304
  "spec/fb_graph/connections/home_spec.rb",
300
305
  "spec/fb_graph/connections/insights_spec.rb",
@@ -329,6 +334,7 @@ Gem::Specification.new do |s|
329
334
  "spec/fb_graph/note_spec.rb",
330
335
  "spec/fb_graph/page_spec.rb",
331
336
  "spec/fb_graph/photo_spec.rb",
337
+ "spec/fb_graph/place_spec.rb",
332
338
  "spec/fb_graph/post_spec.rb",
333
339
  "spec/fb_graph/privacy_spec.rb",
334
340
  "spec/fb_graph/project_spec.rb",
@@ -0,0 +1,14 @@
1
+ module FbGraph
2
+ module Connections
3
+ module Games
4
+ def games(options = {})
5
+ games = self.connection(:games, options)
6
+ games.map! do |game|
7
+ Page.new(game.delete(:id), game.merge(
8
+ :access_token => options[:access_token] || self.access_token
9
+ ))
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -2,7 +2,7 @@ module FbGraph
2
2
  class Education
3
3
  include Comparison
4
4
 
5
- attr_accessor :school, :degree, :year, :concentration
5
+ attr_accessor :school, :degree, :year, :concentration, :classes, :type
6
6
 
7
7
  def initialize(attributes = {})
8
8
  if (school = attributes[:school])
@@ -20,6 +20,13 @@ module FbGraph
20
20
  @concentration << Page.new(concentration.delete(:id), concentration)
21
21
  end
22
22
  end
23
+ @classes = []
24
+ if attributes[:classes]
25
+ attributes[:classes].each do |klass|
26
+ @classes << Page.new(klass.delete(:id), klass)
27
+ end
28
+ end
29
+ @type = attributes[:type]
23
30
  end
24
31
  end
25
32
  end
@@ -16,7 +16,7 @@ module FbGraph
16
16
  include Connections::Videos
17
17
  extend Searchable
18
18
 
19
- attr_accessor :name, :username, :link, :category, :founded, :is_community_page, :company_overview, :general_info, :mission, :products, :release_date, :fan_count, :location, :website, :like_count, :checkin_count
19
+ attr_accessor :name, :username, :link, :category, :founded, :is_community_page, :company_overview, :general_info, :mission, :products, :release_date, :fan_count, :location, :website, :like_count, :checkin_count, :with, :created_time
20
20
 
21
21
  def initialize(identifier, attributes = {})
22
22
  super
@@ -44,6 +44,15 @@ module FbGraph
44
44
  @website = attributes[:website]
45
45
  @like_count = attributes[:likes]
46
46
  @checkin_count = attributes[:checkins]
47
+ @with = []
48
+ if attributes[:with]
49
+ attributes[:with].each do |user|
50
+ @with << User.new(user.delete(:id), user)
51
+ end
52
+ end
53
+ if attributes[:created_time]
54
+ @created_time = Time.parse(attributes[:created_time]).utc
55
+ end
47
56
  end
48
57
  end
49
58
  end
@@ -1,15 +1,9 @@
1
1
  module FbGraph
2
2
  class Project < Page
3
- attr_accessor :with, :start_date, :end_date
3
+ attr_accessor :start_date, :end_date
4
4
 
5
5
  def initialize(identifier, attributes = {})
6
6
  super
7
- @with = []
8
- if attributes[:with]
9
- attributes[:with].each do |user|
10
- @with << User.new(user.delete(:id), user)
11
- end
12
- end
13
7
  if attributes[:start_date]
14
8
  year, month = attributes[:start_date].split('-').collect(&:to_i)
15
9
  @start_date = if month == 0
@@ -9,6 +9,7 @@ module FbGraph
9
9
  include Connections::Feed
10
10
  include Connections::FriendLists
11
11
  include Connections::Friends
12
+ include Connections::Games
12
13
  include Connections::Groups
13
14
  include Connections::Home
14
15
  include Connections::Interests
@@ -32,7 +33,7 @@ module FbGraph
32
33
  # ++
33
34
  extend Searchable
34
35
 
35
- attr_accessor :first_name, :last_name, :name, :link, :about, :birthday, :work, :education, :email, :website, :hometown, :location, :bio, :quotes, :gender, :interested_in, :meeting_for, :relationship_status, :religion, :political, :verified, :significant_other, :timezone, :updated_time
36
+ attr_accessor :first_name, :last_name, :name, :link, :about, :birthday, :work, :education, :email, :website, :hometown, :location, :bio, :quotes, :gender, :interested_in, :meeting_for, :relationship_status, :religion, :political, :verified, :significant_other, :timezone, :updated_time, :sports, :favorite_teams, :favorite_athletes, :inspirational_people, :locale, :languages, :third_party_id
36
37
 
37
38
  def initialize(identifier, attributes = {})
38
39
  super
@@ -66,6 +67,30 @@ module FbGraph
66
67
  if (location = attributes[:location])
67
68
  @location = Page.new(location.delete(:id), location)
68
69
  end
70
+ @sports = []
71
+ if (sports = attributes[:sports])
72
+ sports.each do |sport|
73
+ @sports << Page.new(sport.delete(:id), sport)
74
+ end
75
+ end
76
+ @favorite_teams = []
77
+ if attributes[:favorite_teams]
78
+ attributes[:favorite_teams].each do |favorite_team|
79
+ @favorite_teams << Page.new(favorite_team.delete(:id), favorite_team)
80
+ end
81
+ end
82
+ @favorite_athletes = []
83
+ if attributes[:favorite_athletes]
84
+ attributes[:favorite_athletes].each do |favorite_athlete|
85
+ @favorite_athletes << Page.new(favorite_athlete.delete(:id), favorite_athlete)
86
+ end
87
+ end
88
+ @inspirational_people = []
89
+ if attributes[:inspirational_people]
90
+ attributes[:inspirational_people].each do |inspirational_person|
91
+ @inspirational_people << Page.new(inspirational_person.delete(:id), inspirational_person)
92
+ end
93
+ end
69
94
  @bio = attributes[:bio]
70
95
  @quotes = attributes[:quotes]
71
96
  @gender = attributes[:gender]
@@ -75,8 +100,18 @@ module FbGraph
75
100
  @religion = attributes[:religion]
76
101
  @political = attributes[:political]
77
102
  @verified = attributes[:verified]
78
- @significant_other = attributes[:significant_other] # What's this??
103
+ if (significant_other = attributes[:significant_other])
104
+ @significant_other = User.new(significant_other.delete(:id), significant_other)
105
+ end
79
106
  @timezone = attributes[:timezone]
107
+ @locale = attributes[:locale]
108
+ @third_party_id = attributes[:third_party_id]
109
+ @languages = []
110
+ if attributes[:languages]
111
+ attributes[:languages].each do |language|
112
+ @languages << Page.new(language.delete(:id), language)
113
+ end
114
+ end
80
115
  if attributes[:updated_time]
81
116
  @updated_time = Time.parse(attributes[:updated_time]).utc
82
117
  end
@@ -0,0 +1,10 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "name": "FarmVille Cows",
5
+ "category": "Game",
6
+ "id": "101392683235776",
7
+ "created_time": "2011-01-05T13:37:40+0000"
8
+ }
9
+ ]
10
+ }
@@ -30,7 +30,6 @@
30
30
  "name": "Rails Developer"
31
31
  },
32
32
  "start_date": "2008-10",
33
- "end_date": "0000-00",
34
33
  "projects": [
35
34
  {
36
35
  "id": "139390256117606",
@@ -54,6 +53,16 @@
54
53
  "id": "114582978558535",
55
54
  "name": "Web-developer"
56
55
  },
56
+ "with": [
57
+ {
58
+ "id": "1064067203",
59
+ "name": "Takanori Ishikawa"
60
+ },
61
+ {
62
+ "id": "1641626585",
63
+ "name": "Shoichi Imamura"
64
+ }
65
+ ],
57
66
  "start_date": "2006-01",
58
67
  "end_date": "2008-09",
59
68
  "projects": [
@@ -66,7 +75,7 @@
66
75
  "name": "Takanori Ishikawa"
67
76
  }
68
77
  ],
69
- "start_date": "2008-04",
78
+ "start_date": "2008-00",
70
79
  "end_date": "2008-09"
71
80
  },
72
81
  {
@@ -96,6 +105,40 @@
96
105
  ]
97
106
  }
98
107
  ],
108
+ "sports": [
109
+ {
110
+ "id": "114967135183020",
111
+ "name": "Billiards"
112
+ },
113
+ {
114
+ "id": "104085636293671",
115
+ "name": "Darts"
116
+ },
117
+ {
118
+ "id": "111124835576428",
119
+ "name": "Rugby"
120
+ }
121
+ ],
122
+ "favorite_teams": [
123
+ {
124
+ "id": "112498808761105",
125
+ "name": "Bologna F.C. 1909"
126
+ },
127
+ {
128
+ "id": "103968596307357",
129
+ "name": "Gamba Osaka"
130
+ }
131
+ ],
132
+ "favorite_athletes": [
133
+ {
134
+ "id": "112766865404959",
135
+ "name": "Giuseppe Signori"
136
+ }
137
+ ],
138
+ "inspirational_people": [{
139
+ "id": "1234567890",
140
+ "name": "Someone"
141
+ }],
99
142
  "education": [
100
143
  {
101
144
  "school": {
@@ -144,7 +187,19 @@
144
187
  "id": "125324724167172",
145
188
  "name": "2000"
146
189
  },
147
- "type": "High School"
190
+ "type": "High School",
191
+ "classes": [
192
+ {
193
+ "id": "182887815062869",
194
+ "name": "class '99",
195
+ "with": [
196
+ {
197
+ "id": "1268300987",
198
+ "name": "Yuko Shimabata"
199
+ }
200
+ ]
201
+ }
202
+ ]
148
203
  }
149
204
  ],
150
205
  "gender": "male",
@@ -155,6 +210,10 @@
155
210
  "Friendship",
156
211
  "Networking"
157
212
  ],
213
+ "significant_other": {
214
+ "id": "1234567890",
215
+ "name": "Satomi Matake"
216
+ },
158
217
  "relationship_status": "Married",
159
218
  "website": "http://matake.jp",
160
219
  "timezone": 9,
@@ -170,5 +229,5 @@
170
229
  }
171
230
  ],
172
231
  "verified": true,
173
- "updated_time": "2010-12-11T08:33:47+0000"
232
+ "updated_time": "2011-01-05T13:44:17+0000"
174
233
  }
@@ -1,6 +1,11 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
3
  describe FbGraph::Checkin, '.new' do
4
+ it 'should accept FbGraph::Place as place' do
5
+ checkin = FbGraph::Checkin.new(12345, :place => FbGraph::Place.new(123456))
6
+ checkin.place.should == FbGraph::Place.new(123456)
7
+ end
8
+
4
9
  it 'should accept String/Integer as place' do
5
10
  checkin1 = FbGraph::Checkin.new(12345, :place => 123456)
6
11
  checkin2 = FbGraph::Checkin.new(12345, :place => '123456')
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), '../../spec_helper')
2
+
3
+ describe FbGraph::Connections::Activities, '#activities' do
4
+ before do
5
+ fake_json(:get, 'matake/games?access_token=access_token', 'users/games/matake_private')
6
+ end
7
+
8
+ it 'should return games as FbGraph::Page' do
9
+ games = FbGraph::User.new('matake', :access_token => 'access_token').games
10
+ games.class.should == FbGraph::Connection
11
+ games.first.should == FbGraph::Page.new(
12
+ '101392683235776',
13
+ :access_token => 'access_token',
14
+ :name => 'FarmVille Cows',
15
+ :category => 'Game',
16
+ :created_time => '2011-01-05T13:37:40+0000'
17
+ )
18
+ games.each do |game|
19
+ game.should be_instance_of(FbGraph::Page)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ require File.join(File.dirname(__FILE__), '../spec_helper')
2
+
3
+ describe FbGraph::Place, '.to_json' do
4
+ it 'should return identifier' do
5
+ place = FbGraph::Place.new(12345)
6
+ place.to_json.should == 12345
7
+ end
8
+ end
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 1
10
- version: 1.3.1
9
+ - 2
10
+ version: 1.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -167,6 +167,7 @@ files:
167
167
  - lib/fb_graph/connections/feed.rb
168
168
  - lib/fb_graph/connections/friend_lists.rb
169
169
  - lib/fb_graph/connections/friends.rb
170
+ - lib/fb_graph/connections/games.rb
170
171
  - lib/fb_graph/connections/groups.rb
171
172
  - lib/fb_graph/connections/home.rb
172
173
  - lib/fb_graph/connections/insights.rb
@@ -289,6 +290,7 @@ files:
289
290
  - spec/fake_json/users/friends/arjun_public.json
290
291
  - spec/fake_json/users/friends/me_private.json
291
292
  - spec/fake_json/users/friends/me_public.json
293
+ - spec/fake_json/users/games/matake_private.json
292
294
  - spec/fake_json/users/groups/matake_private.json
293
295
  - spec/fake_json/users/groups/matake_public.json
294
296
  - spec/fake_json/users/home/arjun_private.json
@@ -335,6 +337,7 @@ files:
335
337
  - spec/fb_graph/connections/feed_spec.rb
336
338
  - spec/fb_graph/connections/friend_lists_spec.rb
337
339
  - spec/fb_graph/connections/friends_spec.rb
340
+ - spec/fb_graph/connections/games_spec.rb
338
341
  - spec/fb_graph/connections/groups_spec.rb
339
342
  - spec/fb_graph/connections/home_spec.rb
340
343
  - spec/fb_graph/connections/insights_spec.rb
@@ -369,6 +372,7 @@ files:
369
372
  - spec/fb_graph/note_spec.rb
370
373
  - spec/fb_graph/page_spec.rb
371
374
  - spec/fb_graph/photo_spec.rb
375
+ - spec/fb_graph/place_spec.rb
372
376
  - spec/fb_graph/post_spec.rb
373
377
  - spec/fb_graph/privacy_spec.rb
374
378
  - spec/fb_graph/project_spec.rb
@@ -442,6 +446,7 @@ test_files:
442
446
  - spec/fb_graph/connections/feed_spec.rb
443
447
  - spec/fb_graph/connections/friend_lists_spec.rb
444
448
  - spec/fb_graph/connections/friends_spec.rb
449
+ - spec/fb_graph/connections/games_spec.rb
445
450
  - spec/fb_graph/connections/groups_spec.rb
446
451
  - spec/fb_graph/connections/home_spec.rb
447
452
  - spec/fb_graph/connections/insights_spec.rb
@@ -476,6 +481,7 @@ test_files:
476
481
  - spec/fb_graph/note_spec.rb
477
482
  - spec/fb_graph/page_spec.rb
478
483
  - spec/fb_graph/photo_spec.rb
484
+ - spec/fb_graph/place_spec.rb
479
485
  - spec/fb_graph/post_spec.rb
480
486
  - spec/fb_graph/privacy_spec.rb
481
487
  - spec/fb_graph/project_spec.rb