ahoy_matey 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +29 -17
- data/app/controllers/ahoy/base_controller.rb +9 -2
- data/app/controllers/ahoy/visits_controller.rb +1 -0
- data/app/jobs/ahoy/geocode_v2_job.rb +1 -1
- data/docs/Ahoy-2-Upgrade.md +2 -0
- data/lib/ahoy/base_store.rb +4 -0
- data/lib/ahoy/controller.rb +1 -1
- data/lib/ahoy/database_store.rb +23 -12
- data/lib/ahoy/model.rb +1 -1
- data/lib/ahoy/tracker.rb +14 -4
- data/lib/ahoy/version.rb +1 -1
- data/vendor/assets/javascripts/ahoy.js +145 -117
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 640c91af9741127b748f530d102751a73f71b4c9
|
4
|
+
data.tar.gz: b341bf79dc207745b63f7a419711d402f2fc8cc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f154fb9aefbee54089fc9c6e269c26e7f09eb4229c211ccd073d9d8a25fb191c875155a687e358966ff20b9dc3c39bf00e1a6701eda787ed212a800e594408c
|
7
|
+
data.tar.gz: ddac0a216a109b50904be1a2553cfa48df607908dacb50a3329f88bf8a7025faaa86df4e067247390dac8c2dbccc2d520fcabe50e072fe4240111682ffb46b5e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -79,10 +79,10 @@ skip_before_action :track_ahoy_visit
|
|
79
79
|
|
80
80
|
This is typically useful for APIs.
|
81
81
|
|
82
|
-
You can also defer visit tracking to JavaScript (
|
82
|
+
You can also defer visit tracking to JavaScript. This is useful for preventing bots (that aren’t detected by their user agent) and users with cookies disabled from creating a new visit on each request. `:when_needed` will create visits server-side when needed by events, and `false` will discard events without a visit.
|
83
83
|
|
84
84
|
```ruby
|
85
|
-
Ahoy.server_side_visits =
|
85
|
+
Ahoy.server_side_visits = :when_needed
|
86
86
|
```
|
87
87
|
|
88
88
|
### Events
|
@@ -131,19 +131,7 @@ See the [API spec](#api-spec).
|
|
131
131
|
|
132
132
|
### Associated Models
|
133
133
|
|
134
|
-
Say we want to associate orders with visits.
|
135
|
-
|
136
|
-
First, generate a migration and add a `visit_id` column (not needed for Mongoid).
|
137
|
-
|
138
|
-
```ruby
|
139
|
-
class AddVisitIdToOrders < ActiveRecord::Migration[5.1]
|
140
|
-
def change
|
141
|
-
add_column :orders, :visit_id, :bigint
|
142
|
-
end
|
143
|
-
end
|
144
|
-
```
|
145
|
-
|
146
|
-
Then, add `visitable` to the model.
|
134
|
+
Say we want to associate orders with visits. Just add `visitable` to the model.
|
147
135
|
|
148
136
|
```ruby
|
149
137
|
class Order < ApplicationRecord
|
@@ -161,6 +149,16 @@ Order.joins(:visit).group("city").count
|
|
161
149
|
Order.joins(:visit).group("device_type").count
|
162
150
|
```
|
163
151
|
|
152
|
+
Here’s what the migration to add the `visit_id` column should look like:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
class AddVisitIdToOrders < ActiveRecord::Migration[5.1]
|
156
|
+
def change
|
157
|
+
add_column :orders, :visit_id, :bigint
|
158
|
+
end
|
159
|
+
end
|
160
|
+
```
|
161
|
+
|
164
162
|
Customize the column and class name with:
|
165
163
|
|
166
164
|
```ruby
|
@@ -205,7 +203,7 @@ or use a proc
|
|
205
203
|
Ahoy.user_method = ->(controller) { controller.true_user }
|
206
204
|
```
|
207
205
|
|
208
|
-
|
206
|
+
#### Doorkeeper
|
209
207
|
|
210
208
|
To attach the user with [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper), be sure you have a `current_resource_owner` method in `ApplicationController`.
|
211
209
|
|
@@ -221,7 +219,7 @@ end
|
|
221
219
|
|
222
220
|
### Exclusions
|
223
221
|
|
224
|
-
Bots are excluded from tracking by default. To
|
222
|
+
Bots are excluded from tracking by default. To include them, use:
|
225
223
|
|
226
224
|
```ruby
|
227
225
|
Ahoy.track_bots = true
|
@@ -474,6 +472,20 @@ Send a `POST` request to `/ahoy/events` with `Content-Type: application/json` an
|
|
474
472
|
}
|
475
473
|
```
|
476
474
|
|
475
|
+
## Webpacker
|
476
|
+
|
477
|
+
For Webpacker, use Yarn to install the JavaScript library:
|
478
|
+
|
479
|
+
```sh
|
480
|
+
yarn add ahoy.js
|
481
|
+
```
|
482
|
+
|
483
|
+
Then include it in your pack.
|
484
|
+
|
485
|
+
```es6
|
486
|
+
import ahoy from "ahoy.js";
|
487
|
+
```
|
488
|
+
|
477
489
|
## History
|
478
490
|
|
479
491
|
View the [changelog](https://github.com/ankane/ahoy/blob/master/CHANGELOG.md)
|
@@ -5,11 +5,11 @@ module Ahoy
|
|
5
5
|
skip_before_action(*filters, raise: false)
|
6
6
|
skip_after_action(*filters, raise: false)
|
7
7
|
skip_around_action(*filters, raise: false)
|
8
|
-
before_action :verify_request_size
|
9
8
|
else
|
10
9
|
skip_action_callback *filters
|
11
|
-
before_action :verify_request_size
|
12
10
|
end
|
11
|
+
before_action :verify_request_size
|
12
|
+
before_action :renew_cookies
|
13
13
|
|
14
14
|
if respond_to?(:protect_from_forgery)
|
15
15
|
protect_from_forgery with: :null_session, if: -> { Ahoy.protect_from_forgery }
|
@@ -21,6 +21,13 @@ module Ahoy
|
|
21
21
|
@ahoy ||= Ahoy::Tracker.new(controller: self, api: true)
|
22
22
|
end
|
23
23
|
|
24
|
+
# set proper ttl if cookie generated from JavaScript
|
25
|
+
# approach is not perfect, as user must reload the page
|
26
|
+
# for new cookie settings to take effect
|
27
|
+
def renew_cookies
|
28
|
+
set_ahoy_cookies if params[:js] && !Ahoy.api_only
|
29
|
+
end
|
30
|
+
|
24
31
|
def verify_request_size
|
25
32
|
if request.content_length > Ahoy.max_content_length
|
26
33
|
logger.info "[ahoy] Payload too large"
|
data/docs/Ahoy-2-Upgrade.md
CHANGED
@@ -27,6 +27,8 @@ Ahoy.api = true
|
|
27
27
|
Ahoy.server_side_visits = false
|
28
28
|
```
|
29
29
|
|
30
|
+
You can also try the new `Ahoy.server_side_visits = :when_needed` to automatically create visits server-side when needed for events and `visitable`.
|
31
|
+
|
30
32
|
If you use `visitable`, add `class_name` to each instance:
|
31
33
|
|
32
34
|
```ruby
|
data/lib/ahoy/base_store.rb
CHANGED
data/lib/ahoy/controller.rb
CHANGED
data/lib/ahoy/database_store.rb
CHANGED
@@ -4,19 +4,21 @@ module Ahoy
|
|
4
4
|
@visit = visit_model.create!(slice_data(visit_model, data))
|
5
5
|
rescue => e
|
6
6
|
raise e unless unique_exception?(e)
|
7
|
-
|
7
|
+
remove_instance_variable(:@visit)
|
8
8
|
end
|
9
9
|
|
10
10
|
def track_event(data)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
visit = visit_or_create
|
12
|
+
if visit
|
13
|
+
event = event_model.new(slice_data(event_model, data))
|
14
|
+
event.visit = visit
|
15
|
+
begin
|
16
|
+
event.save!
|
17
|
+
rescue => e
|
18
|
+
raise e unless unique_exception?(e)
|
19
|
+
end
|
20
|
+
else
|
21
|
+
Rails.logger.warn "[ahoy] Event excluded since visit not created: #{data[:visit_token]}"
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
@@ -28,7 +30,7 @@ module Ahoy
|
|
28
30
|
elsif visit
|
29
31
|
visit.update_attributes(data)
|
30
32
|
else
|
31
|
-
|
33
|
+
Rails.logger.warn "[ahoy] Visit for geocode not found: #{data[:visit_token]}"
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
@@ -44,7 +46,16 @@ module Ahoy
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def visit
|
47
|
-
@visit
|
49
|
+
unless defined?(@visit)
|
50
|
+
@visit = visit_model.where(visit_token: ahoy.visit_token).first if ahoy.visit_token
|
51
|
+
end
|
52
|
+
@visit
|
53
|
+
end
|
54
|
+
|
55
|
+
# if we don't have a visit, let's try to create one first
|
56
|
+
def visit_or_create
|
57
|
+
ahoy.track_visit if !visit && Ahoy.server_side_visits
|
58
|
+
visit
|
48
59
|
end
|
49
60
|
|
50
61
|
protected
|
data/lib/ahoy/model.rb
CHANGED
data/lib/ahoy/tracker.rb
CHANGED
@@ -42,6 +42,8 @@ module Ahoy
|
|
42
42
|
if defer
|
43
43
|
set_cookie("ahoy_track", true, nil, false)
|
44
44
|
else
|
45
|
+
delete_cookie("ahoy_track")
|
46
|
+
|
45
47
|
data = {
|
46
48
|
visit_token: visit_token,
|
47
49
|
visitor_token: visitor_token,
|
@@ -91,6 +93,10 @@ module Ahoy
|
|
91
93
|
@visit ||= @store.visit
|
92
94
|
end
|
93
95
|
|
96
|
+
def visit_or_create
|
97
|
+
@visit ||= @store.visit_or_create
|
98
|
+
end
|
99
|
+
|
94
100
|
def new_visit?
|
95
101
|
!existing_visit_token
|
96
102
|
end
|
@@ -130,13 +136,13 @@ module Ahoy
|
|
130
136
|
|
131
137
|
def reset
|
132
138
|
reset_visit
|
133
|
-
|
139
|
+
delete_cookie("ahoy_visitor")
|
134
140
|
end
|
135
141
|
|
136
142
|
def reset_visit
|
137
|
-
|
138
|
-
|
139
|
-
|
143
|
+
delete_cookie("ahoy_visit")
|
144
|
+
delete_cookie("ahoy_events")
|
145
|
+
delete_cookie("ahoy_track")
|
140
146
|
end
|
141
147
|
|
142
148
|
protected
|
@@ -163,6 +169,10 @@ module Ahoy
|
|
163
169
|
request.cookie_jar[name] = cookie
|
164
170
|
end
|
165
171
|
|
172
|
+
def delete_cookie(name)
|
173
|
+
request.cookie_jar.delete(name)
|
174
|
+
end
|
175
|
+
|
166
176
|
def trusted_time(time = nil)
|
167
177
|
if !time || (api? && !(1.minute.ago..Time.now).cover?(time))
|
168
178
|
Time.zone.now
|
data/lib/ahoy/version.rb
CHANGED
@@ -1,76 +1,76 @@
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
+
module.exports = factory();
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
5
|
+
define([], factory);
|
6
|
+
else if(typeof exports === 'object')
|
7
|
+
exports["ahoy"] = factory();
|
8
|
+
else
|
9
|
+
root["ahoy"] = factory();
|
10
10
|
})(typeof self !== 'undefined' ? self : this, function() {
|
11
11
|
return /******/ (function(modules) { // webpackBootstrap
|
12
|
-
/******/
|
13
|
-
/******/
|
12
|
+
/******/ // The module cache
|
13
|
+
/******/ var installedModules = {};
|
14
14
|
/******/
|
15
|
-
/******/
|
16
|
-
/******/
|
15
|
+
/******/ // The require function
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
17
17
|
/******/
|
18
|
-
/******/
|
19
|
-
/******/
|
20
|
-
/******/
|
21
|
-
/******/
|
22
|
-
/******/
|
23
|
-
/******/
|
24
|
-
/******/
|
25
|
-
/******/
|
26
|
-
/******/
|
27
|
-
/******/
|
18
|
+
/******/ // Check if module is in cache
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
21
|
+
/******/ }
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
24
|
+
/******/ i: moduleId,
|
25
|
+
/******/ l: false,
|
26
|
+
/******/ exports: {}
|
27
|
+
/******/ };
|
28
28
|
/******/
|
29
|
-
/******/
|
30
|
-
/******/
|
29
|
+
/******/ // Execute the module function
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31
31
|
/******/
|
32
|
-
/******/
|
33
|
-
/******/
|
32
|
+
/******/ // Flag the module as loaded
|
33
|
+
/******/ module.l = true;
|
34
34
|
/******/
|
35
|
-
/******/
|
36
|
-
/******/
|
37
|
-
/******/
|
35
|
+
/******/ // Return the exports of the module
|
36
|
+
/******/ return module.exports;
|
37
|
+
/******/ }
|
38
38
|
/******/
|
39
39
|
/******/
|
40
|
-
/******/
|
41
|
-
/******/
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
41
|
+
/******/ __webpack_require__.m = modules;
|
42
42
|
/******/
|
43
|
-
/******/
|
44
|
-
/******/
|
43
|
+
/******/ // expose the module cache
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
45
45
|
/******/
|
46
|
-
/******/
|
47
|
-
/******/
|
48
|
-
/******/
|
49
|
-
/******/
|
50
|
-
/******/
|
51
|
-
/******/
|
52
|
-
/******/
|
53
|
-
/******/
|
54
|
-
/******/
|
55
|
-
/******/
|
46
|
+
/******/ // define getter function for harmony exports
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
49
|
+
/******/ Object.defineProperty(exports, name, {
|
50
|
+
/******/ configurable: false,
|
51
|
+
/******/ enumerable: true,
|
52
|
+
/******/ get: getter
|
53
|
+
/******/ });
|
54
|
+
/******/ }
|
55
|
+
/******/ };
|
56
56
|
/******/
|
57
|
-
/******/
|
58
|
-
/******/
|
59
|
-
/******/
|
60
|
-
/******/
|
61
|
-
/******/
|
62
|
-
/******/
|
63
|
-
/******/
|
64
|
-
/******/
|
57
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
58
|
+
/******/ __webpack_require__.n = function(module) {
|
59
|
+
/******/ var getter = module && module.__esModule ?
|
60
|
+
/******/ function getDefault() { return module['default']; } :
|
61
|
+
/******/ function getModuleExports() { return module; };
|
62
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
63
|
+
/******/ return getter;
|
64
|
+
/******/ };
|
65
65
|
/******/
|
66
|
-
/******/
|
67
|
-
/******/
|
66
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
67
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
68
68
|
/******/
|
69
|
-
/******/
|
70
|
-
/******/
|
69
|
+
/******/ // __webpack_public_path__
|
70
|
+
/******/ __webpack_require__.p = "";
|
71
71
|
/******/
|
72
|
-
/******/
|
73
|
-
/******/
|
72
|
+
/******/ // Load entry module and return exports
|
73
|
+
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
74
74
|
/******/ })
|
75
75
|
/************************************************************************/
|
76
76
|
/******/ ([
|
@@ -88,8 +88,20 @@ var _objectToFormdata = __webpack_require__(1);
|
|
88
88
|
|
89
89
|
var _objectToFormdata2 = _interopRequireDefault(_objectToFormdata);
|
90
90
|
|
91
|
+
var _cookies = __webpack_require__(2);
|
92
|
+
|
93
|
+
var _cookies2 = _interopRequireDefault(_cookies);
|
94
|
+
|
91
95
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
92
96
|
|
97
|
+
/*
|
98
|
+
* Ahoy.js
|
99
|
+
* Simple, powerful JavaScript analytics
|
100
|
+
* https://github.com/ankane/ahoy.js
|
101
|
+
* v0.3.0
|
102
|
+
* MIT License
|
103
|
+
*/
|
104
|
+
|
93
105
|
var config = {
|
94
106
|
urlPrefix: "",
|
95
107
|
visitsUrl: "/ahoy/visits",
|
@@ -99,13 +111,7 @@ var config = {
|
|
99
111
|
platform: "Web",
|
100
112
|
useBeacon: true,
|
101
113
|
startOnReady: true
|
102
|
-
};
|
103
|
-
* Ahoy.js
|
104
|
-
* Simple, powerful JavaScript analytics
|
105
|
-
* https://github.com/ankane/ahoy.js
|
106
|
-
* v0.3.0
|
107
|
-
* MIT License
|
108
|
-
*/
|
114
|
+
};
|
109
115
|
|
110
116
|
var ahoy = window.ahoy || window.Ahoy || {};
|
111
117
|
|
@@ -145,41 +151,16 @@ function canTrackNow() {
|
|
145
151
|
|
146
152
|
// cookies
|
147
153
|
|
148
|
-
// http://www.quirksmode.org/js/cookies.html
|
149
154
|
function setCookie(name, value, ttl) {
|
150
|
-
|
151
|
-
var cookieDomain = "";
|
152
|
-
if (ttl) {
|
153
|
-
var date = new Date();
|
154
|
-
date.setTime(date.getTime() + ttl * 60 * 1000);
|
155
|
-
expires = "; expires=" + date.toGMTString();
|
156
|
-
}
|
157
|
-
var domain = config.cookieDomain || config.domain;
|
158
|
-
if (domain) {
|
159
|
-
cookieDomain = "; domain=" + domain;
|
160
|
-
}
|
161
|
-
document.cookie = name + "=" + escape(value) + expires + cookieDomain + "; path=/";
|
155
|
+
_cookies2.default.set(name, value, ttl, config.cookieDomain || config.domain);
|
162
156
|
}
|
163
157
|
|
164
158
|
function getCookie(name) {
|
165
|
-
|
166
|
-
c = void 0;
|
167
|
-
var nameEQ = name + "=";
|
168
|
-
var ca = document.cookie.split(';');
|
169
|
-
for (i = 0; i < ca.length; i++) {
|
170
|
-
c = ca[i];
|
171
|
-
while (c.charAt(0) === ' ') {
|
172
|
-
c = c.substring(1, c.length);
|
173
|
-
}
|
174
|
-
if (c.indexOf(nameEQ) === 0) {
|
175
|
-
return unescape(c.substring(nameEQ.length, c.length));
|
176
|
-
}
|
177
|
-
}
|
178
|
-
return null;
|
159
|
+
return _cookies2.default.get(name);
|
179
160
|
}
|
180
161
|
|
181
162
|
function destroyCookie(name) {
|
182
|
-
|
163
|
+
_cookies2.default.set(name, "", -1);
|
183
164
|
}
|
184
165
|
|
185
166
|
function log(message) {
|
@@ -376,10 +357,6 @@ function createVisit() {
|
|
376
357
|
log("Active visit");
|
377
358
|
setReady();
|
378
359
|
} else {
|
379
|
-
if (track) {
|
380
|
-
destroyCookie("ahoy_track");
|
381
|
-
}
|
382
|
-
|
383
360
|
if (!visitId) {
|
384
361
|
visitId = generateId();
|
385
362
|
setCookie("ahoy_visit", visitId, visitTtl);
|
@@ -400,7 +377,8 @@ function createVisit() {
|
|
400
377
|
platform: config.platform,
|
401
378
|
landing_page: window.location.href,
|
402
379
|
screen_width: window.screen.width,
|
403
|
-
screen_height: window.screen.height
|
380
|
+
screen_height: window.screen.height,
|
381
|
+
js: true
|
404
382
|
};
|
405
383
|
|
406
384
|
// referrer
|
@@ -410,7 +388,11 @@ function createVisit() {
|
|
410
388
|
|
411
389
|
log(data);
|
412
390
|
|
413
|
-
sendRequest(visitsUrl(), data,
|
391
|
+
sendRequest(visitsUrl(), data, function () {
|
392
|
+
// wait until successful to destroy
|
393
|
+
destroyCookie("ahoy_track");
|
394
|
+
setReady();
|
395
|
+
});
|
414
396
|
} else {
|
415
397
|
log("Cookies disabled");
|
416
398
|
setReady();
|
@@ -449,34 +431,36 @@ ahoy.track = function (name, properties) {
|
|
449
431
|
name: name,
|
450
432
|
properties: properties || {},
|
451
433
|
time: new Date().getTime() / 1000.0,
|
452
|
-
id: generateId()
|
434
|
+
id: generateId(),
|
435
|
+
js: true
|
453
436
|
};
|
454
437
|
|
455
|
-
// wait for createVisit to log
|
456
|
-
documentReady(function () {
|
457
|
-
log(event);
|
458
|
-
});
|
459
|
-
|
460
438
|
ready(function () {
|
461
439
|
if (!ahoy.getVisitId()) {
|
462
440
|
createVisit();
|
463
441
|
}
|
464
442
|
|
465
|
-
|
466
|
-
|
443
|
+
ready(function () {
|
444
|
+
log(event);
|
467
445
|
|
468
|
-
|
469
|
-
|
470
|
-
} else {
|
471
|
-
eventQueue.push(event);
|
472
|
-
saveEventQueue();
|
446
|
+
event.visit_token = ahoy.getVisitId();
|
447
|
+
event.visitor_token = ahoy.getVisitorId();
|
473
448
|
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
449
|
+
if (canTrackNow()) {
|
450
|
+
trackEventNow(event);
|
451
|
+
} else {
|
452
|
+
eventQueue.push(event);
|
453
|
+
saveEventQueue();
|
454
|
+
|
455
|
+
// wait in case navigating to reduce duplicate events
|
456
|
+
setTimeout(function () {
|
457
|
+
trackEvent(event);
|
458
|
+
}, 1000);
|
459
|
+
}
|
460
|
+
});
|
479
461
|
});
|
462
|
+
|
463
|
+
return true;
|
480
464
|
};
|
481
465
|
|
482
466
|
ahoy.trackView = function (additionalProperties) {
|
@@ -623,6 +607,50 @@ function objectToFormData (obj, fd, pre) {
|
|
623
607
|
module.exports = objectToFormData
|
624
608
|
|
625
609
|
|
610
|
+
/***/ }),
|
611
|
+
/* 2 */
|
612
|
+
/***/ (function(module, exports, __webpack_require__) {
|
613
|
+
|
614
|
+
"use strict";
|
615
|
+
|
616
|
+
|
617
|
+
Object.defineProperty(exports, "__esModule", {
|
618
|
+
value: true
|
619
|
+
});
|
620
|
+
// http://www.quirksmode.org/js/cookies.html
|
621
|
+
|
622
|
+
exports.default = {
|
623
|
+
set: function set(name, value, ttl, domain) {
|
624
|
+
var expires = "";
|
625
|
+
var cookieDomain = "";
|
626
|
+
if (ttl) {
|
627
|
+
var date = new Date();
|
628
|
+
date.setTime(date.getTime() + ttl * 60 * 1000);
|
629
|
+
expires = "; expires=" + date.toGMTString();
|
630
|
+
}
|
631
|
+
if (domain) {
|
632
|
+
cookieDomain = "; domain=" + domain;
|
633
|
+
}
|
634
|
+
document.cookie = name + "=" + escape(value) + expires + cookieDomain + "; path=/";
|
635
|
+
},
|
636
|
+
get: function get(name) {
|
637
|
+
var i = void 0,
|
638
|
+
c = void 0;
|
639
|
+
var nameEQ = name + "=";
|
640
|
+
var ca = document.cookie.split(';');
|
641
|
+
for (i = 0; i < ca.length; i++) {
|
642
|
+
c = ca[i];
|
643
|
+
while (c.charAt(0) === ' ') {
|
644
|
+
c = c.substring(1, c.length);
|
645
|
+
}
|
646
|
+
if (c.indexOf(nameEQ) === 0) {
|
647
|
+
return unescape(c.substring(nameEQ.length, c.length));
|
648
|
+
}
|
649
|
+
}
|
650
|
+
return null;
|
651
|
+
}
|
652
|
+
};
|
653
|
+
|
626
654
|
/***/ })
|
627
655
|
/******/ ])["default"];
|
628
|
-
});
|
656
|
+
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahoy_matey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|