retreaverjs-rails 0.2.10 → 0.2.11

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/retreaverjs/rails/version.rb +1 -1
  3. data/package.json +1 -1
  4. data/src/retreaver/campaign.js +1 -1
  5. data/vendor/assets/javascripts/retreaver.js +1 -1
  6. data/vendor/documentation/javascript/v1/Retreaver.Campaign.html +383 -263
  7. data/vendor/documentation/javascript/v1/Retreaver.Number.html +910 -644
  8. data/vendor/documentation/javascript/v1/Retreaver.html +157 -134
  9. data/vendor/documentation/javascript/v1/fonts/OpenSans-Bold-webfont.eot +0 -0
  10. data/vendor/documentation/javascript/v1/fonts/OpenSans-Bold-webfont.svg +1830 -0
  11. data/vendor/documentation/javascript/v1/fonts/OpenSans-Bold-webfont.woff +0 -0
  12. data/vendor/documentation/javascript/v1/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  13. data/vendor/documentation/javascript/v1/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  14. data/vendor/documentation/javascript/v1/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  15. data/vendor/documentation/javascript/v1/fonts/OpenSans-Italic-webfont.eot +0 -0
  16. data/vendor/documentation/javascript/v1/fonts/OpenSans-Italic-webfont.svg +1830 -0
  17. data/vendor/documentation/javascript/v1/fonts/OpenSans-Italic-webfont.woff +0 -0
  18. data/vendor/documentation/javascript/v1/fonts/OpenSans-Light-webfont.eot +0 -0
  19. data/vendor/documentation/javascript/v1/fonts/OpenSans-Light-webfont.svg +1831 -0
  20. data/vendor/documentation/javascript/v1/fonts/OpenSans-Light-webfont.woff +0 -0
  21. data/vendor/documentation/javascript/v1/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  22. data/vendor/documentation/javascript/v1/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  23. data/vendor/documentation/javascript/v1/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  24. data/vendor/documentation/javascript/v1/fonts/OpenSans-Regular-webfont.eot +0 -0
  25. data/vendor/documentation/javascript/v1/fonts/OpenSans-Regular-webfont.svg +1831 -0
  26. data/vendor/documentation/javascript/v1/fonts/OpenSans-Regular-webfont.woff +0 -0
  27. data/vendor/documentation/javascript/v1/global.html +119 -97
  28. data/vendor/documentation/javascript/v1/index.html +10 -8
  29. data/vendor/documentation/javascript/v1/retreaver.js.html +8 -7
  30. data/vendor/documentation/javascript/v1/{campaign.js.html → retreaver_campaign.js.html} +39 -26
  31. data/vendor/documentation/javascript/v1/{number.js.html → retreaver_number.js.html} +24 -7
  32. data/vendor/documentation/javascript/v1/scripts/linenumber.js +19 -11
  33. data/vendor/documentation/javascript/v1/styles/jsdoc-default.css +193 -129
  34. data/vendor/documentation/javascript/v1/styles/prettify-tomorrow.css +1 -1
  35. metadata +21 -3
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <title>JSDoc: Global</title>
6
-
6
+
7
7
  <script src="scripts/prettify/prettify.js"> </script>
8
8
  <script src="scripts/prettify/lang-css.js"> </script>
9
9
  <!--[if lt IE 9]>
@@ -16,124 +16,135 @@
16
16
  <body>
17
17
 
18
18
  <div id="main">
19
-
19
+
20
20
  <h1 class="page-title">Global</h1>
21
-
21
+
22
22
 
23
23
 
24
24
 
25
25
 
26
+
26
27
  <section>
27
-
28
+
28
29
  <header>
29
- <h2>
30
30
 
31
- </h2>
31
+ <h2></h2>
32
+
32
33
 
33
- </header>
34
+ </header>
34
35
 
35
36
  <article>
36
37
  <div class="container-overview">
37
38
 
38
-
39
-
40
-
41
39
 
40
+
42
41
 
42
+
43
+
43
44
  <dl class="details">
44
-
45
-
46
-
47
-
48
-
49
45
 
50
46
 
47
+
51
48
 
49
+
52
50
 
51
+
53
52
 
53
+
54
54
 
55
+
55
56
 
57
+
56
58
 
59
+
57
60
 
61
+
58
62
 
63
+
59
64
 
65
+
60
66
 
67
+
61
68
 
69
+
62
70
 
71
+
63
72
 
73
+
64
74
 
65
-
66
-
67
-
75
+
68
76
 
69
77
  </dl>
70
78
 
71
-
79
+
72
80
 
73
81
 
74
82
  </div>
83
+
75
84
 
85
+
76
86
 
87
+
77
88
 
89
+
90
+
91
+
78
92
 
93
+
79
94
 
95
+
80
96
 
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
97
+
90
98
 
91
99
  <h3 class="subsection-title">Type Definitions</h3>
100
+
92
101
 
93
- <dl>
94
102
 
95
- <dt>
96
- <h4 class="name" id="getNumberCallback"><span class="type-signature"></span>getNumberCallback<span class="signature">()</span><span class="type-signature"></span></h4>
97
-
98
-
99
- </dt>
100
- <dd>
101
-
102
-
103
- <div class="description">
104
- Retreaver.Campaign#request_number callback fired after the request completes.
105
- </div>
106
-
107
103
 
108
104
 
105
+
106
+ <h4 class="name" id="getNumberCallback"><span class="type-signature"></span>getNumberCallback<span class="signature">()</span><span class="type-signature"></span></h4>
107
+
109
108
 
109
+
110
+
111
+
112
+ <div class="description">
113
+ Retreaver.Campaign#request_number callback fired after the request completes.
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <h5>Parameters:</h5>
110
125
 
111
-
112
-
113
- <h5>Parameters:</h5>
114
-
115
126
 
116
127
  <table class="params">
117
128
  <thead>
118
- <tr>
119
-
120
-
121
- <th>Type</th>
122
-
123
-
124
-
125
-
126
-
127
- <th class="last">Description</th>
128
- </tr>
129
- </thead>
130
-
131
- <tbody>
132
-
133
-
129
+ <tr>
130
+
131
+
132
+ <th>Type</th>
133
+
134
+
135
+
136
+
137
+
138
+ <th class="last">Description</th>
139
+ </tr>
140
+ </thead>
141
+
142
+ <tbody>
143
+
144
+
134
145
  <tr>
135
146
 
136
-
147
+
137
148
  <td class="type">
138
149
 
139
150
 
@@ -142,74 +153,85 @@
142
153
 
143
154
 
144
155
  </td>
156
+
145
157
 
158
+
146
159
 
147
-
148
-
149
-
160
+
150
161
  <td class="description last">The number that was returned</td>
151
162
  </tr>
152
-
153
-
154
- </tbody>
155
- </table>
156
-
157
-
163
+
158
164
 
165
+ </tbody>
166
+ </table>
167
+
168
+
169
+
170
+
171
+
172
+
159
173
  <dl class="details">
160
-
161
-
162
-
163
-
164
-
165
174
 
166
175
 
176
+
167
177
 
178
+
168
179
 
180
+
169
181
 
182
+
170
183
 
184
+
171
185
 
186
+
172
187
 
188
+
173
189
 
190
+
174
191
 
192
+
175
193
 
194
+
176
195
 
196
+
177
197
 
198
+
178
199
 
179
200
  <dt class="tag-source">Source:</dt>
180
201
  <dd class="tag-source"><ul class="dummy"><li>
181
- <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line123">line 123</a>
202
+ <a href="retreaver_campaign.js.html">retreaver/campaign.js</a>, <a href="retreaver_campaign.js.html#line135">line 135</a>
182
203
  </li></ul></dd>
183
204
 
205
+
184
206
 
207
+
185
208
 
186
-
187
-
188
-
209
+
189
210
 
190
211
  </dl>
191
212
 
192
-
193
-
194
213
 
195
-
196
214
 
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
- </dd>
205
215
 
206
- </dl>
207
-
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
208
229
 
230
+
209
231
 
210
232
  </article>
211
233
 
212
- </section>
234
+ </section>
213
235
 
214
236
 
215
237
 
@@ -217,13 +239,13 @@
217
239
  </div>
218
240
 
219
241
  <nav>
220
- <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
242
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
221
243
  </nav>
222
244
 
223
- <br clear="both">
245
+ <br class="clear">
224
246
 
225
247
  <footer>
226
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Oct 27 2016 22:04:38 GMT-0400 (EDT)
248
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Feb 16 2017 17:35:24 GMT-0500 (EST)
227
249
  </footer>
228
250
 
229
251
  <script> prettyPrint(); </script>
@@ -2,8 +2,8 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
- <title>JSDoc: Index</title>
6
-
5
+ <title>JSDoc: Home</title>
6
+
7
7
  <script src="scripts/prettify/prettify.js"> </script>
8
8
  <script src="scripts/prettify/lang-css.js"> </script>
9
9
  <!--[if lt IE 9]>
@@ -16,12 +16,13 @@
16
16
  <body>
17
17
 
18
18
  <div id="main">
19
-
20
- <h1 class="page-title">Index</h1>
21
-
19
+
20
+ <h1 class="page-title">Home</h1>
21
+
22
22
 
23
23
 
24
24
 
25
+
25
26
 
26
27
 
27
28
 
