content: import React, { Component } from 'react';
  import { AppRegistry, Text, View, ListView, Button } from 'react-native';
  
  import ApiKeys from './ApiKeys'
  
  function WeatherData() {
    this.wList = [];
  
    this.sendWeatherRequest = function(lat, long) {
      var apiKey = ApiKeys.WeatherComKey();
      var urlRoot = 'http://api.wunderground.com/api/';
      var sep = '&';
      var retProm = fetch(urlRoot + apiKey + '/forecast10day/q/' + lat + ',' + long + '.json');
      console.log(urlRoot + apiKey + '/forecast10day/q/' + lat + ',' + long + '.json')
      return retProm;
    }
  
    this.getDayW = function(json) {
      return json.weekday_short + ', ' + json.day + ' ' + json.monthname_short;
    }
  
    this.updateWeather = function(lat, long, cb) {
      this.sendWeatherRequest(lat, long)
      .then((function(response) { return response.json(); }).bind(this))
      .then((function(data) {
        var sf = data.forecast.simpleforecast;
        var jsonList = sf.forecastday;
        var wlist = [];
        for (var i = 0; i < jsonList.length; i++) {
          wlist.push(jsonList[i])
        }
        var wdata = [];
        for(var i=0; i<wlist.length; i++){
          console.log(wlist[i].icon)
          wdata.push({icon: wlist[i].icon, day: this.getDayW(wlist[i].date), max: wlist[i].high.celsius,
            min: wlist[i].low.celsius, weather: wlist[i].conditions});
        }
        this.wList = wdata;
        cb(wdata);
      }).bind(this));
    }
  }
  
  module.exports = WeatherData;
  