Bug 1032741 Adapt to latest Loop server changes - update parameter name for /calls_url and add a callType parameter when starting a call. r=nperriault

This commit is contained in:
Mark Banner
2014-07-03 15:15:16 +01:00
parent e6548f6de8
commit 18297209a9
9 changed files with 47 additions and 24 deletions

View File

@@ -9,7 +9,7 @@ loop.Client = (function($) {
"use strict";
// The expected properties to be returned from the POST /call-url/ request.
const expectedCallUrlProperties = ["call_url", "expiresAt"];
const expectedCallUrlProperties = ["callUrl", "expiresAt"];
// The expected properties to be returned from the GET /calls request.
const expectedCallProperties = ["calls"];
@@ -114,6 +114,13 @@ loop.Client = (function($) {
try {
var urlData = JSON.parse(responseText);
// XXX Support an alternate call_url property for
// backwards compatibility whilst we switch over servers.
// Bug 1033988 will want to remove these two lines.
if (urlData.call_url)
urlData.callUrl = urlData.call_url;
cb(null, this._validate(urlData, expectedCallUrlProperties));
var expiresHours = this._hoursToSeconds(urlData.expiresAt);