Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
jio
Commits
ff174e12
Commit
ff174e12
authored
Oct 24, 2017
by
Aurélien Vermylen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stuff for device syncing.
parent
46b74188
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
16 deletions
+40
-16
dist/jio-v3.23.1.js
dist/jio-v3.23.1.js
+19
-7
dist/jio-v3.23.1.min.js
dist/jio-v3.23.1.min.js
+2
-2
src/jio.storage/automaticapistorage.js
src/jio.storage/automaticapistorage.js
+19
-7
No files found.
dist/jio-v3.23.1.js
View file @
ff174e12
...
@@ -14459,15 +14459,13 @@ return new Parser;
...
@@ -14459,15 +14459,13 @@ return new Parser;
AUTOMATIC_BASE_DOMAIN
=
'
api.automatic.com
'
,
AUTOMATIC_BASE_DOMAIN
=
'
api.automatic.com
'
,
AUTOMATIC_BASE_URI
=
AUTOMATIC_BASE_PROTOCOL
+
'
://
'
AUTOMATIC_BASE_URI
=
AUTOMATIC_BASE_PROTOCOL
+
'
://
'
+
AUTOMATIC_BASE_DOMAIN
,
+
AUTOMATIC_BASE_DOMAIN
,
/*AUTOMATIC_VALID_ENDPOINTS = ['/trip/', '/trip/{id}/', '/user/',
'/user/{id}/', '/user/{user_id}/device/',
'/user/{user_id}/device/{device_id}/', '/vehicle/{id}/', '/vehicle/',
'/vehicle/{vehicle_id}/mil/'],*/
AUTOMATIC_VALID_ENDPOINT_REGEXES
=
[
/^
\/
trip
(\/
T_
\w
*|
)\/
$/
,
AUTOMATIC_VALID_ENDPOINT_REGEXES
=
[
/^
\/
trip
(\/
T_
\w
*|
)\/
$/
,
/^
\/
user
\/
me
(\/
device
(\/\w
*|
)
|
)\/
$/
,
/^
\/
user
\/
me
(\/
device
(\/\w
*|
)
|
)\/
$/
,
/^
\/
user
\/
U_
\w
*
(\/
device
(\/\w
*|
)
|
)\/
$/
,
/^
\/
vehicle
(\/
C_
\w
*
(\/
mil|
)
|
)\/
$/
],
/^
\/
vehicle
(\/
C_
\w
*
(\/
mil|
)
|
)\/
$/
],
AUTOMATIC_VALID_ENDPOINTID_REGEXES
=
[
/^
\/
trip
\/
T_
\w
*
\/
$/
,
AUTOMATIC_VALID_ENDPOINTID_REGEXES
=
[
/^
\/
trip
\/
T_
\w
*
\/
$/
,
/^
\/
user
\/
me
\/
device
\/\w
*
\/
$/
,
/^
\/
user
\/
me
\/
device
\/\w
*
\/
$/
,
/^
\/
user
\/
U_
\w
*
\/
device
\/\w
*
\/
$/
,
/^
\/
vehicle
\/
C_
\w
*
\/
$/
],
/^
\/
vehicle
\/
C_
\w
*
\/
$/
],
automatic_template
=
UriTemplate
.
parse
(
AUTOMATIC_BASE_URI
+
automatic_template
=
UriTemplate
.
parse
(
AUTOMATIC_BASE_URI
+
'
{/endpoint*}
'
);
'
{/endpoint*}
'
);
...
@@ -14509,6 +14507,11 @@ return new Parser;
...
@@ -14509,6 +14507,11 @@ return new Parser;
throw
new
jIO
.
util
.
jIOError
(
'
Wrong Automatic API query. (usually
'
+
throw
new
jIO
.
util
.
jIOError
(
'
Wrong Automatic API query. (usually
'
+
'
caused by wrong "id" or "type")
'
,
400
);
'
caused by wrong "id" or "type")
'
,
400
);
}
}
// Handle /user/me/device/ endpoint, which would be put as user, but
// is actually a device query.
if
(
endpoint
===
'
/user/me/device/
'
)
{
type
=
'
device
'
;
}
// Promise chain to handle multi-part response ("_metadata"->"next" parts).
// Promise chain to handle multi-part response ("_metadata"->"next" parts).
function
treatNext
(
returned
)
{
function
treatNext
(
returned
)
{
var
data
,
var
data
,
...
@@ -14584,8 +14587,14 @@ return new Parser;
...
@@ -14584,8 +14587,14 @@ return new Parser;
//'xhrFields': {withCredentials: true}
//'xhrFields': {withCredentials: true}
});
});
}).
push
(
function
(
respdev
)
{
}).
push
(
function
(
respdev
)
{
device_dict
[
token
]
=
var
temp
=
JSON
.
parse
(
respdev
.
target
.
responseText
);
JSON
.
parse
(
respdev
.
target
.
responseText
).
results
[
0
].
id
;
if
(
temp
.
results
.
length
===
0
)
{
return
new
jIO
.
util
.
jIOError
(
'
No device associated to this account yet.
'
,
200
);
}
device_dict
[
token
]
=
temp
.
results
[
0
].
id
;
if
(
dev
===
'
all
'
||
dev
===
device_dict
[
token
])
{
if
(
dev
===
'
all
'
||
dev
===
device_dict
[
token
])
{
return
jIO
.
util
.
ajax
({
return
jIO
.
util
.
ajax
({
'
type
'
:
'
GET
'
,
'
type
'
:
'
GET
'
,
...
@@ -14795,7 +14804,7 @@ return new Parser;
...
@@ -14795,7 +14804,7 @@ return new Parser;
key_list
,
key_list
,
automatic_filters
=
{},
automatic_filters
=
{},
simplequery_type_value
,
simplequery_type_value
,
intercept_keys
=
[
'
start_date
'
,
'
stop_date
'
,
'
automatic_
device
'
,
intercept_keys
=
[
'
start_date
'
,
'
stop_date
'
,
'
device
'
,
'
vehicle
'
],
'
vehicle
'
],
intercept_keys_automatic_name
=
[
'
started_at
'
,
'
ended_at
'
,
'
device
'
,
intercept_keys_automatic_name
=
[
'
started_at
'
,
'
ended_at
'
,
'
device
'
,
'
vehicle
'
],
'
vehicle
'
],
...
@@ -14882,6 +14891,9 @@ return new Parser;
...
@@ -14882,6 +14891,9 @@ return new Parser;
'
contain "type" constraint with "=" operator.
'
,
400
);
'
contain "type" constraint with "=" operator.
'
,
400
);
}
}
automatic_endpoint
=
'
/
'
+
simplequery_type_value
[
0
][
1
]
+
'
/
'
;
automatic_endpoint
=
'
/
'
+
simplequery_type_value
[
0
][
1
]
+
'
/
'
;
if
(
automatic_endpoint
===
'
/device/
'
)
{
automatic_endpoint
=
'
/user/me/device/
'
;
}
return
_queryAutomaticAPI
(
automatic_endpoint
,
automatic_filters
,
this
)
return
_queryAutomaticAPI
(
automatic_endpoint
,
automatic_filters
,
this
)
.
push
(
function
(
results
)
{
.
push
(
function
(
results
)
{
if
(
!
(
results
instanceof
Array
))
{
if
(
!
(
results
instanceof
Array
))
{
...
...
dist/jio-v3.23.1.min.js
View file @
ff174e12
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/jio.storage/automaticapistorage.js
View file @
ff174e12
...
@@ -17,15 +17,13 @@
...
@@ -17,15 +17,13 @@
AUTOMATIC_BASE_DOMAIN
=
'
api.automatic.com
'
,
AUTOMATIC_BASE_DOMAIN
=
'
api.automatic.com
'
,
AUTOMATIC_BASE_URI
=
AUTOMATIC_BASE_PROTOCOL
+
'
://
'
AUTOMATIC_BASE_URI
=
AUTOMATIC_BASE_PROTOCOL
+
'
://
'
+
AUTOMATIC_BASE_DOMAIN
,
+
AUTOMATIC_BASE_DOMAIN
,
/*AUTOMATIC_VALID_ENDPOINTS = ['/trip/', '/trip/{id}/', '/user/',
'/user/{id}/', '/user/{user_id}/device/',
'/user/{user_id}/device/{device_id}/', '/vehicle/{id}/', '/vehicle/',
'/vehicle/{vehicle_id}/mil/'],*/
AUTOMATIC_VALID_ENDPOINT_REGEXES
=
[
/^
\/
trip
(\/
T_
\w
*|
)\/
$/
,
AUTOMATIC_VALID_ENDPOINT_REGEXES
=
[
/^
\/
trip
(\/
T_
\w
*|
)\/
$/
,
/^
\/
user
\/
me
(\/
device
(\/\w
*|
)
|
)\/
$/
,
/^
\/
user
\/
me
(\/
device
(\/\w
*|
)
|
)\/
$/
,
/^
\/
user
\/
U_
\w
*
(\/
device
(\/\w
*|
)
|
)\/
$/
,
/^
\/
vehicle
(\/
C_
\w
*
(\/
mil|
)
|
)\/
$/
],
/^
\/
vehicle
(\/
C_
\w
*
(\/
mil|
)
|
)\/
$/
],
AUTOMATIC_VALID_ENDPOINTID_REGEXES
=
[
/^
\/
trip
\/
T_
\w
*
\/
$/
,
AUTOMATIC_VALID_ENDPOINTID_REGEXES
=
[
/^
\/
trip
\/
T_
\w
*
\/
$/
,
/^
\/
user
\/
me
\/
device
\/\w
*
\/
$/
,
/^
\/
user
\/
me
\/
device
\/\w
*
\/
$/
,
/^
\/
user
\/
U_
\w
*
\/
device
\/\w
*
\/
$/
,
/^
\/
vehicle
\/
C_
\w
*
\/
$/
],
/^
\/
vehicle
\/
C_
\w
*
\/
$/
],
automatic_template
=
UriTemplate
.
parse
(
AUTOMATIC_BASE_URI
+
automatic_template
=
UriTemplate
.
parse
(
AUTOMATIC_BASE_URI
+
'
{/endpoint*}
'
);
'
{/endpoint*}
'
);
...
@@ -67,6 +65,11 @@
...
@@ -67,6 +65,11 @@
throw
new
jIO
.
util
.
jIOError
(
'
Wrong Automatic API query. (usually
'
+
throw
new
jIO
.
util
.
jIOError
(
'
Wrong Automatic API query. (usually
'
+
'
caused by wrong "id" or "type")
'
,
400
);
'
caused by wrong "id" or "type")
'
,
400
);
}
}
// Handle /user/me/device/ endpoint, which would be put as user, but
// is actually a device query.
if
(
endpoint
===
'
/user/me/device/
'
)
{
type
=
'
device
'
;
}
// Promise chain to handle multi-part response ("_metadata"->"next" parts).
// Promise chain to handle multi-part response ("_metadata"->"next" parts).
function
treatNext
(
returned
)
{
function
treatNext
(
returned
)
{
var
data
,
var
data
,
...
@@ -142,8 +145,14 @@
...
@@ -142,8 +145,14 @@
//'xhrFields': {withCredentials: true}
//'xhrFields': {withCredentials: true}
});
});
}).
push
(
function
(
respdev
)
{
}).
push
(
function
(
respdev
)
{
device_dict
[
token
]
=
var
temp
=
JSON
.
parse
(
respdev
.
target
.
responseText
);
JSON
.
parse
(
respdev
.
target
.
responseText
).
results
[
0
].
id
;
if
(
temp
.
results
.
length
===
0
)
{
return
new
jIO
.
util
.
jIOError
(
'
No device associated to this account yet.
'
,
200
);
}
device_dict
[
token
]
=
temp
.
results
[
0
].
id
;
if
(
dev
===
'
all
'
||
dev
===
device_dict
[
token
])
{
if
(
dev
===
'
all
'
||
dev
===
device_dict
[
token
])
{
return
jIO
.
util
.
ajax
({
return
jIO
.
util
.
ajax
({
'
type
'
:
'
GET
'
,
'
type
'
:
'
GET
'
,
...
@@ -353,7 +362,7 @@
...
@@ -353,7 +362,7 @@
key_list
,
key_list
,
automatic_filters
=
{},
automatic_filters
=
{},
simplequery_type_value
,
simplequery_type_value
,
intercept_keys
=
[
'
start_date
'
,
'
stop_date
'
,
'
automatic_
device
'
,
intercept_keys
=
[
'
start_date
'
,
'
stop_date
'
,
'
device
'
,
'
vehicle
'
],
'
vehicle
'
],
intercept_keys_automatic_name
=
[
'
started_at
'
,
'
ended_at
'
,
'
device
'
,
intercept_keys_automatic_name
=
[
'
started_at
'
,
'
ended_at
'
,
'
device
'
,
'
vehicle
'
],
'
vehicle
'
],
...
@@ -440,6 +449,9 @@
...
@@ -440,6 +449,9 @@
'
contain "type" constraint with "=" operator.
'
,
400
);
'
contain "type" constraint with "=" operator.
'
,
400
);
}
}
automatic_endpoint
=
'
/
'
+
simplequery_type_value
[
0
][
1
]
+
'
/
'
;
automatic_endpoint
=
'
/
'
+
simplequery_type_value
[
0
][
1
]
+
'
/
'
;
if
(
automatic_endpoint
===
'
/device/
'
)
{
automatic_endpoint
=
'
/user/me/device/
'
;
}
return
_queryAutomaticAPI
(
automatic_endpoint
,
automatic_filters
,
this
)
return
_queryAutomaticAPI
(
automatic_endpoint
,
automatic_filters
,
this
)
.
push
(
function
(
results
)
{
.
push
(
function
(
results
)
{
if
(
!
(
results
instanceof
Array
))
{
if
(
!
(
results
instanceof
Array
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment