Commit d4b16b79 authored by Zach Knox's avatar Zach Knox

Merge branch 'weather-data'

That versions file...
parents 6e18cca9 19e18742
......@@ -2,3 +2,5 @@ weather/mup.json
weather/settings.json
weather/.meteor
weather/server/lib/secrets.js
.meteor/local
.meteor/meteorite
......@@ -10,3 +10,4 @@ notices-for-facebook-graph-api-2
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
......@@ -12,7 +12,6 @@ session # Client-side reactive dictionary for your app
jquery # Helpful client-side library
tracker # Meteor's client-side reactive programming library
standard-minifiers # JS/CSS minifiers run for production mode
es5-shim # ECMAScript 5 compatibility for older browsers.
ecmascript # Enable ECMAScript2015+ syntax in app code
......@@ -20,3 +19,6 @@ autopublish # Publish all data to the clients (for prototyping)
insecure # Allow all DB writes from clients (for prototyping)
zodiase:mdl
mquandalle:bower
http
standard-minifier-css
standard-minifier-js
<<<<<<< HEAD
autopublish@1.0.4
autoupdate@1.2.4
babel-compiler@5.8.24_1
......
<body>
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
......
"use strict";
import { Mongo } from 'meteor/mongo';
export const WeatherData = new Mongo.Collection('weather-data');
export function refreshData() {
for(var key in LOCATIONS) {
const current = LOCATIONS[key];
var currentData
Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){
currentData = res
});
WeatherData.insert ({
name: current.name,
lat: current.lat,
long: current.long,
data: currentData,
lastUpdated: new Date(),
});
}
}
import { Template } from 'meteor/templating';
import { WeatherData } from '../api/data.js';
import '../../client/weather.html';
Template.body.helpers({
current() {
return WeatherData.find({});
},
});
//Template file for secrets.js
//Duplicate this file and name it 'secrets.js'
//Replace 'YOUR_API_KEY_HERE' with your Forcast.io API key
//You can get an API key at https://developer.forecast.io
Meteor.startup(function () {
process.env.API_KEY = 'YOUR_API_KEY_HERE';
});
import { WeatherData } from '../imports/api/data.js';
//import 'imports/ui/dataview.js'; //seems to be the problem?
if (Meteor.isClient) {
for(var key in LOCATIONS) {
var current = LOCATIONS[key];
console.log(current.name);
Meteor.call('weatherDataForLoc', current.lat, current.long, function(err, res){
console.log(res);
//Sends the result of the API call to the browser console, will change
});
}
Template.weather.helpers({
updateData: function() {
}
});
Template.weather.events({
......@@ -13,4 +25,15 @@ if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
Meteor.methods({
'weatherDataForLoc': function (lat, long) {
//API_KEY is an environmental veriable, you can set it with a JS file in
// server/lib or in your server control panel.
var API_KEY = process.env.API_KEY;
var apiURL = 'https://api.forecast.io/forecast/' + API_KEY + '/' + lat + ',' + long;
var response = HTTP.get(apiURL).data;
return response;
}
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment