ymdp 0.5.1 → 0.6.0

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.5.1
1
+ 0.6.0
@@ -83,7 +83,7 @@ ABTesting = {
83
83
  error: function(data) {
84
84
  Debug.log("applyError", data);
85
85
  if (data.error !== 3002) {
86
- YAHOO.logger.error("Received body contents fetch error on page " + View.name + ": " + data.error + ' - ' + data.errorMsg);
86
+ Debug.error("Received body contents fetch error on page " + View.name + ": " + data.error + ' - ' + data.errorMsg);
87
87
  }
88
88
  YAHOO.init.showAndFinish();
89
89
  },
@@ -117,7 +117,7 @@ ABTesting = {
117
117
  try {
118
118
  $(content_id).update(response.html);
119
119
  } catch(omg) {
120
- YAHOO.logger.error(omg);
120
+ Debug.error(omg);
121
121
  }
122
122
  }
123
123
  YAHOO.init.showAndFinish();
@@ -33,7 +33,6 @@ OIB = {
33
33
  if (error_function) {
34
34
  error_function(response);
35
35
  } else {
36
- Debug.error("No error_function", response);
37
36
  YAHOO.oib.showError(
38
37
  {
39
38
  "method": "OIB.call",
@@ -45,7 +44,6 @@ OIB = {
45
44
  if (success_function) {
46
45
  success_function(response);
47
46
  } else {
48
- Debug.error("no success function", response);
49
47
  YAHOO.oib.showError(
50
48
  {
51
49
  "method": "OIB.call",
@@ -61,13 +59,19 @@ OIB = {
61
59
  ajax_response: false,
62
60
 
63
61
  ajax: function(url, method, params, success_function, error_function) {
62
+ var debug;
63
+
64
64
  params = params || {};
65
65
  params["application"] = View.application;
66
66
 
67
- Debug.log("OIB.ajax: About to call openmail.Application.callWebService: ", {
68
- "method": method,
69
- "url": url + "?" + Object.toQueryString(params)
70
- });
67
+ debug = !params["_hide_debug"];
68
+
69
+ if (debug) {
70
+ Debug.log("OIB.ajax: About to call openmail.Application.callWebService: ", {
71
+ "method": method,
72
+ "url": url + "?" + Object.toQueryString(params)
73
+ });
74
+ }
71
75
 
72
76
  openmail.Application.callWebService(
73
77
  {
@@ -78,25 +82,30 @@ OIB = {
78
82
  function(response) {
79
83
  // response from Ajax call was a 200 response
80
84
  //
81
- Debug.log("inside response from openMail.Application.callWebService", response);
85
+ if (debug) {
86
+ Debug.log("inside response from openMail.Application.callWebService", response);
87
+ }
82
88
  if (response.error) {
83
89
  // response has a parameter called "error"
84
90
  //
85
91
  if (error_function) {
86
92
  error_function(response);
87
93
  } else {
88
- OIB.error(url, params, response);
94
+ if (debug) {
95
+ OIB.error(url, params, response);
96
+ }
89
97
  }
90
98
  } else {
91
99
  // SUCCESSFUL RESPONSE
92
100
  //
93
101
  // response doesn't have a parameter called "error"
94
102
  //
95
- Debug.log("success response inside openMail.Application.callWebService", response);
96
103
  try {
97
104
  success_function(response);
98
105
  } catch(e) {
99
- Debug.log("Error in OIB.request success function", e);
106
+ if (debug) {
107
+ Debug.log("Error in OIB.request success function", e);
108
+ }
100
109
  YAHOO.oib.showError({
101
110
  "method": "OIB.request",
102
111
  "description": "exception caught in OIB.request success callback",
@@ -108,11 +117,16 @@ OIB = {
108
117
  },
109
118
 
110
119
  request: function(oib_path, params, success_function, error_function, base_url) {
111
- Debug.log("inside OIB.request: ", {
112
- "oib_path": oib_path,
113
- "params": Object.toJSON(params)
114
- });
115
- var oib_url, method;
120
+ var oib_url, method, debug;
121
+
122
+ debug = !params["_hide_debug"];
123
+
124
+ if (debug) {
125
+ Debug.log("inside OIB.request: ", {
126
+ "oib_path": oib_path,
127
+ "params": Object.toJSON(params)
128
+ });
129
+ }
116
130
 
117
131
  oib_url = base_url ? base_url : YAHOO.constants.base_url;
118
132
 
@@ -134,17 +148,23 @@ OIB = {
134
148
  }
135
149
  params.version = params.version || <%= @version %>;
136
150
 
137
- Debug.log("about to call OIB.ajax");
151
+ if (debug) {
152
+ Debug.log("about to call OIB.ajax");
153
+ }
138
154
 
139
155
  OIB.ajax(oib_url, method, params, success_function, error_function);
140
156
  },
141
157
 
142
158
  // overwrite this function locally if you need to
143
159
  error: function(url, params, response) {
144
- var message;
160
+ var message, debug;
161
+
162
+ debug = !params["_hide_debug"];
145
163
 
146
- message = "OIB.error: " + Object.toJSON(response) + " calling url: " + url + "?" + Object.toQueryString(params);
147
- Debug.error(message);
164
+ if (debug) {
165
+ message = "OIB.error: " + Object.toJSON(response) + " calling url: " + url + "?" + Object.toQueryString(params);
166
+ Debug.error(message);
167
+ }
148
168
  },
149
169
 
150
170
  // advance the user to the next state in the signup process
@@ -52,8 +52,6 @@ function formatUnixDate(unixtime) {
52
52
  YAHOO.oib.showError = function(options) {
53
53
  var params;
54
54
 
55
- Debug.log("YAHOO.oib.showError", options);
56
-
57
55
  options = options || {};
58
56
 
59
57
  if (options["heading"]) {
@@ -35,6 +35,7 @@ Debug = {
35
35
  if (this.consoleOn()) {
36
36
  console[level](message);
37
37
  }
38
+ Logger.observe(message);
38
39
  },
39
40
 
40
41
  log: function() {
@@ -89,16 +90,17 @@ Debug = {
89
90
  },
90
91
 
91
92
  timestamp: function() {
92
- var time, hour, minute, second, timestamp, checktime;
93
+ var months, day, year, time, hour, minute, second, timestamp, checktime;
93
94
 
94
95
  time = new Date();
96
+ month = this.checktime(time.getMonth());
97
+ date = this.checktime(time.getDate());
98
+ year = this.checktime(time.getFullYear());
95
99
  hour = this.checktime(time.getHours());
96
100
  minute = this.checktime(time.getMinutes());
97
101
  second = this.checktime(time.getSeconds());
98
102
 
99
- // timestamp = month + "/" + date + "/" + year + " " +
100
-
101
- timestamp = hour + ":" + minute + ":" + second;
103
+ timestamp = month + "/" + date + "/" + year + " " + hour + ":" + minute + ":" + second;
102
104
 
103
105
  return timestamp;
104
106
  },
@@ -106,4 +108,4 @@ Debug = {
106
108
  generalInfo: function() {
107
109
  return "[<%= @domain %>/<%= @server %>] [<%= @version %> <%= @sprint_name %>]";
108
110
  }
109
- };
111
+ };
@@ -61,7 +61,6 @@ Flash.setFlashClass = function(flash_id, type) {
61
61
 
62
62
 
63
63
  Flash.error = function(message) {
64
- // YAHOO.logger.error(message);
65
64
  Flash.write("error", message, true);
66
65
  };
67
66
 
@@ -92,6 +92,7 @@ YAHOO.init.after = function() {
92
92
  YAHOO.oib.init = function() {
93
93
  Debug.log("OIB.init for view " + View.name, "<%= @message %>");
94
94
  try {
95
+ Logger.init();
95
96
  YAHOO.init.browser();
96
97
  YAHOO.init.resources();
97
98
  I18n.addLanguageToBody();
@@ -1,64 +1,27 @@
1
- /*
2
- YMDP LOGGER
3
-
4
- Send logging messages to OIB.
5
-
6
- Messages are saved in log/ymdp.log
7
-
8
-
9
- // DO NOT USE the @view instance variable in any files in /app/javascripts/base.
10
- // The way they are cached makes it not safe to do so.
11
-
12
- */
13
-
14
-
15
- /* set asset version */
16
-
17
- var LOGGER, Logger;
18
-
19
- LOGGER = {
20
- VERSION: "<%= @hash %>",
21
- MESSAGE: "<%= @message %>",
22
- DEPLOYED: <%= Time.now.to_i %>,
23
- DEPLOYED_STRING: "<%= Time.now.to_s %>"
24
- };
25
-
26
- YAHOO.namespace("logger");
27
-
28
- YAHOO.logger.write = function(level, message) {
29
- if (YAHOO.oib.login) {
30
- message = "[login: " + YAHOO.oib.login + "] " + message;
31
- }
32
- if (YAHOO.oib.guid) {
33
- message = "[guid: " + YAHOO.oib.guid + "] " + message;
34
- }
35
- OIB.post("ymdp/log",
36
- {
37
- level: level,
38
- message: message
39
- },
40
- function(response) {
41
- // log message written successfully
42
- });
43
- };
44
-
45
- YAHOO.logger.debug = function(message) {
46
- YAHOO.logger.write("debug", message);
47
- };
48
- YAHOO.logger.info = function(message) {
49
- YAHOO.logger.write("info", message);
50
- };
51
- YAHOO.logger.warn = function(message) {
52
- YAHOO.logger.write("warn", message);
53
- };
54
- YAHOO.logger.error = function(message) {
55
- YAHOO.logger.write("warn", message);
56
- };
57
- YAHOO.logger.fatal = function(message) {
58
- YAHOO.logger.write("fatal", message);
59
- };
60
-
61
-
62
- Logger = YAHOO.logger;
63
-
64
- // END YMDP LOGGER
1
+ var Logger;
2
+
3
+ Logger = {
4
+ on: false,
5
+
6
+ init: function() {
7
+ OIB.get("ymdp/state", {}, function(response) {
8
+ Logger.on = response.observe;
9
+ });
10
+ },
11
+
12
+ observe: function(message) {
13
+ if (this.on) {
14
+ this.log(message);
15
+ }
16
+ },
17
+
18
+ log: function(message) {
19
+ // console.log("LOGGING " + message);
20
+ OIB.post("ymdp/logs", {
21
+ "_hide_debug": true,
22
+ "log": message
23
+ }, function() {
24
+
25
+ });
26
+ }
27
+ };
@@ -14,7 +14,7 @@ var Reporter;
14
14
  //
15
15
  Reporter = {
16
16
  error: function(guid, params) {
17
- Debug.log("Reporter.error", params);
17
+ // Debug.log("Reporter.error", params);
18
18
  Reporter.report(guid, "error", params);
19
19
  },
20
20
 
@@ -30,7 +30,7 @@ Reporter = {
30
30
  params["ymail_guid"] = guid;
31
31
  params["view"] = view;
32
32
 
33
- Debug.log("Reporting guid " + guid + ", view " + view);
33
+ // Debug.log("Reporting guid " + guid + ", view " + view);
34
34
  Reporter.post(params);
35
35
  },
36
36
 
@@ -39,9 +39,9 @@ Reporter = {
39
39
  post: function(params) {
40
40
  params = params || {};
41
41
  OIB.post("ymdp/report", params, function(response) {
42
- Debug.log("Reported page view", params);
42
+ // Debug.log("Reported page view", params);
43
43
  }, function(response) {
44
- Debug.error("Error reporting page view with params", response);
44
+ // Debug.error("Error reporting page view with params", response);
45
45
  });
46
46
  },
47
47
  };
@@ -13,7 +13,6 @@ YAHOO.oib.getUserState = function(success_function, error_function) {
13
13
  }
14
14
  },
15
15
  function() {
16
- // YAHOO.logger.error("Failed to get user's state");
17
16
  Debug.log("Failed to get user's state");
18
17
  if (error_function) {
19
18
  error_function();
@@ -204,7 +203,6 @@ YAHOO.oib.deactivateUser = function() {
204
203
  "ymail_wssid": ymail_wssid
205
204
  },
206
205
  function(response) {
207
- // YAHOO.logger.info("Finished deactivating user");
208
206
  if (View.name !== "deactivate") {
209
207
  YAHOO.launcher.launchGoodbye();
210
208
  }
data/ymdp.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ymdp}
8
- s.version = "0.5.1"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Isaac Priestley"]
12
- s.date = %q{2011-04-22}
12
+ s.date = %q{2011-05-06}
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: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 1
10
- version: 0.5.1
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Isaac Priestley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-22 00:00:00 -05:00
18
+ date: 2011-05-06 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency