MarcoEidinger / npsapi-swift
Showing 12 of 85 files from the diff.
Other files ignored by Codecov
docs/Classes.html has changed.
Package.swift has changed.
docs/index.html has changed.
docs/Structs.html has changed.
docs/docsets/.tgz has changed.
README.md has changed.
docs/search.json has changed.
docs/Enums.html has changed.
.travis.yml has changed.

@@ -8,7 +8,7 @@
Loading
8 8
import Foundation
9 9
10 10
/// Designation of a unit belonging to the National Park Service
11 -
public enum ParkUnitDesignation: String {
11 +
public enum ParkUnitDesignation: String, CaseIterable {
12 12
    /// National Park
13 13
    case nationalPark = "National Park"
14 14
    /// National Monument
15 15
imilarity index 96%
16 16
ename from Sources/npsapi-swift/Model/RequestOption.swift
17 17
ename to Sources/NatParkSwiftKit/Model/RequestOption.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  Internal.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/21/20.
6 6
//
7 7
imilarity index 98%
8 8
ename from Sources/npsapi-swift/Internal/RequestUrlFactory.swift
9 9
ename to Sources/NatParkSwiftKit/Internal/RequestUrlFactory.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  RequestableField.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/18/20.
6 6
//
7 7
imilarity index 100%
8 8
ename from Sources/npsapi-swift/Model/StateInUSA.swift
9 9
ename to Sources/NatParkSwiftKit/Model/StateInUSA.swift
10 10
imilarity index 98%
11 11
ename from Sources/npsapi-swift/Model/VisitorCenter.swift
12 12
ename to Sources/NatParkSwiftKit/Model/VisitorCenter.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  RequestUrlFactory.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/18/20.
6 6
//
7 7
imilarity index 98%
8 8
ename from Sources/npsapi-swift/Model/Alert.swift
9 9
ename to Sources/NatParkSwiftKit/Model/Alert.swift

@@ -1,7 +1,7 @@
Loading
1 1
import Foundation
2 2
import Combine
3 3
4 -
private enum NationalParkServiceApiEndpoint: String {
4 +
private enum DataServiceEndpoint: String {
5 5
    case parks = "/parks"
6 6
    case alerts = "/alerts"
7 7
    case newsRelease = "/newsreleases"
@@ -10,25 +10,25 @@
Loading
10 10
}
11 11
12 12
/// Main API class to interact with the National Park Service API
13 -
public class NationalParkServiceApi {
13 +
public class DataService {
14 14
15 15
    /// Required API key which can be requested for free from NPS Developer website
16 16
    public let apiKey: String
17 17
18 18
    private let urlFactory: RequestUrlFactory = RequestUrlFactory()
19 19
20 -
    private var errorTransformer: (Error) -> NationalParkServiceApiError = { error in
20 +
    private var errorTransformer: (Error) -> DataServiceError = { error in
21 21
        switch error {
22 -
        case NationalParkServiceApiError.invalidApiKey:
23 -
            return NationalParkServiceApiError.invalidApiKey
22 +
        case DataServiceError.invalidApiKey:
23 +
            return DataServiceError.invalidApiKey
24 24
        default:
25 -
            return NationalParkServiceApiError.cannotDecodeContent(error: error)
25 +
            return DataServiceError.cannotDecodeContent(error: error)
26 26
        }
27 27
    }
28 28
29 29
    private var responseTransformer: (Data, URLResponse) throws -> Data = { data, response -> Data in
30 30
        guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else {
31 -
            throw NationalParkServiceApiError.invalidApiKey
31 +
            throw DataServiceError.invalidApiKey
32 32
        }
33 33
        return data
34 34
    }
@@ -47,7 +47,7 @@
Loading
47 47
48 48
        - Returns: a respective publisher
49 49
    */
50 -
    public func fetchPark(_ parkCode: String) -> AnyPublisher<Park?, NationalParkServiceApiError> {
50 +
    public func fetchPark(_ parkCode: String) -> AnyPublisher<Park?, DataServiceError> {
51 51
        return self.fetchParks(by: [parkCode], in: nil, nil)
52 52
            .map { $0.first }
53 53
            .eraseToAnyPublisher()
@@ -61,10 +61,10 @@
Loading
61 61
        - Parameter requestOptions: to specify result amount (default: 50) and further influence search critierias
62 62
        - Returns: a respective publisher
63 63
    */
64 -
    public func fetchParks(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableParkField>? = nil) -> AnyPublisher<[Park], NationalParkServiceApiError> {
64 +
    public func fetchParks(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableParkField>? = nil) -> AnyPublisher<[Park], DataServiceError> {
65 65
66 66
        guard let validUrl = self.url(.parks, by: parkCodes, in: states, requestOptions) else {
67 -
            return Fail(error: NationalParkServiceApiError.badURL).eraseToAnyPublisher()
67 +
            return Fail(error: DataServiceError.badURL).eraseToAnyPublisher()
68 68
        }
69 69
70 70
        return URLSession.shared.dataTaskPublisher(for: validUrl)
@@ -83,10 +83,10 @@
Loading
83 83
        - Parameter requestOptions: to specify result amount (default: 50) and further influence search critierias
84 84
        - Returns: a respective publisher
85 85
    */
86 -
    public func fetchAlerts(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableAlertField>? = nil) -> AnyPublisher<[Alert], NationalParkServiceApiError> {
86 +
    public func fetchAlerts(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableAlertField>? = nil) -> AnyPublisher<[Alert], DataServiceError> {
87 87
88 88
        guard let validUrl = self.url(.alerts, by: parkCodes, in: states, requestOptions) else {
89 -
            return Fail(error: NationalParkServiceApiError.badURL).eraseToAnyPublisher()
89 +
            return Fail(error: DataServiceError.badURL).eraseToAnyPublisher()
90 90
        }
91 91
92 92
        return URLSession.shared.dataTaskPublisher(for: validUrl)
@@ -105,10 +105,10 @@
Loading
105 105
        - Parameter requestOptions: to specify result amount (default: 50) and further influence search critierias
106 106
        - Returns: a respective publisher
107 107
    */
108 -
    public func fetchNewsReleases(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableNewsReleaseField>? = nil) -> AnyPublisher<[NewsRelease], NationalParkServiceApiError> {
108 +
    public func fetchNewsReleases(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableNewsReleaseField>? = nil) -> AnyPublisher<[NewsRelease], DataServiceError> {
109 109
110 110
        guard let validUrl = self.url(.newsRelease, by: parkCodes, in: states, requestOptions) else {
111 -
            return Fail(error: NationalParkServiceApiError.badURL).eraseToAnyPublisher()
111 +
            return Fail(error: DataServiceError.badURL).eraseToAnyPublisher()
112 112
        }
113 113
114 114
        return URLSession.shared.dataTaskPublisher(for: validUrl)
@@ -127,10 +127,10 @@
Loading
127 127
        - Parameter requestOptions: to specify result amount (default: 50) and further influence search critierias
128 128
        - Returns: a respective publisher
129 129
    */
130 -
    public func fetchVisitorCenters(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableVisitorCenterField>? = nil) -> AnyPublisher<[VisitorCenter], NationalParkServiceApiError> {
130 +
    public func fetchVisitorCenters(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableVisitorCenterField>? = nil) -> AnyPublisher<[VisitorCenter], DataServiceError> {
131 131
132 132
        guard let validUrl = self.url(.visitorCenters, by: parkCodes, in: states, requestOptions) else {
133 -
            return Fail(error: NationalParkServiceApiError.badURL).eraseToAnyPublisher()
133 +
            return Fail(error: DataServiceError.badURL).eraseToAnyPublisher()
134 134
        }
135 135
136 136
        return URLSession.shared.dataTaskPublisher(for: validUrl)
@@ -149,10 +149,10 @@
Loading
149 149
        - Parameter requestOptions: to specify result amount (default: 50) and further influence search critierias
150 150
        - Returns: a respective publisher
151 151
    */
152 -
    public func fetchAssets(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableAssetField>? = nil) -> AnyPublisher<[Asset], NationalParkServiceApiError> {
152 +
    public func fetchAssets(by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<RequestableAssetField>? = nil) -> AnyPublisher<[Asset], DataServiceError> {
153 153
154 154
        guard let validUrl = self.url(.assets, by: parkCodes, in: states, requestOptions) else {
155 -
            return Fail(error: NationalParkServiceApiError.badURL).eraseToAnyPublisher()
155 +
            return Fail(error: DataServiceError.badURL).eraseToAnyPublisher()
156 156
        }
157 157
158 158
        return URLSession.shared.dataTaskPublisher(for: validUrl)
@@ -164,7 +164,7 @@
Loading
164 164
    }
165 165
166 166
    // MARK: private functions
167 -
    private func url<T: RequestableField>(_ endpoint: NationalParkServiceApiEndpoint, by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<T>?) -> URL? {
167 +
    private func url<T: RequestableField>(_ endpoint: DataServiceEndpoint, by parkCodes: [String]? = [], in states: [StateInUSA]? = [], _ requestOptions: RequestOptions<T>?) -> URL? {
168 168
169 169
        var urlComponents = self.urlFactory.apiUrlComponents(for: endpoint.rawValue, authorizedBy: self.apiKey)
170 170
171 171
imilarity index 80%
172 172
ename from Sources/npsapi-swift/NationalParkServiceApiError.swift
173 173
ename to Sources/NatParkSwiftKit/DataServiceError.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  NpsImage.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/21/20.
6 6
//
7 7
imilarity index 100%
8 8
ename from Sources/npsapi-swift/Model/Park.swift
9 9
ename to Sources/NatParkSwiftKit/Model/Park.swift
10 10
imilarity index 98%
11 11
ename from Sources/npsapi-swift/Model/ParkCodeConstants.swift
12 12
ename to Sources/NatParkSwiftKit/Model/ParkCodeConstants.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  VisitorCenter.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/23/20.
6 6
//
7 7
imilarity index 97%
8 8
ename from Tests/npsapi-swiftTests/NationalParkServiceApiTests.swift
9 9
ename to Tests/NatParkSwiftKitTests/DataServiceTests.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  Asset.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/24/20.
6 6
//
7 7
imilarity index 95%
8 8
ename from Sources/npsapi-swift/Model/Fee.swift
9 9
ename to Sources/NatParkSwiftKit/Model/Fee.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  NewsRelease.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/21/20.
6 6
//
7 7
imilarity index 98%
8 8
ename from Sources/npsapi-swift/Model/NpsImage.swift
9 9
ename to Sources/NatParkSwiftKit/Model/NpsImage.swift

@@ -1,6 +1,6 @@
Loading
1 1
//
2 2
//  Alert.swift
3 -
//  npsapi-swift
3 +
//  NatParkSwiftKit
4 4
//
5 5
//  Created by Eidinger, Marco on 1/18/20.
6 6
//
7 7
imilarity index 98%
8 8
ename from Sources/npsapi-swift/Model/Asset.swift
9 9
ename to Sources/NatParkSwiftKit/Model/Asset.swift
Files Coverage
Sources/NatParkSwiftKit 95.09%
Project Totals (12 files) 95.09%
66.1
default=
TRAVIS_OS_NAME=osx

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading