Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
METAR Information: Change API url to https. Add new translation. (#3005)
Browse files Browse the repository at this point in the history
* Use new url with https

* Add maintenance check indicator warning to table
  • Loading branch information
santigl authored and moollaza committed Mar 21, 2017
1 parent 038b5bf commit f231a01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/DDG/Spice/Metar.pm
Expand Up @@ -7,7 +7,7 @@ package DDG::Spice::Metar;
use DDG::Spice;
use Geo::ICAO qw{ :airport };

spice to => 'http://avwx.rest/api/metar.php?station=$1&format=JSON&options=info,translate';
spice to => 'https://avwx.rest/api/metar/$1?options=info,translate';
spice proxy_cache_valid => "418 1d"; # Do not cache responses.
spice wrap_jsonp_callback => 1;

Expand Down
14 changes: 10 additions & 4 deletions share/spice/metar/metar.js
Expand Up @@ -12,13 +12,15 @@
data: api_result,
meta: {
sourceName: "Aviation Weather REST API",
sourceUrl: "http://avwx.rest"
sourceUrl: "https://avwx.rest"
},
normalize: function(item) {
var airport_desc = [item["Info"]["City"],
item["Info"]["Country"]];
if (item["Info"]["Name"] != "") // Name is empty for some places.
airport_desc.unshift(item["Info"]["Name"]);

if (item["Info"]["Name"] !== "") {
airport_desc.unshift(item["Info"]["Name"]); // Name is empty for some places.
}

var interpreted_data = [
{label: "Time of Observation",
Expand All @@ -39,11 +41,15 @@
value: item["Flight-Rules"]}
];

if (item["Translations"]["Other"] != "") {
if (item["Translations"]["Other"] !== "") {
interpreted_data.push({label: "Other Remarks",
value: item["Translations"]["Other"]});
}

if (item["Raw-Report"].indexOf('$') !== -1) {
interpreted_data.unshift({label: "Maintenance Check Indicator", value: "On"});
}

return {
title: item["Station"],
subtitle: [airport_desc.join(", "),
Expand Down

0 comments on commit f231a01

Please sign in to comment.