retreaverjs-rails 0.2.20 → 0.2.21

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 (30) 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 +11 -13
  5. data/vendor/assets/javascripts/retreaver.js +11 -13
  6. data/vendor/assets/javascripts/retreaver.min.js +2 -2
  7. data/vendor/documentation/javascript/dev/Retreaver.Campaign.html +654 -0
  8. data/vendor/documentation/javascript/dev/Retreaver.Number.html +1615 -0
  9. data/vendor/documentation/javascript/dev/Retreaver.html +330 -0
  10. data/vendor/documentation/javascript/dev/campaign.js.html +270 -0
  11. data/vendor/documentation/javascript/dev/global.html +232 -0
  12. data/vendor/documentation/javascript/dev/index.html +67 -0
  13. data/vendor/documentation/javascript/dev/number.js.html +274 -0
  14. data/vendor/documentation/javascript/dev/retreaver.js.html +84 -0
  15. data/vendor/documentation/javascript/dev/scripts/linenumber.js +17 -0
  16. data/vendor/documentation/javascript/dev/scripts/prettify/Apache-License-2.0.txt +202 -0
  17. data/vendor/documentation/javascript/dev/scripts/prettify/lang-css.js +2 -0
  18. data/vendor/documentation/javascript/dev/scripts/prettify/prettify.js +28 -0
  19. data/vendor/documentation/javascript/dev/styles/jsdoc-default.css +290 -0
  20. data/vendor/documentation/javascript/dev/styles/prettify-jsdoc.css +111 -0
  21. data/vendor/documentation/javascript/dev/styles/prettify-tomorrow.css +132 -0
  22. data/vendor/documentation/javascript/v1/Retreaver.Campaign.html +3 -3
  23. data/vendor/documentation/javascript/v1/Retreaver.Number.html +1 -1
  24. data/vendor/documentation/javascript/v1/Retreaver.html +1 -1
  25. data/vendor/documentation/javascript/v1/campaign.js.html +12 -14
  26. data/vendor/documentation/javascript/v1/global.html +2 -2
  27. data/vendor/documentation/javascript/v1/index.html +1 -1
  28. data/vendor/documentation/javascript/v1/number.js.html +1 -1
  29. data/vendor/documentation/javascript/v1/retreaver.js.html +1 -1
  30. metadata +18 -3
