Latest 0.6.9
Homepage https://github.com/ParkingPanda/ParkingPandaSDK-iOS
License Commercial Copyright 2016 Parking Panda Corp.
Platforms ios 9.0
Authors

ParkingPandaSDK

Travis CI
CocoaPods Compatible
Platform

ParkingPandaSDK provides easy access to the Parking Panda API.

Features

  • [x] Easily access almost every call in the Parking Panda API.
  • [x] Authenticate user credentials and optionally cache for subsequent calls.
  • [x] Utilize the client via shared static instance or initialize your own.
  • [x] React to the built-in event subscription to know when API calls return.
  • [x] Receive guaranteed attribution for every referral transaction processed in our system.
  • [x] Breathe easily knowing it’s the same logic we use in our consumer-facing and enterprise apps.

Requirements

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 3.0+
  • An API key from Parking Panda. Contact us for more information.

Dependencies

For the time being, ParkingPandaSDK has three dependencies that will be automatically installed upon including this pod.

  • ObjectMapper, used for JSON deserialization.
  • Alamofire, used for all network requests.
  • AlamofireObjectMapper, a component library with convenience methods to bridge the two.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

ParkingPandaSDK can be added to your project by adding the following line to your Podfile:

pod ‘ParkingPandaSDK’, ‘~> 0.1’

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

We do not support Carthage at this time. Please contact us if you require Carthage support.

Swift Package Manager

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.

Manually

For instructions on how to install the SDK manually, please contact us.

Usage

Initializing the Client

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.

Authentcation and Caching

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"

Coming Soon

  • Implement drop-in UI button for easy linking.
  • Remove ObjectMapper dependency.
  • Remove Alamofire dependency.

Communication

  • If you found a bug, please open an issue.
  • If you do not have an API key, please contact us.
  • If you have a feature request, please contact us.

License

ParkingPandaSDK is released under the Apache 2.0 license. See LICENSE for details.

Latest podspec

{
    "name": "ParkingPandaSDK",
    "version": "0.6.9",
    "authors": {
        "Parking Panda": "[email protected]"
    },
    "default_subspecs": "Main",
    "homepage": "https://github.com/ParkingPanda/ParkingPandaSDK-iOS",
    "license": {
        "type": "Commercial",
        "text": "Copyright 2016 Parking Panda Corp."
    },
    "platforms": {
        "ios": "9.0"
    },
    "social_media_url": "http://twitter.com/ParkingPanda",
    "source": {
        "git": "https://github.com/ParkingPanda/ParkingPandaSDK-iOS.git",
        "tag": "0.6.9"
    },
    "summary": "Allows easy usage of the Parking Panda API.",
    "pushed_with_swift_version": "3.0",
    "subspecs": [
        {
            "name": "Shared",
            "source_files": "ParkingPandaSDK/ParkingPandaSDK/*.swift"
        },
        {
            "name": "API",
            "dependencies": {
                "ParkingPandaSDK/Shared": [],
                "Alamofire": [
                    "~> 4.0"
                ],
                "AlamofireObjectMapper": [
                    "~> 4.0"
                ],
                "ObjectMapper": [
                    "~> 2.2"
                ]
            },
            "source_files": [
                "ParkingPandaSDK/ParkingPandaSDK/API/**/*.swift",
                "ParkingPandaSDK/ParkingPandaSDK/API/*.swift"
            ]
        },
        {
            "name": "Main",
            "dependencies": {
                "ParkingPandaSDK/API": []
            },
            "source_files": [
                "ParkingPandaSDK/ParkingPandaSDK/Main/**/*.swift",
                "ParkingPandaSDK/ParkingPandaSDK/Main/*.swift"
            ]
        },
        {
            "name": "P3OS",
            "dependencies": {
                "ParkingPandaSDK/API": []
            },
            "source_files": [
                "ParkingPandaSDK/ParkingPandaSDK/P3OS/**/*.swift",
                "ParkingPandaSDK/ParkingPandaSDK/P3OS/*.swift"
            ]
        }
    ]
}

Pin It on Pinterest

Share This