Skip to content

Commit

Permalink
Fix: ARTDefault.ttl in seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardopereira committed Jan 16, 2016
1 parent 0e003cd commit 1e330a7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ably-ios/ARTAuthTokenParams.m
Expand Up @@ -20,8 +20,8 @@ @implementation ARTAuthTokenParams

- (instancetype)init {
if (self = [super init]) {
_ttl = [ARTDefault ttl] * 60; //seconds
_timestamp = [NSDate date];
_ttl = [ARTDefault ttl];
_capability = @"{\"*\":[\"*\"]}"; // allow all
_clientId = nil;
}
Expand Down
4 changes: 2 additions & 2 deletions ably-ios/ARTDefault.h
Expand Up @@ -16,9 +16,9 @@
+ (int)TLSPort;

/**
Default in minutes of requested time to live for the token.
Default in seconds of requested time to live for the token.
*/
+ (double)ttl;
+ (NSTimeInterval)ttl;

+ (NSTimeInterval)connectTimeout; //Realtime

Expand Down
4 changes: 2 additions & 2 deletions ably-ios/ARTDefault.m
Expand Up @@ -29,8 +29,8 @@ + (int)TLSPort {
return 443;
}

+ (double)ttl {
return 60.0; //minutes
+ (NSTimeInterval)ttl {
return 60 * 60;
}

+ (NSTimeInterval)connectTimeout {
Expand Down
4 changes: 2 additions & 2 deletions ablySpec/Auth.swift
Expand Up @@ -742,11 +742,11 @@ class Auth : QuickSpec {

rest.auth.createTokenRequest(nil, options: nil, callback: { tokenRequest, error in
//In Seconds because TTL property is a NSTimeInterval but further it does the conversion to milliseconds
expect(tokenRequest?.ttl).to(equal(ARTDefault.ttl() * 60.0))
expect(tokenRequest?.ttl).to(equal(ARTDefault.ttl()))
})

let tokenParams = ARTAuthTokenParams()
expect(tokenParams.ttl).to(equal(ARTDefault.ttl() * 60.0))
expect(tokenParams.ttl).to(equal(ARTDefault.ttl()))

let expectedTtl = 10.0
tokenParams.ttl = expectedTtl
Expand Down

0 comments on commit 1e330a7

Please sign in to comment.