ymdp 0.4.1 → 0.4.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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -48,7 +48,7 @@ YAHOO.init.startup = function() {
48
48
  } catch(omg) {
49
49
  Debug.error(omg);
50
50
  }
51
- YAHOO.init.local();
51
+ YAHOO.oib.getUserState(YAHOO.init.local, YAHOO.init.local);
52
52
  });
53
53
  };
54
54
 
@@ -133,27 +133,3 @@ YAHOO.init.showAndFinish = function() {
133
133
  YAHOO.init.show();
134
134
  YAHOO.init.after();
135
135
  };
136
-
137
- YAHOO.init.translateToolbar = function() {
138
- Debug.log("begin YAHOO.init.translateToolbar");
139
- // will we have a toolbar?
140
- Debug.log("end YAHOO.init.translateToolbar");
141
- };
142
-
143
- YAHOO.init.translateGreeting = function() {
144
- Debug.log("begin YAHOO.init.translateGreeting");
145
- };
146
-
147
- YAHOO.init.translateSubhead = function() {
148
- Debug.log("YAHOO.init.translateSubhead");
149
- };
150
-
151
-
152
- YAHOO.init.translateFooter = function() {
153
- I18n.update('copyright', 'COPYRIGHT');
154
- I18n.update('about_link', 'ABOUT');
155
- I18n.update('support_link', 'SUPPORT');
156
- I18n.update('contact_link', 'CONTACT');
157
- I18n.update('privacy_link', 'PRIVACY');
158
- I18n.update('terms_and_conditions_link', 'TERMS_AND_CONDITIONS');
159
- };
@@ -1,32 +1,11 @@
1
- // gets both guid and ymail_wssid and stores them then runs the callback_function
2
- //
3
- // YAHOO.oib.ymail_wssid
4
- // YAHOO.oib.guid
5
- //
6
- YAHOO.oib.getGuidAndYmailWssid = function(callback_function) {
7
- Debug.log("YAHOO.oib.getGuidAndYmailWssid");
8
- YAHOO.oib.getGuid(function(guid) {
9
- YAHOO.oib.getYmailWssid(function(ymail_wssid) {
10
- callback_function(guid, ymail_wssid);
11
- });
12
- });
13
- };
14
-
15
1
  // gets user's state info from /ymdp/state
16
2
  // including the user's OIB login
17
3
  //