@@ -0,0 +1,232 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Global</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Global</h1>
21
+
22
+
23
+
24
+
25
+
26
+ <section>
27
+
28
+ <header>
29
+ <h2>
30
+
31
+ </h2>
32
+
33
+ </header>
34
+
35
+ <article>
36
+ <div class="container-overview">
37
+
38
+
39
+
40
+
41
+
42
+
43
+ <dl class="details">
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+ </dl>
70
+
71
+
72
+
73
+
74
+ </div>
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+ <h3 class="subsection-title">Type Definitions</h3>
92
+
93
+ <dl>
94
+
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
+
108
+
109
+
110
+
111
+
112
+
113
+ <h5>Parameters:</h5>
114
+
115
+
116
+ <table class="params">
117
+ <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
+
134
+ <tr>
135
+
136
+
137
+ <td class="type">
138
+
139
+
140
+ <span class="param-type"><a href="Retreaver.Number.html">Retreaver.Number</a></span>
141
+
142
+
143
+
144
+ </td>
145
+
146
+
147
+
148
+
149
+
150
+ <td class="description last">The number that was returned</td>
151
+ </tr>
152
+
153
+
154
+ </tbody>
155
+ </table>
156
+
157
+
158
+
159
+ <dl class="details">
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <dt class="tag-source">Source:</dt>
180
+ <dd class="tag-source"><ul class="dummy"><li>
181
+ <a href="campaign.js.html">retreaver/campaign.js</a>, <a href="campaign.js.html#line180">line 180</a>
182
+ </li></ul></dd>
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+ </dl>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ </dd>
205
+
206
+ </dl>
207
+
208
+
209
+
210
+ </article>
211
+
212
+ </section>
213
+
214
+
215
+
216
+
217
+ </div>
218
+
219
+ <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>
221
+ </nav>
222
+
223
+ <br clear="both">
224
+
225
+ <footer>
226
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jun 17 2024 14:31:16 GMT+0300 (EEST)
227
+ </footer>
228
+
229
+ <script> prettyPrint(); </script>
230
+ <script src="scripts/linenumber.js"> </script>
231
+ </body>
232
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Index</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Index</h1>
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ <h3> </h3>
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ <section>
44
+ <article><p>See our <a href="https://support.retreaver.com/callpixels-js/">knowledge base article</a> for more information.</p></article>
45
+ </section>
46
+
47
+
48
+
49
+
50
+
51
+
52
+ </div>
53
+
54
+ <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>
56
+ </nav>
57
+
58
+ <br clear="both">
59
+
60
+ <footer>
61
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jun 17 2024 14:31:16 GMT+0300 (EEST)
62
+ </footer>
63
+
64
+ <script> prettyPrint(); </script>
65
+ <script src="scripts/linenumber.js"> </script>
66
+ </body>
67
+ </html>
@@ -0,0 +1,274 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Source: retreaver/number.js</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Source: retreaver/number.js</h1>
21
+
22
+
23
+
24
+
25
+
26
+ <section>
27
+ <article>
28
+ <pre class="prettyprint source"><code>(function () {
29
+ // Dependencies
30
+ var Base = Retreaver.Base;
31
+ /**
32
+ * @constructor
33
+ * @memberOf Retreaver
34
+ * @param {Object} attributes - Attributes
35
+ * @property {Object} attributes
36
+ * @property {Number} attributes.id - The CallPixels internal number ID.
37
+ * @property {String} attributes.formatted_number - Nationally formatted phone number.
38
+ * @property {String} attributes.number - E.164 formatted phone number.
39
+ * @property {String} attributes.extension - The extension number.
40
+ * @property {String} attributes.plain_number - The unformatted phone number digits.
41
+ * @property {String} attributes.number_extension - The phone number digits with extension.
42
+ * @property {Boolean} attributes.target_open - Whether there is an open, available target.
43
+
44
+ */
45
+ Retreaver.Number = function (options) {
46
+
47
+ var self = this;
48
+ self.type = 'numbers';
49
+
50
+ function initialize(data) {
51
+ self.store(data);
52
+ self.set('is_active', 'true');
53
+ }
54
+
55
+ /**
56
+ * Add tags to a number.
57
+ * @memberOf Retreaver.Number
58
+ * @function add_tags
59
+ * @instance
60
+ * @param {Object} tags - A collection of tags {key: 'value', tag2: 'value2'}
61
+ * @param {Function} callback - Callback that will be fired after request.
62
+ * @throws Will throw an error if attempting to modify tags on a number that doesn't belong to a number pool
63
+ * with per-visitor numbers enabled.
64
+ */
65
+ self.add_tags = function (tags, callback) {
66
+ ensure_is_per_visitor();
67
+ self.post_data('numbers/tag', tags_payload(tags), callback);
68
+ };
69
+
70
+ /**
71
+ * Replace tags on a number. Any tags that already exist on the number that match the given keys will be
72
+ * removed. This can be used instead of calling remove_tags and then add_tags.
73
+ * @memberOf Retreaver.Number
74
+ * @function replace_tags
75
+ * @instance
76
+ * @param {Object} tags - A collection of tags {key: 'value', tag2: 'value2'}
77
+ * @param {Function} callback - Callback that will be fired after request.
78
+ * @throws Will throw an error if attempting to modify tags on a number that doesn't belong to a number pool
79
+ * with per-visitor numbers enabled.
80
+ */
81
+ self.replace_tags = function (tags, callback) {
82
+ ensure_is_per_visitor();
83
+ self.post_data('numbers/replace_tags', tags_payload(tags), callback);
84
+ };
85
+
86
+ /**
87
+ * Remove tags from a number.
88
+ * @memberOf Retreaver.Number
89
+ * @function remove_tags
90
+ * @instance
91
+ * @param {Object} tags - A collection of tags {key: 'value', tag2: 'value2'}
92
+ * @param {Function} callback - Callback that will be fired after request.
93
+ * @throws Will throw an error if attempting to modify tags on a number that doesn't belong to a number pool
94
+ * with per-visitor numbers enabled.
95
+ */
96
+ self.remove_tags = function (tags, callback) {
97
+ ensure_is_per_visitor();
98
+ self.post_data('numbers/untag', tags_payload(tags), callback);
99
+ };
100
+
101
+ /**
102
+ * Removes all tags with given keys from a number.
103
+ * @memberOf Retreaver.Number
104
+ * @function remove_tags_by_keys
105
+ * @instance
106
+ * @param {Array} keys - An array of keys to remove. eg: ['key1', 'key2']
107
+ * @param {Function} callback - Callback that will be fired after request.
108
+ * @throws Will throw an error if attempting to modify tags on a number that doesn't belong to a number pool
109
+ * with per-visitor numbers enabled.
110
+ */
111
+ self.remove_tags_by_keys = function (keys, callback) {
112
+ ensure_is_per_visitor();
113
+ if (typeof(keys) === 'string') keys = keys.split(',');
114
+ var payload = {
115
+ tag_keys: keys,
116
+ ids: [ get('id') ],
117
+ campaign_key: get('campaign_key')
118
+ };
119
+ self.post_data('numbers/untag/keys', payload, callback);
120
+ };
121
+
122
+ /**
123
+ * Clear all tags from a number.
124
+ * @memberOf Retreaver.Number
125
+ * @function clear_tags
126
+ * @instance
127
+ * @param {Function} callback - Callback that will be fired after request.
128
+ * @throws Will throw an error if attempting to modify tags on a number that doesn't belong to a number pool
129
+ * with per-visitor numbers enabled.
130
+ */
131
+ self.clear_tags = function (callback) {
132
+ ensure_is_per_visitor();
133
+ var payload = {
134
+ ids: [ get('id') ],
135
+ campaign_key: get('campaign_key'),
136
+ all: 'true'
137
+ };
138
+ self.post_data('numbers/untag', payload, callback);
139
+ };
140
+
141
+ /**
142
+ * Release number back to pool.
143
+ * @memberOf Retreaver.Number
144
+ * @function release
145
+ * @instance
146
+ */
147
+ self.release = function () {
148
+ self.set('is_active', 'false');
149
+ };
150
+
151
+ /**
152
+ * Start a call immediately by having a campaign target dial the visitor.
153
+ * @memberOf Retreaver.Number
154
+ * @function initiate_call
155
+ * @instance
156
+ * @param {String} dial - The number to call.
157
+ * @param {Object} payload - A collection of tags as key-value pairs and optional secure override properties.
158
+ * @param {string} [payload.target_map] - A string mapping a placeholder number to a phone number.
159
+ * @param {string} [payload.target_map_cs] - A SHA1 checksum of the target_map concatenated with your CallPixels API
160
+ * key.
161
+ * @param {number} [payload.timer_offset] - Number of seconds to offset the "connect" duration timers by.
162
+ * @param {string} [payload.timer_offset_cs] - An SHA1 checksum of the timer_offset concatenated with your
163
+ * CallPixels API key.
164
+ * @param {(string|number)} [payload.*] - Key value pairs treated as tags.
165
+ * @param {Function} callback - Callback that will be fired after request.
166
+ * @example
167
+ * number.initiate_call('4166686980', {company_name: 'CallPixels'}, function (call) {
168
+ * alert('Call started with UUID ' + call.uuid)
169
+ * });
170
+ */
171
+ self.initiate_call = function (dial, payload, callback) {
172
+ if (typeof(payload) === 'undefined') payload = {};
173
+ // assign dial to payload
174
+ payload.dial = dial;
175
+ // merge payload into payload
176
+ payload = Base.merge(self.get('id', 'campaign_key'), payload);
177
+ // post the payload
178
+ self.post_data('numbers/initiate_call', payload, callback);
179
+ };
180
+
181
+ function tags_payload(tags) {
182
+ if (typeof(tags) === 'string') tags = Retreaver.Number.extract_tags_from_string(tags);
183
+ return {
184
+ tag_values: tags,
185
+ ids: [ get('id') ],
186
+ campaign_key: get('campaign_key')
187
+ };
188
+ }
189
+
190
+ function get(key) {
191
+ return self.get(key);
192
+ }
193
+
194
+ function ensure_is_per_visitor() {
195
+ if (self.get('is_per_visitor') === false) {
196
+ throw "Error: Tried to add tags to non per-visitor number.";
197
+ }
198
+ }
199
+
200
+ initialize(options);
201
+ };
202
+
203
+ Retreaver.Number.extract_tags_from_string = function (tags) {
204
+ var output = {};
205
+ var tags = tags.split(",");
206
+ for (var i = 0; i &lt; tags.length; i++) {
207
+ var tag = tags[i].split(":");
208
+ output[tag[0]] = tag[1]
209
+ }
210
+ return output;
211
+ };
212
+
213
+ Retreaver.Number.prototype = new Retreaver.Base.Model();
214
+
215
+ function ping_active_numbers(callback) {
216
+ if (typeof(Retreaver.Base.Data._store) !== 'undefined') {
217
+ // get numbers
218
+ var numbers = Retreaver.Base.Data._store['numbers'];
219
+ // for each number
220
+ if (typeof(numbers) !== 'undefined') {
221
+ // group number_ids by campaign_key
222
+ var grouped = {};
223
+ for (var primary_key in numbers) {
224
+ var number = numbers[primary_key];
225
+ if (number.is_active === 'true') {
226
+ if (typeof(grouped[number.campaign_key]) === 'undefined') {
227
+ grouped[number.campaign_key] = [];
228
+ grouped[number.campaign_key]['ids'] = [];
229
+ grouped[number.campaign_key]['hashes'] = [];
230
+ }
231
+ grouped[number.campaign_key]['ids'].push(number.id);
232
+ grouped[number.campaign_key]['hashes'].push(number.id_checksum);
233
+ }
234
+ }
235
+ // ping each group of number_ids
236
+ for (var campaign_key in grouped) {
237
+ var payload = {
238
+ ids: grouped[campaign_key].ids,
239
+ hashes: grouped[campaign_key].hashes
240
+ };
241
+ Retreaver.Base.Request.connection().postJSON('/api/v1/numbers/ping', payload, [Retreaver.Base.Model.update, callback], this);
242
+ }
243
+ }
244
+ }
245
+ // call recursively
246
+ setTimeout(ping_active_numbers, 15000);
247
+ }
248
+
249
+ // always ping active numbers
250
+ ping_active_numbers();
251
+
252
+ })();</code></pre>
253
+ </article>
254
+ </section>
255
+
256
+
257
+
258
+
259
+ </div>
260
+
261
+ <nav>
262
+ <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>
263
+ </nav>
264
+
265
+ <br clear="both">
266
+
267
+ <footer>
268
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jun 17 2024 14:31:16 GMT+0300 (EEST)
269
+ </footer>
270
+
271
+ <script> prettyPrint(); </script>
272
+ <script src="scripts/linenumber.js"> </script>
273
+ </body>
274
+ </html>
@@ -0,0 +1,84 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>JSDoc: Source: retreaver.js</title>
6
+
7
+ <script src="scripts/prettify/prettify.js"> </script>
8
+ <script src="scripts/prettify/lang-css.js"> </script>
9
+ <!--[if lt IE 9]>
10
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
+ <![endif]-->
12
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
+ </head>
15
+
16
+ <body>
17
+
18
+ <div id="main">
19
+
20
+ <h1 class="page-title">Source: retreaver.js</h1>
21
+
22
+
23
+
24
+
25
+
26
+ <section>
27
+ <article>
28
+ <pre class="prettyprint source"><code>(function (context) {
29
+ /**
30
+ * @version dev
31
+ * @namespace Retreaver
32
+ */
33
+ var Retreaver = {
34
+
35
+ /**
36
+ * Configure the retreaver client library.
37
+ * @function configure
38
+ * @memberof Retreaver
39
+ * @param {Object} options
40
+ * @param {String} options.host - Retreaver API Host
41
+ * @param {String} options.prefix - http or https
42
+ * @example
43
+ * Retreaver.configure({host: 'api.rtvrapi.com', prefix: 'https'});
44
+ *
45
+ */
46
+ configure: function (options) {
47
+ var params = {
48
+ addr: options.host,
49
+ http_prefix: 'http',
50
+ urlregex: "/\\/\\/[^\\/]*\\/(.*)/"
51
+ };
52
+ // check for http prefix
53
+ if (typeof(options.prefix) !== 'undefined') {
54
+ params.http_prefix = options.prefix;
55
+ }
56
+ window.Retreaver._connection = new Retreaver.Base.Request(params);
57
+ }
58
+ };
59
+ context.Retreaver = Retreaver;
60
+
61
+ })(window);
62
+ </code></pre>
63
+ </article>
64
+ </section>
65
+
66
+
67
+
68
+
69
+ </div>
70
+
71
+ <nav>
72
+ <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>
73
+ </nav>
74
+
75
+ <br clear="both">
76
+
77
+ <footer>
78
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jun 17 2024 14:31:16 GMT+0300 (EEST)
79
+ </footer>
80
+
81
+ <script> prettyPrint(); </script>
82
+ <script src="scripts/linenumber.js"> </script>
83
+ </body>
84
+ </html>
@@ -0,0 +1,17 @@
1
+ (function() {
2
+ var counter = 0;
3
+ var numbered;
4
+ var source = document.getElementsByClassName('prettyprint source');
5
+
6
+ if (source && source[0]) {
7
+ source = source[0].getElementsByTagName('code')[0];
8
+
9
+ numbered = source.innerHTML.split('\n');
10
+ numbered = numbered.map(function(item) {
11
+ counter++;
12
+ return '<span id="line' + counter + '" class="line"></span>' + item;
13
+ });
14
+
15
+ source.innerHTML = numbered.join('\n');
16
+ }
17
+ })();