open_graph 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,17 +9,17 @@
9
9
  state('appId', data.appId);
10
10
  }
11
11
 
12
- function login(callback){
12
+ function login(callback, options){
13
13
  if (calledBeforeInit('login')) return;
14
14
  if (FBWorld.state('loggedIn')){
15
15
  console.log('FB.login() called when user is already connected.');
16
16
  if (FBWorld.state('connected')){
17
- callback(getStatus());
17
+ callback(getStatus('standard'));
18
18
  }else{
19
- simulatePromptToConnect(callback);
19
+ simulatePromptToConnect(callback, options);
20
20
  }
21
21
  }else{
22
- simulatePromptToLogin(callback);
22
+ simulatePromptToLogin(callback, options);
23
23
  }
24
24
  }
25
25
 
@@ -32,7 +32,7 @@
32
32
 
33
33
  function getLoginStatus(callback, perms){
34
34
  if (calledBeforeInit('getLoginStatus')) return;
35
- callback(getStatus(perms));
35
+ callback(getStatus(perms ? 'extended' : false));
36
36
  }
37
37
 
38
38
  function getSession(){
@@ -160,7 +160,7 @@
160
160
 
161
161
  // PRIVATE FUNCTIONS
162
162
 
163
- function getStatus(includePerms) {
163
+ function getStatus(permissions) {
164
164
  var theState = FBWorld.state();
165
165
 
166
166
  // Connected
@@ -170,7 +170,9 @@
170
170
  session: createConnectedCookie()
171
171
  };
172
172
 
173
- if (includePerms) status.perms = JSON.stringify(theState.perms);
173
+ if(typeof(permissions) != 'undefined') {
174
+ status.perms = permissions == 'extended' ? JSON.stringify(theState.perms) : theState.perms.standard;
175
+ }
174
176
  return status;
175
177
  }
176
178
 
@@ -200,7 +202,7 @@
200
202
  return true;
201
203
  }
202
204
 
203
- function simulatePromptToLogin(callback) {
205
+ function simulatePromptToLogin(callback, options) {
204
206
  // simulate being prompted to log in
205
207
  FBWorld.beingPromptedToLogIn = true;
206
208
  FBWorld.beingPromptedToLogInCallback = function(approved){
@@ -209,9 +211,10 @@
209
211
  if(approved){
210
212
  FBWorld.loggedIn();
211
213
  if (!FBWorld.state('connected')){
212
- simulatePromptToConnect(callback);
214
+ simulatePromptToConnect(callback, options);
213
215
  }else{
214
- callback(getStatus());
216
+ FBWorld.state('perms', 'standard', options.perms);
217
+ callback(getStatus('standard'));
215
218
  }
216
219
  }else{
217
220
  FBWorld.notLoggedIn();
@@ -221,14 +224,17 @@
221
224
  };
222
225
  };
223
226
 
224
- function simulatePromptToConnect(callback) {
227
+ function simulatePromptToConnect(callback, options) {
225
228
  // simulate being prompted to connect
226
229
  FBWorld.beingPromptedToConnect = true;
227
230
  FBWorld.beingPromptedToConnectCallback = function(approved){
228
231
  approved ? FBWorld.connected() : FBWorld.notConnected();
229
232
  FBWorld.beingPromptedToConnect = false;
230
233
  FBWorld.beingPromptedToConnectCallback = undefined;
231
- callback(getStatus());
234
+ if (approved){
235
+ FBWorld.state('perms', 'standard', options.perms);
236
+ }
237
+ callback(getStatus('standard'));
232
238
  };
233
239
  };
234
240
 
@@ -1,3 +1,3 @@
1
1
  module OpenGraph
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Change.org Engineering
@@ -15,11 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-09 00:00:00 -07:00
18
+ date: 2011-06-14 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ name: rake
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
24
26
  requirements:
25
27
  - - ">="
@@ -28,10 +30,8 @@ dependencies:
28
30
  segments:
29
31
  - 0
30
32
  version: "0"
31
- requirement: *id001
32
- name: rake
33
- prerelease: false
34
33
  type: :runtime
34
+ version_requirements: *id001
35
35
  description: OpenGraph provides an easy to use wrapper for making facebook calls. It also provides javascript stubs allowing seemless testing against the javascript sdk.
36
36
  email:
37
37
  - engineering@change.org