Permalink
Browse files

Turn requiresAccessToken into a class method

Allows us to query a request class without actually constructing an instance of it.
  • Loading branch information...
1 parent a41fb2a commit fc751efbc6d6d1285c1da8da2ccaa857426e8b1f Brent Royal-Gordon committed Oct 25, 2012
Showing with 10 additions and 4 deletions.
  1. +2 −0 ANAuthenticatedRequest.h
  2. +5 −1 ANAuthenticatedRequest.m
  3. +1 −1 ANPostRequest.m
  4. +1 −1 ANPostsInGlobalStreamRequest.m
  5. +1 −1 ANPostsWithTagRequest.m
View
2 ANAuthenticatedRequest.h
@@ -12,6 +12,8 @@
@interface ANAuthenticatedRequest : ANRequest <NSMutableCopying>
++ (BOOL)requiresAccessToken;
+
@property (readonly,assign) BOOL requiresAccessToken;
@end
View
6 ANAuthenticatedRequest.m
@@ -21,10 +21,14 @@ - (id)mutableCopyWithZone:(NSZone *)zone {
return req;
}
-- (BOOL)requiresAccessToken {
++ (BOOL)requiresAccessToken {
return YES;
}
+- (BOOL)requiresAccessToken {
+ return self.class.requiresAccessToken;
+}
+
- (NSMutableURLRequest *)URLRequest {
NSMutableURLRequest * req = super.URLRequest;
View
2 ANPostRequest.m
@@ -22,7 +22,7 @@ - (ANRequestMethod)method {
return ANRequestMethodGet;
}
-- (BOOL)requiresAccessToken {
++ (BOOL)requiresAccessToken {
return NO;
}
View
2 ANPostsInGlobalStreamRequest.m
@@ -14,7 +14,7 @@ - (NSURL *)URL {
return [NSURL URLWithString:@"posts/stream/global" relativeToURL:[self.session URLForStreamAPIVersion:ANStreamAPIVersion0]];
}
-- (BOOL)requiresAccessToken {
++ (BOOL)requiresAccessToken {
return NO;
}
View
2 ANPostsWithTagRequest.m
@@ -14,7 +14,7 @@ - (NSURL *)URL {
return [NSURL URLWithString:[NSString stringWithFormat:@"posts/tag/%@", self.tag] relativeToURL:[self.session URLForStreamAPIVersion:ANStreamAPIVersion0]];
}
-- (BOOL)requiresAccessToken {
++ (BOOL)requiresAccessToken {
return NO;
}

0 comments on commit fc751ef

Please sign in to comment.