Skip to content

Commit

Permalink
Added current user storage. Version update
Browse files Browse the repository at this point in the history
  • Loading branch information
conalllaverty committed Dec 12, 2017
1 parent a4e7d29 commit d4588db
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
WIA_SDK_VERSION=0.1.1
WIA_SDK_VERSION=0.1.2
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export WIA_SDK_VERSION=0.1.1
export WIA_SDK_VERSION=0.1.2
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
WIA_SDK_VERSION=0.1.1
WIA_SDK_VERSION=0.1.2
PRODUCT_NAME=WiaSwift
3 changes: 2 additions & 1 deletion Sources/WiaSwift/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ open class Wia {
open var accessToken: String?
open var baseURL: String
open var spaceId: String?

open var currentUser: User?

public init(appKey: String? = nil,
clientKey: String? = nil,
accessToken: String? = nil,
Expand Down
18 changes: 18 additions & 0 deletions Tests/UserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,23 @@ class UserTests: XCTestCase {

waitForExpectations(timeout: 10.0, handler: nil)
}

func testRetrieveAndSetCurrentUser() {
let expectation = self.expectation(description: "Retrieve the currently authenticated user")

UserTests.client.retrieveUser(id: "me", onSuccess: { user in
expect(user).to(beAKindOf(User.self))
expect(user.id).toNot(beNil())
UserTests.client.currentUser = user
expectation.fulfill()
}, onFailure: { error in
expect(error).to(beAKindOf(WiaError.self))
fail("Error status code \(error.status!)")
expectation.fulfill()
})

waitForExpectations(timeout: 10.0, handler: nil)
}

}

0 comments on commit d4588db

Please sign in to comment.