18
- YAHOO.oib.getUserState = function(success_function) {
4
+ YAHOO.oib.getUserState = function(success_function, error_function) {
19
5
  Debug.log("YAHOO.oib.getUserState");
20
6
  OIB.get("ymdp/state", {}, function(response) {
21
7
  Debug.log("YAHOO.oib.getUserState callback", response);
22
- YAHOO.oib.response = response;
23
- try {
24
- YAHOO.oib.since_date = formatUnixDate(YAHOO.oib.response.since_date.s);
25
- } catch(omg) {
26
- YAHOO.oib.since_date = 1294869484;
27
- }
28
- YAHOO.oib.login = response.login;
29
- YAHOO.oib.state = response.state;
8
+ YAHOO.oib.setUserVariables(response);
30
9
 
31
10
  if (success_function) {
32
11
  Debug.log("YAHOO.oib.getUserState: About to success function")
@@ -34,25 +13,40 @@ YAHOO.oib.getUserState = function(success_function) {
34
13
  }
35
14
  },
36
15
  function() {
37
- YAHOO.logger.error("Failed to get user's state");
16
+ // YAHOO.logger.error("Failed to get user's state");
17
+ Debug.log("Failed to get user's state");
18
+ if (error_function) {
19
+ error_function();
20
+ }
38
21
  });
39
22
  };
40
23
 
41
-
24
+ YAHOO.oib.setUserVariables = function(response) {
25
+ YAHOO.oib.response = response;
26
+ try {
27
+ YAHOO.oib.since_date = formatUnixDate(YAHOO.oib.response.since_date.s);
28
+ } catch(omg) {
29
+ YAHOO.oib.since_date = 1294869484;
30
+ }
31
+ YAHOO.oib.login = response.login;
32
+ YAHOO.oib.state = response.state;
33
+ };
42
34
 
43
35
  /*
44
36
  YAHOO.oib.verifyUser
45
37
 
46
38
  global to all views. calls the 'verify' action on ymdp controller and executes
47
39
  a function with the result.
40
+
41
+ Sends the server the user's guid and 'ymail_wssid', which signs the user in if the
42
+ values match what we have in the database.
48
43
  */
49
44
  YAHOO.oib.verifyUser = function(success_function, error_function) {
50
45
  Debug.log("YAHOO.oib.verifyUser");
51
46
 
52
47
  OIB.get("ymdp/verify", {
53
48
  ymail_guid: YAHOO.oib.guid,
54
- ymail_wssid: YAHOO.oib.ymail_wssid,
55
- application: View.application
49
+ ymail_wssid: YAHOO.oib.ymail_wssid
56
50
  }, function(response) {
57
51
  YAHOO.oib.user = response;
58
52
  Debug.log("YAHOO.oib.verifyUser YAHOO.oib.user", YAHOO.oib.user);
@@ -68,19 +62,17 @@ YAHOO.oib.verifyUser = function(success_function, error_function) {
68
62
  AUTHENTICATION
69
63
  */
70
64
 
71
- YAHOO.oib.signInUser = function() {
72
- Debug.log("YAHOO.oib.signInUser");
73
- OIB.get("ymdp/signin", {}, function(response) {
74
- Debug.log("inside ymdp/signin callback", response);
75
- Debug.log("YAHOO.oib.response", YAHOO.oib.response);
76
- if (response.ymail_wssid === "false") {
77
- // signin didn't work properly, display an error
78
- Debug.log("YAHOO.oib.response was false");
79
- YAHOO.oib.showError({
80
- "method": "YAHOO.oib.signInUser",
81
- "description": "no ymail_wssid"
82
- });
83
- } else {
65
+ // Gets the ymail_wssid which is stored in the database on the remote server
66
+ // for the current user.
67
+ //
68
+ YAHOO.oib.confirm = function() {
69
+ Debug.log("YAHOO.oib.confirm");
70
+ OIB.get("ymdp/confirm", {
71
+ "ymail_guid": YAHOO.oib.guid
72
+ }, function(response) {
73
+ Debug.log("inside ymdp/signin callback", response);
74
+
75
+ if (response.ymail_wssid) {
84
76
  Debug.log("YAHOO.oib.response wasn't false");
85
77
  // store ymail_wssid in permanent store
86
78
 
@@ -91,50 +83,39 @@ YAHOO.oib.signInUser = function() {
91
83
  "ymail_wssid": sliced_wssid
92
84
  };
93
85
 
94
- Debug.log("About to call Data.sore", data);
86
+ Debug.log("About to call Data.store", data);
95
87
 
96
88
  Data.store(data);
97
89
  YAHOO.oib.ymail_wssid = response.ymail_wssid;
98
90
 
99
- YAHOO.oib.verifyUser(YAHOO.launcher.launchMain);
91
+ // now that we've got their ymail_wssid, we can sign them in:
92
+ // YAHOO.oib.verifyUser(YAHOO.launcher.launchMain);
93
+ YAHOO.launcher.launchMain();
94
+ } else {
95
+ // signin didn't work properly, display an error
96
+ Debug.log("YAHOO.oib.response was false");
97
+ YAHOO.oib.showError({
98
+ "method": "YAHOO.oib.confirm",
99
+ "description": "no ymail_wssid"
100
+ });
100
101
  }
101
- });
102
+ });
102
103
  };
103
104
 
104
-
105
- // gets the guid from the Yahoo! environment and executes the success callback
106
- // if there is a guid, and the error callback if it's undefined
105
+ // gets both guid and ymail_wssid and stores them then runs the callback_function
107
106
  //
107
+ // YAHOO.oib.ymail_wssid
108
108
  // YAHOO.oib.guid
109
109
  //
110
- YAHOO.oib.getGuid = function(success_function, error_function) {
111
- Debug.log("YAHOO.oib.getGuid");
112
-
113
- openmail.Application.getParameters(function(response) {
114
- YAHOO.oib.guid = response.user.guid;
115
- try {
116
- Debug.log("YAHOO.oib.getGuid getParameters response", response);
117
-
118
- var params = {};
119
- if (response.data) {
120
- params = response.data.launchParams;
121
- }
122
- Params.init(params);
123
- } catch(omg) {
124
- Debug.error("error getting parameters: " + omg);
125
- }
126
- if (YAHOO.oib.guid !== undefined) {
127
- Try.these(
128
- function() { success_function(YAHOO.oib.guid); }
129
- );
130
- }
131
- else {
132
- Try.these(error_function);
133
- }
110
+ YAHOO.oib.getGuidAndYmailWssid = function(callback_function) {
111
+ Debug.log("YAHOO.oib.getGuidAndYmailWssid");
112
+ YAHOO.oib.getGuid(function(guid) {
113
+ YAHOO.oib.getYmailWssid(function(ymail_wssid) {
114
+ callback_function(guid, ymail_wssid);
115
+ });
134
116
  });
135
117
  };
136
118
 
137
-
138
119
  // gets the ymail_wssid from the permanent store and executes the callback function
139
120
  // if there is a ymail_wssid, and the error callback if it's undefined
140
121
  //
@@ -146,42 +127,67 @@ YAHOO.oib.getYmailWssid = function(success_function, error_function) {
146
127
  // this function will show the error page if the ymail_wssid has not been set
147
128
  //
148
129
  var show_error = function() {
149
- if (YAHOO.oib.ymail_wssid === undefined) {
130
+ if (!YAHOO.oib.ymail_wssid) {
150
131
  Debug.log("No YAHOO.oib.ymail_wssid");
151
132
 
152
133
  YAHOO.oib.showError({
153
134
  "retry": "hide"
154
135
  });
155
- } else {
156
- Debug.log("YAHOO.oib.ymail_wssid does exist", YAHOO.oib.ymail_wssid);
157
136
  }
158
137
  };
159
138
 
160
139
  // run the show_error function after 5 seconds
161
140
  //
162
- Debug.log("Set timeout for error function to 5 seconds");
163
- YAHOO.oib.setTimeoutInSeconds(show_error, 5);
164
- Debug.log("About to call Data.fetch");
141
+ // Debug.log("Set timeout for error function to 10 seconds");
142
+ // YAHOO.oib.setTimeoutInSeconds(show_error, 10);
143
+ // Debug.log("About to call Data.fetch");
165
144
 
166
145
  // retrieve the user's ymail_wssid and store it in YAHOO.oib.ymail_wssid
167
146
  //
168
147
  Data.fetch(["ymail_wssid"], function(response) {
169
148
  Debug.log("Inside Data.fetch callback");
170
149
  YAHOO.oib.ymail_wssid = response.data.ymail_wssid;
171
- if (YAHOO.oib.ymail_wssid !== undefined) {
172
- Debug.log("YAHOO.oib.ymail_wssid is defined", YAHOO.oib.ymail_wssid);
173
-
174
- try {
175
- success_function(YAHOO.oib.ymail_wssid);
176
- } catch(omg) {
177
- Debug.error("Error in YAHOO.oib.getYmailWssid getData callback", omg);
178
- }
179
-
150
+
151
+ Debug.log("YAHOO.oib.ymail_wssid is defined", YAHOO.oib.ymail_wssid);
152
+
153
+ try {
154
+ success_function(YAHOO.oib.ymail_wssid);
155
+ } catch(omg) {
156
+ Debug.error("Error in YAHOO.oib.getYmailWssid getData callback", omg);
157
+ }
158
+ });
159
+ };
160
+
161
+ // gets the guid from the Yahoo! environment and executes the success callback
162
+ // if there is a guid, and the error callback if it's undefined
163
+ //
164
+ // YAHOO.oib.guid
165
+ //
166
+ YAHOO.oib.getGuid = function(success_function, error_function) {
167
+ Debug.log("YAHOO.oib.getGuid");
168
+
169
+ openmail.Application.getParameters(function(response) {
170
+ YAHOO.oib.guid = response.user.guid;
171
+ try {
172
+ Debug.log("YAHOO.oib.getGuid getParameters response", response);
173
+
174
+ var params = {};
175
+ if (response.data) {
176
+ params = response.data.launchParams;
177
+ }
178
+ Params.init(params);
179
+ } catch(omg) {
180
+ Debug.error("error getting parameters: " + omg);
181
+ }
182
+ if (YAHOO.oib.guid !== undefined) {
183
+ Try.these(
184
+ function() { success_function(YAHOO.oib.guid); }
185
+ );
180
186
  }
181
187
  else {
182
188
  Try.these(error_function);
183
189
  }
184
- });
190
+ });
185
191
  };
186
192
 
187
193
  YAHOO.oib.deactivateUser = function() {
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ymdp}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Coleman"]
12
- s.date = %q{2011-04-03}
12
+ s.date = %q{2011-04-04}
13
13
  s.description = %q{Framework for developing applications in the Yahoo! Mail Development Platform.}
14
14
  s.email = %q{progressions@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ymdp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Coleman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-03 00:00:00 -05:00
18
+ date: 2011-04-04 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency