TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | Commercial |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Brian Drelling.
ParkingPandaSDK provides easy access to the Parking Panda API.
For the time being, ParkingPandaSDK has three dependencies that will be automatically installed upon including this pod.
Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
We do not support Swift Package Manager at this time. Please contact us if you require Swift Package Manager support.
For instructions on how to install the SDK manually, please contact us.
There are two ways to get started.
1) Use the shared
instance of the PPAPIClient
class.
PPAPIClient.shared.apiKey = "MY-API-KEY"
PPAPIClient.shared.test()
2) Create your own instance of the PPAPIClient
class.
let client = PPAPIClient(apiKey: "MY-API-KEY")
client.test()
Every call in PPAPIClient
requires an API key which can be set during or after initialization.
The test()
method will verify that your client has access to the API.
Authentication is very simple.
func login(username: String?, password: String?, authType: PPAuthType = .default, includeCreditCards: Bool = true, callback: ((PPUserModel) -> Void)? = nil)
username
is typically the user’s email address.
password
is the user’s plain text password or API token.
authType
(optional) is the authentication type. It is .default
by default.
includeCreditCards
(optional) determines whether or not a list of the user’s vaulted credit cards are returned.
callback
(optional) fires if the authentication is successful.
Example:
PPAPIClient.shared.login(username: "USERNAME", password: "PASSWORD") { (user) in
print(user.email)
}
By default, the shared
instance of PPAPIClient
will store user credentials on the device when user authentication is successful. These credentials include the user’s id, email, and api token. You can override this behavior by setting the cacheKey
property to nil
.
Likewise, you can set the cacheKey
property on any instance of PPAPIClient
to maintain unique caching of credentials per client. This can be set during or after initialization.
Examples:
let client = PPAPIClient(apiKey: "MY-API-KEY", cacheKey: "CLIENT-A")
let client = PPAPIClient()
client.apiKey = "MY-API-KEY"
client.cacheKey = "CLIENT-B"
ParkingPandaSDK is released under the Apache 2.0 license. See LICENSE for details.