@@ -35,6 +36,7 @@
35
36
 
36
37
 
37
38
 
39
+
38
40
 
39
41
 
40
42
 
@@ -52,13 +54,13 @@
52
54
  </div>
53
55
 
54
56
  <nav>
55
- <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
57
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
56
58
  </nav>
57
59
 
58
- <br clear="both">
60
+ <br class="clear">
59
61
 
60
62
  <footer>
61
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Oct 27 2016 22:04:38 GMT-0400 (EDT)
63
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Feb 16 2017 17:35:24 GMT-0500 (EST)
62
64
  </footer>
63
65
 
64
66
  <script> prettyPrint(); </script>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <title>JSDoc: Source: retreaver.js</title>
6
-
6
+
7
7
  <script src="scripts/prettify/prettify.js"> </script>
8
8
  <script src="scripts/prettify/lang-css.js"> </script>
9
9
  <!--[if lt IE 9]>
@@ -16,16 +16,17 @@
16
16
  <body>
17
17
 
18
18
  <div id="main">
19
-
19
+
20
20
  <h1 class="page-title">Source: retreaver.js</h1>
21
+
21
22
 
22
-
23
+
23
24
 
24
25
 
25
26
 
26
27
  <section>
27
28
  <article>
28
- <pre class="prettyprint source"><code>(function (context) {
29
+ <pre class="prettyprint source linenums"><code>(function (context) {
29
30
  /**
30
31
  * @namespace Retreaver
31
32
  */
@@ -68,13 +69,13 @@
68
69
  </div>
69
70
 
70
71
  <nav>
71
- <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
72
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
72
73
  </nav>
73
74
 
74
- <br clear="both">
75
+ <br class="clear">
75
76
 
76
77
  <footer>
77
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Oct 27 2016 22:04:38 GMT-0400 (EDT)
78
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Feb 16 2017 17:35:24 GMT-0500 (EST)
78
79
  </footer>
79
80
 
80
81
  <script> prettyPrint(); </script>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <title>JSDoc: Source: retreaver/campaign.js</title>
6
-
6
+
7
7
  <script src="scripts/prettify/prettify.js"> </script>
8
8
  <script src="scripts/prettify/lang-css.js"> </script>
9
9
  <!--[if lt IE 9]>
@@ -16,16 +16,17 @@
16
16
  <body>
17
17
 
18
18
  <div id="main">
19
-
19
+
20
20
  <h1 class="page-title">Source: retreaver/campaign.js</h1>
21
-
21
+
22
22
 
23
23
 
24
24
 
25
+
25
26
 
26
27
  <section>
27
28
  <article>
28
- <pre class="prettyprint source"><code>(function () {
29
+ <pre class="prettyprint source linenums"><code>(function() {
29
30
  // Dependencies
30
31
  var RequestNumber = Retreaver.Base.RequestNumber;
31
32
  /**
@@ -36,7 +37,7 @@
36
37
  * @example
37
38
  * var campaign = new Retreaver.Campaign({ campaign_key: '67d9fb1917ae8f4eaff36831b41788c3' });
38
39
  */
39
- var Campaign = function (options) {
40
+ var Campaign = function(options) {
40
41
 
41
42
  function initialize(data) {
42
43
  // initialize data store
@@ -56,9 +57,12 @@
56
57
  for (j = 0; j &lt; links.length; j++) {
57
58
  link = links[j];
58
59
  href = link.getAttribute('href');
59
- match = href.match(/tel:(.*)/);
60
- if (match && match[1] === rn['find']) {
61
- link.setAttribute('href', 'tel:' + rn['replace_with']);
60
+
61
+ if (href !== null) {
62
+ match = href.match(/tel:(.*)/);
63
+ if (match &amp;&amp; match[1] === rn['find']) {
64
+ link.setAttribute('href', 'tel:' + rn['replace_with']);
65
+ }
62
66
  }
63
67
  }
64
68
  }
@@ -74,7 +78,7 @@
74
78
  * @memberOf Retreaver.Campaign
75
79
  * @function request_number
76
80
  * @instance
77
- * @param {Object} tags - A collection of tags as key-value pairs. The number returned will match these tags.
81
+ * @param {Object} [tags] - A collection of tags as key-value pairs. The number returned will match these tags.
78
82
  * @param {getNumberCallback} callback - Callback fired if the request completes successfully.
79
83
  * @param {Function} error_callback - Callback fired if the request raises an error.
80
84
  * @example
@@ -84,7 +88,7 @@
84
88
  * alert('something went wrong: ' + response);
85
89
  * };
86
90
  */
87
- self.request_number = function (tags, callback, error_callback) {
91
+ self.request_number = function(tags, callback, error_callback) {
88
92
  // if the first argument is a function, the user has decided to skip passing tags
89
93
  // therefore cascade the arguments upwards so that everything works as expected
90
94
  if (typeof(tags) === 'function') {
@@ -95,12 +99,22 @@
95
99
  // argument 1 becomes an empty tags object
96
100
  tags = {};
97
101
  }
102
+
103
+ if (typeof callback === 'undefined') {
104
+ callback = function () {
105
+ };
106
+ }
107
+
108
+ if (typeof tags === 'undefined') {
109
+ tags = {};
110
+ }
111
+
98
112
  // assign the tags (this is important since it runs it through set_number_matching_tags)
99
113
  self.set('number_matching_tags', tags);
100
114
  // request the number
101
- new RequestNumber(self.get('campaign_key', 'number_matching_tags')).perform(function (data) {
115
+ new RequestNumber(self.get('campaign_key', 'number_matching_tags')).perform(function(data) {
102
116
  // did retreaver return a valid number?
103
- if (typeof(data) !== 'undefined' && typeof(data.number) !== 'undefined' && data.number !== '') {
117
+ if (typeof(data) !== 'undefined' &amp;&amp; typeof(data.number) !== 'undefined' &amp;&amp; data.number !== '') {
104
118
  // initialize number
105
119
  var number = new Retreaver.Number(data.number);
106
120
 
@@ -123,28 +137,27 @@
123
137
  * Auto replace all numbers on page according to campaign settings
124
138
  * Calls campaign.request_number
125
139
  * @memberOf Retreaver.Campaign
126
- * @function auto_replace_number
140
+ * @function auto_replace_numbers
127
141
  * @instance
142
+ * @param {Object} [tags] - A collection of tags as key-value pairs. The number returned will match these tags.
128
143
  * @param {getNumberCallback} callback - Callback fired if the request completes successfully.
129
144
  * @param {Function} error_callback - Callback fired if the request raises an error.
130
145
  * @example
131
- * campaign.auto_replace_number({calling_about: 'support'}, function (number) {
146
+ * campaign.auto_replace_numbers({calling_about: 'support'}, function (number) {
132
147
  * alert(number.get('number'))
133
148
  * }, function(response){
134
149
  * alert('something went wrong: ' + response);
135
150
  * };
136
151
  */
137
- self.auto_replace_numbers = function (callback, error_callback) {
152
+ self.auto_replace_numbers = function(tags, callback, error_callback) {
138
153
  if (typeof callback === 'undefined') {
139
- callback = function () {
140
- };
154
+ callback = function() {};
141
155
  }
142
156
 
143
157
  if (typeof error_callback === 'undefined') {
144
- error_callback = function () {
145
- };
158
+ error_callback = function() {};
146
159
  }
147
- self.request_number({}, callback, error_callback);
160
+ self.request_number(tags, callback, error_callback);
148
161
  };
149
162
 
150
163
  /**
@@ -153,7 +166,7 @@
153
166
  * @param {Retreaver.Number} - The number that was returned
154
167
  */
155
168
 
156
- self.numbers = function () {
169
+ self.numbers = function() {
157
170
  var output = [];
158
171
  if (typeof(Retreaver.Base.Data._store) !== 'undefined') {
159
172
  // get numbers
@@ -172,11 +185,11 @@
172
185
  return output;
173
186
  };
174
187
 
175
- self.set_number_matching_tags = function (tags) {
188
+ self.set_number_matching_tags = function(tags) {
176
189
  if (typeof(tags) === 'string') {
177
190
  tags = Retreaver.Number.extract_tags_from_string(tags);
178
191
  }
179
- if (tags && (typeof tags === "object") && !(tags instanceof Array)) {
192
+ if (tags &amp;&amp; (typeof tags === "object") &amp;&amp; !(tags instanceof Array)) {
180
193
  return tags
181
194
  } else {
182
195
  throw "ArgumentError: Expected number_matching_tags to be an object. eg: {tag: 'value'}";
@@ -198,13 +211,13 @@
198
211
  </div>
199
212
 
200
213
  <nav>
201
- <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
214
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Retreaver.Campaign.html">Campaign</a></li><li><a href="Retreaver.Number.html">Number</a></li></ul><h3>Namespaces</h3><ul><li><a href="Retreaver.html">Retreaver</a></li></ul><h3><a href="global.html">Global</a></h3>
202
215
  </nav>
203
216
 
204
- <br clear="both">
217
+ <br class="clear">
205
218
 
206
219
  <footer>
207
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Oct 27 2016 22:04:38 GMT-0400 (EDT)
220
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Feb 16 2017 17:35:24 GMT-0500 (EST)
208
221
  </footer>
209
222
 
210
223
  <script> prettyPrint(); </script>