Permalink
Newer
Older
100644 39 lines (30 sloc) 1.18 KB
Aug 19, 2012
1
//
2
// ANAccessTokenInformationRequest.m
3
// AppNetKit
4
//
5
// Created by Brent Royal-Gordon on 8/18/12.
6
// Copyright (c) 2012 Architechies. See README.md for licensing information.
Aug 19, 2012
7
//
8
9
#import "ANAccessTokenInformationRequest.h"
10
#import "ANUser.h"
11
12
@implementation ANAccessTokenInformationRequest
13
14
- (NSURL *)URL {
15
return [NSURL URLWithString:@"token" relativeToURL:[self.session URLForStreamAPIVersion:ANStreamAPIVersion0]];
16
}
17
18
- (NSDictionary *)parameters {
19
return nil;
20
}
21
22
- (ANRequestMethod)method {
23
return ANRequestMethodGet;
24
}
25
26
- (void)sendRequestWithCompletion:(ANAccessTokenInformationRequestCompletion)completion {
27
[self sendRequestWithRepresentationCompletion:^(ANResponse * response, id rep, NSError *error) {
28
NSArray * scopes = [rep objectForKey:@"scopes"];
29
NSDictionary * userRep = [rep objectForKey:@"user"];
Aug 19, 2012
30
31
// This isn't *quite* the same as any of the normal completions, but there are ways around that...
32
[self.session completeUserRequest:^(ANResponse * response, ANUser *user, NSError *error) {
33
completion(response, scopes, user, error);
34
} withResponse:response representation:userRep error:error];
Aug 19, 2012
35
}];
36
}
37
38
@end