Advertisement
Guest User

Untitled

a guest
Jan 31st, 2018
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Client  {
  2.     constructor(cod, user, pass) {
  3.         this.cod = cod;
  4.         this.user = user;
  5.         this.pass = pass;
  6.         this.apiKey = 'ax6542sdru3217t4eesd9';
  7.         this.getSchede = this.getSchede.bind(this);
  8.  
  9.     }
  10.  
  11.     login() {
  12.         return fetch('https://www.portaleargo.it/famiglia/api/rest/login', {
  13.             headers: new Headers({
  14.                 "x-cod-min": this.cod,
  15.                 "x-user-id": this.user,
  16.                 "x-pwd": this.pass,
  17.             })
  18.         })
  19.             .then(response => response.json())
  20.             .then(data => this.token = data.token);
  21.     }
  22.  
  23.     getSchede() {
  24.         return fetch('https://www.portaleargo.it/famiglia/api/rest/schede', {
  25.             headers: new Headers({
  26.                 "x-cod-min": this.cod,
  27.                 "x-auth-token": this.token,
  28.                 "x-key-app": this.apiKey,
  29.             })
  30.         })
  31.             .then(response => response.json())
  32.             .then(data => this.schedaAlunno = data);
  33.  
  34.  
  35.     }
  36.  
  37.     getVoti() {
  38.         return fetch('https://www.portaleargo.it/famiglia/api/rest/votigiornalieri', {
  39.             headers: new Headers({
  40.                 "x-cod-min": this.cod,
  41.                 "x-auth-token": this.token,
  42.                 "x-key-app": this.apiKey,
  43.                 "x-prg-scuola": this.schedaAlunno[0].prgScuola,
  44.                 "x-prg-scheda": this.schedaAlunno[0].prgScheda,
  45.                 "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
  46.             })
  47.         })
  48.             .then(response => response.json())
  49.             .then(data => this.voti = data)
  50.     }
  51.  
  52.  
  53.     getAssenze(){
  54.         return fetch('https://www.portaleargo.it/famiglia/api/rest/assenze', {
  55.             headers: new Headers({
  56.                 "x-cod-min": this.cod,
  57.                 "x-auth-token": this.token,
  58.                 "x-key-app": this.apiKey,
  59.                 "x-prg-scuola": this.schedaAlunno[0].prgScuola,
  60.                 "x-prg-scheda": this.schedaAlunno[0].prgScheda,
  61.                 "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
  62.             })
  63.         })
  64.             .then(response => response.json())
  65.             .then(data => this.assenze = data)
  66.     }
  67.  
  68.     getOggiaScuola(){
  69.         return fetch('https://www.portaleargo.it/famiglia/api/rest/oggi', {
  70.             headers: new Headers({
  71.                 "x-cod-min": this.cod,
  72.                 "x-auth-token": this.token,
  73.                 "x-key-app": this.apiKey,
  74.                 "x-prg-scuola": this.schedaAlunno[0].prgScuola,
  75.                 "x-prg-scheda": this.schedaAlunno[0].prgScheda,
  76.                 "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
  77.             })
  78.         })
  79.             .then(response => response.json())
  80.             .then(data => this.oggiaScuola = data)
  81.     }
  82.  
  83.     getOrario(){
  84.         return fetch('https://www.portaleargo.it/famiglia/api/rest/orario', {
  85.             headers: new Headers({
  86.                 "x-cod-min": this.cod,
  87.                 "x-auth-token": this.token,
  88.                 "x-key-app": this.apiKey,
  89.                 "x-prg-scuola": this.schedaAlunno[0].prgScuola,
  90.                 "x-prg-scheda": this.schedaAlunno[0].prgScheda,
  91.                 "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
  92.             })
  93.         })
  94.             .then(response => response.json())
  95.             .then(data => this.orario = data)
  96.     }
  97.  
  98.     getVotiScrutionio(){
  99.         return fetch('https://www.portaleargo.it/famiglia/api/rest/votiscrutionio', {
  100.             headers: new Headers({
  101.                 "x-cod-min": this.cod,
  102.                 "x-auth-token": this.token,
  103.                 "x-key-app": this.apiKey,
  104.                 "x-prg-scuola": this.schedaAlunno[0].prgScuola,
  105.                 "x-prg-scheda": this.schedaAlunno[0].prgScheda,
  106.                 "x-prg-alunno": this.schedaAlunno[0].prgAlunno,
  107.             })
  108.         })
  109.             .then(response => response.json())
  110.             .then(data => this.votiScrutionio = data)
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement