< Summary

Class:DCL.Builder.BuilderAPIResponseResolver
Assembly:BuilderAPI
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BuiilderAPI/BuilderAPIResponseResolver.cs
Covered lines:0
Uncovered lines:5
Coverable lines:5
Total lines:41
Line coverage:0% (0 of 5)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetArrayFromCall[T](...)0%2100%
GetResponseFromCall(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BuiilderAPI/BuilderAPIResponseResolver.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using Newtonsoft.Json;
 4using Newtonsoft.Json.Linq;
 5using UnityEngine;
 6
 7namespace DCL.Builder
 8{
 9    public interface IBuilderAPIResponseResolver
 10    {
 11        /// <summary>
 12        /// Resolve the data from the call removing de OK response
 13        /// </summary>
 14        /// <param name="result"></param>
 15        /// <returns></returns>
 16        T[] GetArrayFromCall<T>(string result);
 17
 18        /// <summary>
 19        /// Resolve the data from the call removing de OK response
 20        /// </summary>
 21        /// <param name="result"></param>
 22        /// <returns></returns>
 23        APIResponse GetResponseFromCall(string result);
 24    }
 25
 26    public class BuilderAPIResponseResolver: IBuilderAPIResponseResolver
 27    {
 28        public T[] GetArrayFromCall<T>(string result)
 29        {
 030            APIResponse response = GetResponseFromCall(result);
 031            string array = response.GetArrayJsonString();
 032            return JsonConvert.DeserializeObject<T[]>(array);
 33        }
 34
 35        public APIResponse GetResponseFromCall(string result)
 36        {
 037            APIResponse response = JsonConvert.DeserializeObject<APIResponse>(result);
 038            return response;
 39        }
 40    }
 41}