Socket
Book a DemoInstallSign in
Socket

mvplus-network

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvplus-network

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.5.

latest
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

MvplusNetwork

This project was generated with Angular CLI version 6.2.5.

Support

  • Angular version >=5.0.0
  • Rxjs@ version >=5.0.0

Upgrade version of npm plugin

Change manually the version in projects/mvplus-network/package.json

Build package

npm run package

Publish on npm

npm login

npm publish dist/mvplus-network/mvplus-network-${your-version}.tgz

Usage

Import module

Import MvplusNetworkModule in your app (or core if you have) module, calling forRoot method, passing the backend endpoint where the API must be called :

Example core.module.ts

@NgModule({
    imports: [
        BrowserModule,
        MvplusNetworkModule.forRoot({backendEndpoint: 'http://demo.virt.moviplus.ch:8083/tpc_app_clients/1.32.4'})
    ],
    providers: [],
    exports: [MvplusNetworkModule]
})

Usage of API

Example

@Injectable()
export class MyService {
    constructor(
        private mvplusNetworkService: MvplusNetworkService) {
    }

    public foo() {
        this.mvplusNetworkService.$getNetworkTypeById('3454354325432').subscribe((network)=>{
          console.log(network);
        })
    }
}

Network interface

export interface Network {
  name: NetworkType;
  id: string;
}

Network type available

export enum NetworkType {
  TPC = 'Transports Publics du Chablais',
  RegionAlps = 'RegionAlps',
  CFF = 'SBB CFF',
  CarPostal = 'CarPostal'
}

NOTE : The value of each enum must be corresponding to the name of network returned by the server

Changelog

0.0.6

  • Bugfix when no network found

0.0.5

  • Bugfix on exporting interface of lib

0.0.4

  • Export enum NetworkType enum
  • Export enum Network interface

0.0.3

  • Add TPG network type

0.0.2

  • Bugfix when no networks found or if backend endpoint is unreachable/invalid

FAQs

Package last updated on 02 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts