Create a package service
Create a service to retrieve packages information from the Pypi API.
The service must be responsible for all sort of perks regarding http requests, error handling, data transformation, etc.
API ex:
Observable<Package[]> = PackagesService.get('pelican', 'Django', 'nikola');
Additionally, a helper class should be implemented to transform the data. The list of packages should be transformed in a data structure that simplifies the template iteration over it (ng-for and html tables). The structure can be something like this:
-
IN: a list of objects
Package
; -
OUT: a list of comparisons, in which each comparison is a list of
Package
properties values;
Ex:
let users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
let comparisons = Comparisons.create(users);
// {
// 'user': ['barney', 'fred', 'pebbles'],
// 'active': ['true', 'false', 'false'],
// }