1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 const config = require('../config/default.json');
\r
18 const btoa = require('btoa');
\r
20 module.exports.parser = function (response) {
\r
26 if (response.result) {
\r
27 // loop through musics rusults and make it into an array
\r
28 for (var key in response.result) {
\r
29 if (response.result.hasOwnProperty(key)) {
\r
30 jsonObject.data.push(response.result[key]);
\r
35 // set store status in new reponse
\r
36 jsonObject.status = response.status;
\r
41 module.exports.stringifyParams = function (params) {
\r
45 for (var key in params.query) {
\r
46 if (params.query.hasOwnProperty(key) && key[0] != '$') {
\r
50 string += key + '=' + params.query[key];
\r
58 module.exports.musicHeaders = {
\r
59 'Content-Type': 'application/json',
\r
60 'ns': config.music.ns,
\r
61 'X-minorVersion': config.music['X-minorVersion'],
\r
62 'X-patchVersion': config.music['X-patchVersion'],
\r
63 'Authorization': 'Basic ' + btoa(config.music.username + ':' + config.music.password)
\r
66 module.exports.musicUrl = config.music.url;
\r