retreaverjs-rails 0.0.12 → 0.1.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.
- checksums.yaml +4 -4
- data/Gruntfile.js +1 -0
- data/config/README +1 -1
- data/config/jsdocs.json +1 -0
- data/lib/retreaverjs/compile.rb +5 -5
- data/lib/retreaverjs/rails/version.rb +1 -1
- data/src/retreaver/base/model.js +1 -1
- data/src/retreaver/campaign.js +1 -1
- data/src/retreaver.js +28 -0
- data/vendor/assets/javascripts/retreaver.js +1179 -0
- data/vendor/assets/javascripts/retreaver.min.js +2 -0
- data/vendor/documentation/javascript/v1/Retreaver.Campaign.html +425 -0
- data/vendor/documentation/javascript/v1/Retreaver.Number.html +1415 -0
- data/vendor/documentation/javascript/v1/Retreaver.Retreaver.html +146 -0
- data/vendor/documentation/javascript/v1/Retreaver.context.Retreaver.html +146 -0
- data/vendor/documentation/javascript/v1/Retreaver.html +304 -0
- data/vendor/documentation/javascript/v1/campaign.js.html +157 -0
- data/vendor/documentation/javascript/v1/global.html +232 -0
- data/vendor/documentation/javascript/v1/index.html +67 -0
- data/vendor/documentation/javascript/v1/number.js.html +255 -0
- data/vendor/documentation/javascript/v1/retreaver.js.html +78 -0
- data/vendor/documentation/javascript/v1/scripts/linenumber.js +17 -0
- data/vendor/documentation/javascript/v1/scripts/prettify/Apache-License-2.0.txt +202 -0
- data/vendor/documentation/javascript/v1/scripts/prettify/lang-css.js +2 -0
- data/vendor/documentation/javascript/v1/scripts/prettify/prettify.js +28 -0
- data/vendor/documentation/javascript/v1/styles/jsdoc-default.css +290 -0
- data/vendor/documentation/javascript/v1/styles/prettify-jsdoc.css +111 -0
- data/vendor/documentation/javascript/v1/styles/prettify-tomorrow.css +132 -0
- metadata +22 -2
@@ -0,0 +1,157 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>JSDoc: Source: retreaver/campaign.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/campaign.js</h1>
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<section>
|
27
|
+
<article>
|
28
|
+
<pre class="prettyprint source"><code>(function () {
|
29
|
+
// Dependencies
|
30
|
+
var RequestNumber = Retreaver.Base.RequestNumber;
|
31
|
+
/**
|
32
|
+
* @constructor
|
33
|
+
* @memberOf Retreaver
|
34
|
+
* @param {Object} options
|
35
|
+
* @param {String} options.campaign_key - Campaign key
|
36
|
+
* @example
|
37
|
+
* var campaign = new Retreaver.Campaign({ campaign_key: '67d9fb1917ae8f4eaff36831b41788c3' });
|
38
|
+
*/
|
39
|
+
var Campaign = function (options) {
|
40
|
+
|
41
|
+
function initialize(data) {
|
42
|
+
// initialize data store
|
43
|
+
self.store(data);
|
44
|
+
}
|
45
|
+
|
46
|
+
var self = this;
|
47
|
+
self.type = 'campaigns';
|
48
|
+
self.primary_key('campaign_key');
|
49
|
+
self.numbers = [];
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Fetch a campaign number.
|
53
|
+
* @memberOf Retreaver.Campaign
|
54
|
+
* @function request_number
|
55
|
+
* @instance
|
56
|
+
* @param {Object} tags - A collection of tags as key-value pairs. The number returned will match these tags.
|
57
|
+
* @param {getNumberCallback} callback - Callback fired if the request completes successfully.
|
58
|
+
* @param {Function} error_callback - Callback fired if the request raises an error.
|
59
|
+
* @example
|
60
|
+
* campaign.request_number({calling_about: 'support'}, function (number) {
|
61
|
+
* alert(number.get('number'))
|
62
|
+
* }, function(response){
|
63
|
+
* alert('something went wrong: ' + response);
|
64
|
+
* };
|
65
|
+
*/
|
66
|
+
self.request_number = function (tags, callback, error_callback) {
|
67
|
+
// if the first argument is a function, the user has decided to skip passing tags
|
68
|
+
// therefore cascade the arguments upwards so that everything works as expected
|
69
|
+
if (typeof(tags) === 'function') {
|
70
|
+
// argument 3 becomes argument 2
|
71
|
+
error_callback = callback;
|
72
|
+
// argument 2 becomes argument 1
|
73
|
+
callback = tags;
|
74
|
+
// argument 1 becomes an empty tags object
|
75
|
+
tags = {};
|
76
|
+
}
|
77
|
+
// assign the tags (this is important since it runs it through set_number_matching_tags)
|
78
|
+
self.set('number_matching_tags', tags);
|
79
|
+
// request the number
|
80
|
+
new RequestNumber(self.get('campaign_key', 'number_matching_tags')).perform(function (data) {
|
81
|
+
// did retreaver return a valid number?
|
82
|
+
if (typeof(data) !== 'undefined' && typeof(data.number) !== 'undefined' && data.number !== '') {
|
83
|
+
// initialize number
|
84
|
+
var number = new Retreaver.Number(data.number);
|
85
|
+
// call callback
|
86
|
+
callback.apply(self, [number]);
|
87
|
+
}
|
88
|
+
// otherwise fire the error callback
|
89
|
+
else if (typeof(error_callback) === 'function') {
|
90
|
+
error_callback.apply(self, [data]);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
};
|
94
|
+
/**
|
95
|
+
* Retreaver.Campaign#request_number callback fired after the request completes.
|
96
|
+
* @callback getNumberCallback
|
97
|
+
* @param {Retreaver.Number} - The number that was returned
|
98
|
+
*/
|
99
|
+
|
100
|
+
self.numbers = function () {
|
101
|
+
var output = [];
|
102
|
+
if (typeof(Retreaver.Base.Data._store) !== 'undefined') {
|
103
|
+
// get numbers
|
104
|
+
var numbers = Retreaver.Base.Data._store['numbers'];
|
105
|
+
// present?
|
106
|
+
if (typeof(numbers) !== 'undefined') {
|
107
|
+
// collect numbers matching this campaign
|
108
|
+
for (var primary_key in numbers) {
|
109
|
+
var number = numbers[primary_key];
|
110
|
+
if (self.get('campaign_key') == number.campaign_key) {
|
111
|
+
output.push(new Retreaver.Number(number));
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
return output;
|
117
|
+
};
|
118
|
+
|
119
|
+
self.set_number_matching_tags = function (tags) {
|
120
|
+
if (typeof(tags) === 'string') {
|
121
|
+
tags = Retreaver.Number.extract_tags_from_string(tags);
|
122
|
+
}
|
123
|
+
if (tags && (typeof tags === "object") && !(tags instanceof Array)) {
|
124
|
+
return tags
|
125
|
+
}
|
126
|
+
else {
|
127
|
+
throw "ArgumentError: Expected number_matching_tags to be an object. eg: {tag: 'value'}";
|
128
|
+
}
|
129
|
+
};
|
130
|
+
|
131
|
+
initialize(options);
|
132
|
+
};
|
133
|
+
Campaign.prototype = new Retreaver.Base.Model();
|
134
|
+
Retreaver.Campaign = Campaign;
|
135
|
+
})();</code></pre>
|
136
|
+
</article>
|
137
|
+
</section>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<nav>
|
145
|
+
<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>
|
146
|
+
</nav>
|
147
|
+
|
148
|
+
<br clear="both">
|
149
|
+
|
150
|
+
<footer>
|
151
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Sat Jul 25 2015 14:52:26 GMT-0400 (EDT)
|
152
|
+
</footer>
|
153
|
+
|
154
|
+
<script> prettyPrint(); </script>
|
155
|
+
<script src="scripts/linenumber.js"> </script>
|
156
|
+
</body>
|
157
|
+
</html>
|
@@ -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#line67">line 67</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 Sat Jul 25 2015 14:52:26 GMT-0400 (EDT)
|
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 Sat Jul 25 2015 14:52:26 GMT-0400 (EDT)
|
62
|
+
</footer>
|
63
|
+
|
64
|
+
<script> prettyPrint(); </script>
|
65
|
+
<script src="scripts/linenumber.js"> </script>
|
66
|
+
</body>
|
67
|
+
</html>
|