This repository has been archived by the owner on Aug 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
ORSTwitterEngine+HelpAndAccountAdditions.m
103 lines (89 loc) · 2.57 KB
/
ORSTwitterEngine+HelpAndAccountAdditions.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//
// ORSTwitterEngine+HelpAndAccountAdditions.m
// Twitter Engine
//
// Created by Nicholas Toumpelis on 12/04/2009.
// Copyright 2009 Ocean Road Software. All rights reserved.
//
// Version 0.7
#import "ORSTwitterEngine+HelpAndAccountAdditions.h"
@implementation ORSTwitterEngine ( HelpAndAccountAdditions )
#pragma mark Account methods
// Account methods
// specifies the user's location in their profile
- (BOOL) specifyLocation:(NSString *)location {
NSMutableString *path = [NSMutableString
stringWithString:@"account/update_location.xml?location="];
[path appendString:location];
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path
synchronously:synchronously]];
if ([[node name] isEqualToString:@"user"]) {
return YES;
} else {
return NO;
}
}
// updates the delivery device
- (BOOL) updateDeliveryDeviceWith:(NSString *)device {
NSMutableString *path = [NSMutableString
stringWithString:@"account/update_delivery_device.xml?device="];
[path appendString:device];
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"POST" atPath:path
synchronously:synchronously]];
if ([[node name] isEqualToString:@"user"]) {
return YES;
} else {
return NO;
}
}
// gets the rate limit status
- (NSXMLNode *) getRateLimitStatus {
NSString *path = @"account/rate_limit_status.xml";
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path
synchronously:synchronously]];
if (![[[node childAtIndex:0] name] isEqualToString:@"error"]) {
return node;
} else {
return NULL;
}
}
#pragma mark Help methods
// Help methods
// tests whether Twitter is active
- (BOOL) isTwitterOnline {
NSString *path = @"help/text.xml";
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path
synchronously:synchronously]];
if ([[node name] isEqualToString:@"ok"]) {
return YES;
} else {
return NO;
}
}
// gets Twitter error state
- (NSXMLNode *) getTwitterError {
NSString *path = @"help/text.xml";
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path synchronously:synchronously]];
if ([[node name] isEqualToString:@"ok"]) {
return NULL;
} else {
return node;
}
}
// gets Twitter downtime schedule
- (NSXMLNode *) getDowntimeSchedule {
NSString *path = @"help/downtime_schedule.xml";
NSXMLNode *node = [self getNodeFromData:[self
executeRequestOfType:@"GET" atPath:path synchronously:synchronously]];
if (![[[node childAtIndex:0] name] isEqualToString:@"error"]) {
return node;
} else {
return NULL;
}
}
@end