open_graph 0.1.1 → 0.1.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/Readme.md CHANGED
@@ -4,6 +4,13 @@ A ruby wrapper for the new [facebook graph api](http://developers.facebook.com/d
4
4
 
5
5
  # Ruby #
6
6
 
7
+
8
+ ## How to build this gem ##
9
+
10
+ git clone ...
11
+ git submodule --init
12
+ gem build open_graph.gemspec
13
+
7
14
  ## Configuration ##
8
15
 
9
16
  Gemfile
@@ -1,5 +1,7 @@
1
1
  ;(function(window, undefined){
2
2
 
3
+ //var standardPerms = '{"extended":["status_update","photo_upload","video_upload","offline_access","email","create_note","share_item","publish_stream","contact_email"],"user":["manage_friendlists","create_event","read_requests","manage_pages"],"friends":[]}';
4
+
3
5
  // two globals for creating the cookie
4
6
  // FB Functions
5
7
  function init(data){
@@ -30,7 +32,7 @@
30
32
 
31
33
  function getLoginStatus(callback, perms){
32
34
  if (calledBeforeInit('getLoginStatus')) return;
33
- callback(getStatus());
35
+ callback(getStatus(perms));
34
36
  }
35
37
 
36
38
  function getSession(){
@@ -39,11 +41,9 @@
39
41
  }
40
42
 
41
43
  function api(location, callback){
42
-
43
44
  if(!FBWorld.state('connected')){
44
45
  callback(undefined);
45
- }
46
- if(location == '/me/friends'){
46
+ }else if(location == '/me/friends'){
47
47
  callback({data:FBWorld.friendList()});
48
48
  }
49
49
  }
@@ -59,6 +59,12 @@
59
59
  FBWorld.Helpers.makeMeACookie('fb-stub', JSON.stringify(theState));
60
60
  return arguments[1];
61
61
  }
62
+ if (arguments.length === 3) {
63
+ if(typeof(theState[arguments[0]]) == 'undefined') theState[arguments[0]] = {};
64
+ theState[arguments[0]][arguments[1]] = arguments[2];
65
+ FBWorld.Helpers.makeMeACookie('fb-stub', JSON.stringify(theState));
66
+ return arguments[2];
67
+ }
62
68
  }
63
69
 
64
70
  function uid(){
@@ -69,6 +75,10 @@
69
75
  return FBWorld.state('uid', newUid);
70
76
  }
71
77
 
78
+ function setExtendedPermissions(newPermissions){
79
+ return FBWorld.state('perms', 'extended', newPermissions);
80
+ }
81
+
72
82
  function setSecret(newSecret){
73
83
  return state('secret', newSecret);
74
84
  }
@@ -121,14 +131,15 @@
121
131
  };
122
132
 
123
133
  FBWorld = { // used to set the state of Facebook
124
- state : state,
125
- loggedIn : loggedIn,
126
- notLoggedIn : notLoggedIn,
127
- setUid : setUid,
128
- setSecret : setSecret,
129
- uid : uid,
130
- connected : connected,
131
- notConnected : notConnected,
134
+ state : state,
135
+ loggedIn : loggedIn,
136
+ notLoggedIn : notLoggedIn,
137
+ setUid : setUid,
138
+ setSecret : setSecret,
139
+ uid : uid,
140
+ connected : connected,
141
+ notConnected : notConnected,
142
+ setExtendedPermissions : setExtendedPermissions,
132
143
 
133
144
  initialized : false,
134
145
  beingPromptedToLogIn : false,
@@ -181,8 +192,6 @@
181
192
  };
182
193
  }
183
194
 
184
- // var selectedPerms = '{"extended":["status_update","photo_upload","video_upload","offline_access","email","create_note","share_item","publish_stream","contact_email"],"user":["manage_friendlists","create_event","read_requests","manage_pages"],"friends":[]}';
185
-
186
195
  };
187
196
 
188
197
  function calledBeforeInit() {
@@ -283,7 +292,6 @@
283
292
  })(this);
284
293
  FBWorld.Helpers = {};
285
294
  setTimeout(function() { if (typeof fbAsyncInit === 'function') fbAsyncInit(); }, 1);
286
-
287
295
  /**
288
296
  * Cookie plugin
289
297
  *
@@ -1,7 +1,5 @@
1
1
  module OpenGraph
2
2
  class FBOpenGraph
3
- @@access_token = nil
4
- @@uid = nil
5
3
 
6
4
  BASE_INFO = {
7
5
  "name" => "Gandalf The Grey",
@@ -33,6 +31,13 @@ module OpenGraph
33
31
 
34
32
  # class level methods for setting the responses you would like to get
35
33
  class << self
34
+
35
+ # you must run this before each test
36
+ def reset!
37
+ @@access_token = nil
38
+ @@uid = nil
39
+ end
40
+
36
41
  def info_override!(key, value)
37
42
  BASE_INFO[key.to_s] = value
38
43
  end
@@ -54,6 +59,8 @@ module OpenGraph
54
59
  end
55
60
  end
56
61
 
62
+ reset!
63
+
57
64
  def uid_with_testing
58
65
  @@uid || uid_without_testing
59
66
  end
@@ -1,3 +1,3 @@
1
1
  module OpenGraph
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
4
+ hash: 31
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Change.org Engineering
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-24 00:00:00 -07:00
18
+ date: 2011-05-23 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -41,6 +41,7 @@ files:
41
41
  - lib/open_graph/test/facebook_stub.rb
42
42
  - lib/open_graph/test/facebook_stub/picture.png
43
43
  - lib/open_graph/version.rb
44
+ - open_graph-0.1.1.gem
44
45
  - open_graph.gemspec
45
46
  - spec/open_graph_spec.rb
46
47
  - spec/spec_helper.rb
@@ -75,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
76
  requirements: []
76
77
 
77
78
  rubyforge_project: open_graph
78
- rubygems_version: 1.5.0
79
+ rubygems_version: 1.3.7
79
80
  signing_key:
80
81
  specification_version: 3
81
82
  summary: A ruby wrapper for the new facebook graph api