Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protected to the settings model #57

Merged
merged 1 commit into from
Sep 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/Model/Card/CardSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public class CardSettings: Mappable {
/// The position of the card.
public private(set) final var position: Int?

/// A boolean indicating if the card is protected.
public private(set) final var protected: Bool?

/// A boolean indicating if the card is starred.
public private(set) final var starred: Bool?

Expand Down Expand Up @@ -38,6 +41,7 @@ public class CardSettings: Mappable {
*/
public func mapping(map: Map) {
position <- map["position"]
protected <- map["protected"]
starred <- map["starred"]
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/Integration/Model/CardTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CardTest: UpholdTestCase {
"\"lastTransactionAt\": \"foobiz\"," +
"\"settings\": {" +
"\"position\": 4," +
"\"protected\": true," +
"\"starred\": true" +
"}," +
"\"addresses\": [{" +
Expand Down Expand Up @@ -47,6 +48,7 @@ class CardTest: UpholdTestCase {
XCTAssertEqual(card!.normalized![0].balance!, "99.04", "Failed: Balance didn't match.")
XCTAssertEqual(card!.normalized![0].currency!, "USD", "Failed: Currency didn't match.")
XCTAssertEqual(card!.settings!.position!, 4, "Failed: Position didn't match.")
XCTAssertTrue(card!.settings!.protected!, "Failed: Protected didn't match.")
XCTAssertTrue(card!.settings!.starred!, "Failed: Starred didn't match.")
}

Expand Down