Skip to content

Commit dcb5660

Browse files
committed
Squashed commit of the following:
commit 9d519bb Author: Satyam Ghodasara <[email protected]> Date: Fri Mar 30 17:23:44 2018 -0400 Added alert changes to the change log commit 7499bd3 Author: Satyam Ghodasara <[email protected]> Date: Fri Mar 30 17:13:28 2018 -0400 Updated project commit e71f5b0 Author: Satyam Ghodasara <[email protected]> Date: Fri Mar 30 17:13:14 2018 -0400 Bumped version to 4.1.0 commit 4f4a01a Author: Satyam Ghodasara <[email protected]> Date: Fri Mar 30 17:08:09 2018 -0400 Updated change log commit 28a433e Author: Satyam Ghodasara <[email protected]> Date: Sun Feb 12 14:48:58 2017 -0500 Added unit tests for new Alert properties commit 3cb5fc7 Author: Satyam Ghodasara <[email protected]> Date: Sun Feb 12 14:31:06 2017 -0500 Added time, regions, and severity properties and Severity enum to the Alert struct commit b20f414 Author: Satyam Ghodasara <[email protected]> Date: Sun Feb 12 13:51:12 2017 -0500 Added unit tests for Bulgarian language
1 parent b0ede15 commit dcb5660

File tree

16 files changed

+83
-15
lines changed

16 files changed

+83
-15
lines changed

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@
22

