Skip to content

Commit

Permalink
add team stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Aikdanai Sidhikosol committed Oct 11, 2018
1 parent 648b82b commit 386c17f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
8 changes: 8 additions & 0 deletions AcrosureSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
27B432C9216F3227000852E1 /* AcrosurePolicyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B432C7216F3227000852E1 /* AcrosurePolicyManager.swift */; };
27B432CA216F3227000852E1 /* AcrosureDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B432C8216F3227000852E1 /* AcrosureDataManager.swift */; };
27B432CC216F3A90000852E1 /* AcrosureStructure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B432CB216F3A90000852E1 /* AcrosureStructure.swift */; };
27B432CE216F620E000852E1 /* AcrosureTeamManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B432CD216F620E000852E1 /* AcrosureTeamManager.swift */; };
27B432D0216F624C000852E1 /* AcrosureTeamTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B432CF216F624C000852E1 /* AcrosureTeamTests.swift */; };
4ABA03D15EC9B963533469A2 /* Pods_AcrosureSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBC25F03FAFE7716394D36F4 /* Pods_AcrosureSDK.framework */; };
58536F22052F982403BDCC0E /* Pods_AcrosureSDK_AcrosureSDKTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9F665C60DA05E78BE35375B /* Pods_AcrosureSDK_AcrosureSDKTests.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -53,6 +55,8 @@
27B432C7216F3227000852E1 /* AcrosurePolicyManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AcrosurePolicyManager.swift; sourceTree = "<group>"; };
27B432C8216F3227000852E1 /* AcrosureDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AcrosureDataManager.swift; sourceTree = "<group>"; };
27B432CB216F3A90000852E1 /* AcrosureStructure.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcrosureStructure.swift; sourceTree = "<group>"; };
27B432CD216F620E000852E1 /* AcrosureTeamManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcrosureTeamManager.swift; sourceTree = "<group>"; };
27B432CF216F624C000852E1 /* AcrosureTeamTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcrosureTeamTests.swift; sourceTree = "<group>"; };
3E988DBB0E6DE63E1F2B2B9F /* Pods-AcrosureSDK-AcrosureSDKTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AcrosureSDK-AcrosureSDKTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AcrosureSDK-AcrosureSDKTests/Pods-AcrosureSDK-AcrosureSDKTests.release.xcconfig"; sourceTree = "<group>"; };
50DAD3A9FC27C56C42A8651F /* Pods-AcrosureSDKTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AcrosureSDKTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AcrosureSDKTests/Pods-AcrosureSDKTests.release.xcconfig"; sourceTree = "<group>"; };
62AD2EFD7964F16D836848B1 /* Pods-AcrosureSDK.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AcrosureSDK.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AcrosureSDK/Pods-AcrosureSDK.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -115,6 +119,7 @@
27291C21216DD07100DC2ADA /* AcrosureSDK.h */,
27291C22216DD07100DC2ADA /* Info.plist */,
27B432CB216F3A90000852E1 /* AcrosureStructure.swift */,
27B432CD216F620E000852E1 /* AcrosureTeamManager.swift */,
);
path = AcrosureSDK;
sourceTree = "<group>";
Expand All @@ -129,6 +134,7 @@
27B432BD216E2641000852E1 /* AcrosureProductTests.swift */,
27B432C1216E3943000852E1 /* AcrosurePolicyTests.swift */,
27B432C3216E3F00000852E1 /* AcrosureDataTests.swift */,
27B432CF216F624C000852E1 /* AcrosureTeamTests.swift */,
);
path = AcrosureSDKTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -343,6 +349,7 @@
27B432C9216F3227000852E1 /* AcrosurePolicyManager.swift in Sources */,
27291C39216DD39700DC2ADA /* AcrosureClient.swift in Sources */,
27B432B8216E2486000852E1 /* AcrosureProductManager.swift in Sources */,
27B432CE216F620E000852E1 /* AcrosureTeamManager.swift in Sources */,
27B432CA216F3227000852E1 /* AcrosureDataManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -354,6 +361,7 @@
27B432B4216E0ADF000852E1 /* AcrosureApplicationTests.swift in Sources */,
27B432BE216E2641000852E1 /* AcrosureProductTests.swift in Sources */,
27B432C2216E3943000852E1 /* AcrosurePolicyTests.swift in Sources */,
27B432D0216F624C000852E1 /* AcrosureTeamTests.swift in Sources */,
27B432C4216E3F00000852E1 /* AcrosureDataTests.swift in Sources */,
27B432BA216E2607000852E1 /* constant.swift in Sources */,
27291C2D216DD07100DC2ADA /* AcrosureSDKTests.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions AcrosureSDK/AcrosureClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ class AcrosureClient {
var product: AcrosureProductManager
var policy: AcrosurePolicyManager
var data: AcrosureDataManager
var team: AcrosureTeamManager

init(token: String) {
self.api = AcrosureAPI(token: token)
self.application = AcrosureApplicationManager(api: self.api)
self.product = AcrosureProductManager(api: self.api)
self.policy = AcrosurePolicyManager(api: self.api)
self.data = AcrosureDataManager(api: self.api)
self.team = AcrosureTeamManager(api: self.api)
}

func setToken(token: String) {
Expand Down
26 changes: 26 additions & 0 deletions AcrosureSDK/AcrosureTeamManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// AcrosureTeamManager.swift
// AcrosureSDK
//
// Created by Aikdanai Sidhikosol on 11/10/2561 BE.
// Copyright © 2561 Acrosure. All rights reserved.
//

import Foundation
import Alamofire
import SwiftyJSON

class AcrosureTeamManager {
var api: AcrosureAPI

init(api: AcrosureAPI) {
self.api = api
}

func getInfo(callback: @escaping (AcrosureResponse) -> Void) {
return api.call(
path: "/teams/get-info"
) { resp in callback(resp) }
}
}

26 changes: 26 additions & 0 deletions AcrosureSDKTests/AcrosureTeamTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// AcrosureTeamTests.swift
// AcrosureSDKTests
//
// Created by Aikdanai Sidhikosol on 11/10/2561 BE.
// Copyright © 2561 Acrosure. All rights reserved.
//

import XCTest
@testable import AcrosureSDK

class AcrosureTeamTests: XCTestCase {
func testGetInfo() {
let client = AcrosureClient(token: TEST_PUBLIC_TOKEN)
let expectation = self.expectation(description: "Getting team info")
var result = AcrosureResponse()
client.team.getInfo { resp in
result = resp
expectation.fulfill()
}
waitForExpectations(timeout: 5) { (error) in
if let error = error { XCTFail("timeout errored: \(error)") }
XCTAssertEqual(result.status, "ok")
}
}
}

0 comments on commit 386c17f

Please sign in to comment.