33
ForecastIO adheres to [Semantic Versioning](http://semver.org/).
44

5+
## 4.1.0
6+
7+
Released on March 30, 2018.
8+
9+
### Added
10+
- `time`, `regions`, and `severity` properties on `Alert`
11+
- Support for Bulgarian
12+
13+
### Updated
14+
- `Float` properties are now `Double` on `DataPoint` and `Forecast`
15+
516
## 4.0.0
617

7-
Released on February 6, 2016.
18+
Released on February 6, 2017.
819

920
### Updated
1021
- `expire` property on `Alert` is now optional

Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0810"
3+
LastUpgradeVersion = "0820"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ForecastIO.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
Pod::Spec.new do |s|
1111
s.name = "ForecastIO"
12-
s.version = "4.0.0"
12+
s.version = "4.1.0"
1313
s.summary = "ForecastIO is a Swift library for interfacing with the Dark Sky forecast API."
1414
s.homepage = "https://github.com/sxg/ForecastIO"
1515
s.license = 'MIT'

ForecastIO.xcodeproj/project.pbxproj

+10-1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@
261261
/* End PBXFrameworksBuildPhase section */
262262

263263
/* Begin PBXGroup section */
264+
4AF4CE20206EDF4B00BFA485 /* Recovered References */ = {
265+
isa = PBXGroup;
266+
children = (
267+
4A56CEB11D44770C00751AF6 /* Language.swift */,
268+
);
269+
name = "Recovered References";
270+
sourceTree = "<group>";
271+
};
264272
7DB346D0F39D3F0E887471402A8071AB = {
265273
isa = PBXGroup;
266274
children = (
@@ -270,6 +278,7 @@
270278
BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */,
271279
8B40303E341216B1C5CF6E57ADE54857 /* Products */,
272280
CAC24571B48A74C836257F9A /* Pods */,
281+
4AF4CE20206EDF4B00BFA485 /* Recovered References */,
273282
);
274283
sourceTree = "<group>";
275284
};
@@ -571,7 +580,7 @@
571580
isa = PBXProject;
572581
attributes = {
573582
LastSwiftUpdateCheck = 0730;
574-
LastUpgradeCheck = 0810;
583+
LastUpgradeCheck = 0820;
575584
TargetAttributes = {
576585
39ED6CDC99672303F992B722C0ABD571 = {
577586
LastSwiftMigration = 0800;

ForecastIO.xcodeproj/xcshareddata/xcschemes/ForecastIO iOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0810"
3+
LastUpgradeVersion = "0820"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ForecastIO.xcodeproj/xcshareddata/xcschemes/ForecastIO macOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0810"
3+
LastUpgradeVersion = "0820"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ForecastIO.xcodeproj/xcshareddata/xcschemes/ForecastIO tvOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0810"
3+
LastUpgradeVersion = "0820"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ForecastIO.xcodeproj/xcshareddata/xcschemes/ForecastIO watchOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0810"
3+
LastUpgradeVersion = "0820"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Source/Alert.swift

+25
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public struct Alert {
1414
/// A short text summary of the `Alert`.
1515
public let title: String
1616

17+
/// The time at which this alert was issued.
18+
public let time: Date
19+
1720
/// The time at which the `Alert` will cease to be valid.
1821
public let expires: Date?
1922

@@ -23,6 +26,25 @@ public struct Alert {
2326
/// An HTTP(S) URI that contains detailed information about the `Alert`.
2427
public let uri: URL
2528

29+
/// Regions covered by the `Alert`.
30+
public let regions: [String]
31+
32+
/// The severity of the `Alert`.
33+
public let severity: Severity
34+
35+
/// Severity categories of `Alert`s.
36+
public enum Severity: String {
37+
38+
/// `advisory` `Alert`s tell an individual to be aware of potentially severe weather.
39+
case advisory = "advisory"
40+
41+
/// `watch` `Alert`s tell an individual to prepare for potentially severe weather.
42+
case watch = "watch"
43+
44+
/// `warning` `Alert`s tell an individual to take immediate action to protect themselves and others from potentially severe weather.
45+
case warning = "warning"
46+
}
47+
2648
/// Creates a new `Alert` from a JSON object.
2749
///
2850
/// - parameter json: A JSON object with keys corresponding to the `Alert`'s properties.
@@ -35,7 +57,10 @@ public struct Alert {
3557
} else {
3658
expires = nil
3759
}
60+
time = Date(timeIntervalSince1970: json["time"] as! Double)
3861
uri = URL(string: json["uri"] as! String)!
3962
description = json["description"] as! String
63+
regions = json["regions"] as! [String]
64+
severity = Severity(rawValue: json["severity"] as! String)!
4065
}
4166
}

Source/Forecast.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public struct Forecast {
6666
///
6767
/// - returns: A new `Forecast` filled with data from the given JSON object.
6868
public init(fromJSON json: NSDictionary) {
69-
latitude = json["latitude"] as! Float
70-
longitude = json["longitude"] as! Float
69+
latitude = json["latitude"] as! Double
70+
longitude = json["longitude"] as! Double
7171
timezone = json["timezone"] as! String
7272

7373
if let jsonCurrently = json["currently"] as? NSDictionary {

Source/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>4.0.0</string>
18+
<string>4.1.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Tests/AlertTests.swift

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ class AlertTests: XCTestCase {
4545
XCTAssertEqual(alert.expires, Date(timeIntervalSince1970: 1453593600))
4646
XCTAssertEqual(alert.uri.absoluteString, "http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FAA7AC.HighWindWarning.1255E5079700MD.LWXNPWLWX.b0aa96f59630770f05e80c219b873fd2")
4747
XCTAssertEqual(alert.description, "...HIGH WIND WARNING REMAINS IN EFFECT UNTIL 7 PM EST THIS\nEVENING...\n* TIMING...THROUGH TODAY.\n* WINDS...NORTH 25 TO 35 MPH WITH GUSTS UP TO 55 MPH.\n* IMPACTS...DOWNED TREES...POWERLINES...AND MINOR STRUCTURAL\nDAMAGE. DRIVING HIGH PROFILE VEHICLES IN THESE CONDITIONS IS\nDANGEROUS.\n")
48+
XCTAssertEqual(alert.severity.rawValue, "watch")
49+
XCTAssertEqual(alert.regions, ["Eastern Bergen","Eastern Essex","Eastern Passaic","Eastern Union","Hudson","Western Bergen","Western Essex","Western Passaic","Western Union"])
50+
XCTAssertEqual(alert.time, Date(timeIntervalSince1970: 1453562580))
4851
}
4952

5053
func testInitNoOptionalsFromJSON() {
@@ -60,6 +63,9 @@ class AlertTests: XCTestCase {
6063
XCTAssertNil(alert.expires)
6164
XCTAssertEqual(alert.uri.absoluteString, "http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FAA7AC.HighWindWarning.1255E5079700MD.LWXNPWLWX.b0aa96f59630770f05e80c219b873fd2")
6265
XCTAssertEqual(alert.description, "...HIGH WIND WARNING REMAINS IN EFFECT UNTIL 7 PM EST THIS\nEVENING...\n* TIMING...THROUGH TODAY.\n* WINDS...NORTH 25 TO 35 MPH WITH GUSTS UP TO 55 MPH.\n* IMPACTS...DOWNED TREES...POWERLINES...AND MINOR STRUCTURAL\nDAMAGE. DRIVING HIGH PROFILE VEHICLES IN THESE CONDITIONS IS\nDANGEROUS.\n")
66+
XCTAssertEqual(alert.severity.rawValue, "watch")
67+
XCTAssertEqual(alert.regions, ["Eastern Bergen","Eastern Essex","Eastern Passaic","Eastern Union","Hudson","Western Bergen","Western Essex","Western Passaic","Western Union"])
68+
XCTAssertEqual(alert.time, Date(timeIntervalSince1970: 1453562580))
6369
}
6470

6571
}

Tests/LanguageTests.swift

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class LanguageTests: XCTestCase {
1818
XCTAssertEqual(Language.arabic.rawValue, "ar")
1919
XCTAssertEqual(Language.azerbaijani.rawValue, "az")
2020
XCTAssertEqual(Language.belarusian.rawValue, "be")
21+
XCTAssertEqual(Language.bulgarian.rawValue, "bg")
2122
XCTAssertEqual(Language.bosnian.rawValue, "bs")
2223
XCTAssertEqual(Language.catalan.rawValue, "ca")
2324
XCTAssertEqual(Language.czech.rawValue, "cs")

Tests/Resources/forecast.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -1625,14 +1625,18 @@
16251625
"time":1453562580,
16261626
"expires":1453593600,
16271627
"description":"...HIGH WIND WARNING REMAINS IN EFFECT UNTIL 7 PM EST THIS\nEVENING...\n* TIMING...THROUGH TODAY.\n* WINDS...NORTH 25 TO 35 MPH WITH GUSTS UP TO 55 MPH.\n* IMPACTS...DOWNED TREES...POWERLINES...AND MINOR STRUCTURAL\nDAMAGE. DRIVING HIGH PROFILE VEHICLES IN THESE CONDITIONS IS\nDANGEROUS.\n",
1628-
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FAA7AC.HighWindWarning.1255E5079700MD.LWXNPWLWX.b0aa96f59630770f05e80c219b873fd2"
1628+
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FAA7AC.HighWindWarning.1255E5079700MD.LWXNPWLWX.b0aa96f59630770f05e80c219b873fd2",
1629+
"severity":"watch",
1630+
"regions": ["Eastern Bergen","Eastern Essex","Eastern Passaic","Eastern Union","Hudson","Western Bergen","Western Essex","Western Passaic","Western Union"]
16291631
},
16301632
{
16311633
"title":"Blizzard Warning for Baltimore, MD",
16321634
"time":1453559700,
16331635
"expires":1453633200,
16341636
"description":"VERY STRONG LOW PRESSURE WILL DRIFT EAST FROM THE MOUTH OF THE\nCHESAPEAKE BAY TODAY.\n...BLIZZARD WARNING REMAINS IN EFFECT UNTIL 6 AM EST SUNDAY...\n* HAZARD TYPES...HEAVY SNOW AND BLOWING SNOW.\n* SNOW ACCUMULATIONS...22 TO 30 INCHES...UP TO 36 INCHES ABOVE\n1200 FEET.\n* TIMING...HEAVY SNOW THROUGH THIS EVENING. BLOWING SNOW INTO\nSUNDAY.\n* IMPACTS...HEAVY SNOW AND BLOWING SNOW WILL CONTINUE TO CAUSE\nDANGEROUS CONDITIONS AND WILL BE A THREAT TO LIFE AND PROPERTY.\nTRAVEL IS IMPOSSIBLE. VISIBILITY WILL BE REDUCED TO NEAR ZERO\nAT TIMES IN WHITEOUT CONDITIONS THROUGH TONIGHT.\n* WINDS...NORTH 20 TO 30 MPH WITH GUSTS UP TO 50 MPH.\n* TEMPERATURES...IN THE LOWER 20S. WIND CHILLS SINGLE DIGITS.\n",
1635-
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FA854C.BlizzardWarning.1255E50944B0MD.LWXWSWLWX.2725408b6d049dc67224e179c743dc2d"
1637+
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FA854C.BlizzardWarning.1255E50944B0MD.LWXWSWLWX.2725408b6d049dc67224e179c743dc2d",
1638+
"severity":"warning",
1639+
"regions": ["Eastern Bergen","Eastern Essex","Eastern Passaic","Eastern Union","Hudson","Western Bergen","Western Essex","Western Passaic","Western Union"]
16361640
}
16371641
],
16381642
"flags":{

Tests/Resources/forecast_no_optionals.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -1616,13 +1616,17 @@
16161616
"title":"High Wind Warning for Baltimore, MD",
16171617
"time":1453562580,
16181618
"description":"...HIGH WIND WARNING REMAINS IN EFFECT UNTIL 7 PM EST THIS\nEVENING...\n* TIMING...THROUGH TODAY.\n* WINDS...NORTH 25 TO 35 MPH WITH GUSTS UP TO 55 MPH.\n* IMPACTS...DOWNED TREES...POWERLINES...AND MINOR STRUCTURAL\nDAMAGE. DRIVING HIGH PROFILE VEHICLES IN THESE CONDITIONS IS\nDANGEROUS.\n",
1619-
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FAA7AC.HighWindWarning.1255E5079700MD.LWXNPWLWX.b0aa96f59630770f05e80c219b873fd2"
1619+
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FAA7AC.HighWindWarning.1255E5079700MD.LWXNPWLWX.b0aa96f59630770f05e80c219b873fd2",
1620+
"severity":"watch",
1621+
"regions": ["Eastern Bergen","Eastern Essex","Eastern Passaic","Eastern Union","Hudson","Western Bergen","Western Essex","Western Passaic","Western Union"]
16201622
},
16211623
{
16221624
"title":"Blizzard Warning for Baltimore, MD",
16231625
"time":1453559700,
16241626
"description":"VERY STRONG LOW PRESSURE WILL DRIFT EAST FROM THE MOUTH OF THE\nCHESAPEAKE BAY TODAY.\n...BLIZZARD WARNING REMAINS IN EFFECT UNTIL 6 AM EST SUNDAY...\n* HAZARD TYPES...HEAVY SNOW AND BLOWING SNOW.\n* SNOW ACCUMULATIONS...22 TO 30 INCHES...UP TO 36 INCHES ABOVE\n1200 FEET.\n* TIMING...HEAVY SNOW THROUGH THIS EVENING. BLOWING SNOW INTO\nSUNDAY.\n* IMPACTS...HEAVY SNOW AND BLOWING SNOW WILL CONTINUE TO CAUSE\nDANGEROUS CONDITIONS AND WILL BE A THREAT TO LIFE AND PROPERTY.\nTRAVEL IS IMPOSSIBLE. VISIBILITY WILL BE REDUCED TO NEAR ZERO\nAT TIMES IN WHITEOUT CONDITIONS THROUGH TONIGHT.\n* WINDS...NORTH 20 TO 30 MPH WITH GUSTS UP TO 50 MPH.\n* TEMPERATURES...IN THE LOWER 20S. WIND CHILLS SINGLE DIGITS.\n",
1625-
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FA854C.BlizzardWarning.1255E50944B0MD.LWXWSWLWX.2725408b6d049dc67224e179c743dc2d"
1627+
"uri":"http://alerts.weather.gov/cap/wwacapget.php?x=MD1255E4FA854C.BlizzardWarning.1255E50944B0MD.LWXWSWLWX.2725408b6d049dc67224e179c743dc2d",
1628+
"severity":"warning",
1629+
"regions": ["Eastern Bergen","Eastern Essex","Eastern Passaic","Eastern Union","Hudson","Western Bergen","Western Essex","Western Passaic","Western Union"]
16261630
}
16271631
],
16281632
"flags":{

0 commit comments

Comments
 (0)