/
ActiveResource+Base.h
60 lines (50 loc) · 1.78 KB
/
ActiveResource+Base.h
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
//
// ActiveResourceBase.h
// medaxion
//
// Created by Ryan Daigle on 7/24/08.
// Copyright 2008 yFactorial, LLC. All rights reserved.
//
#import "ActiveResource.h"
@interface ActiveResource (Base)
// Resource configuration
+ (NSString *)getSite;
+ (void)setSite:(NSString*)siteURL;
+ (NSString *)getUser;
+ (void)setUser:(NSString *)user;
+ (NSString *)getPassword;
+ (void)setPassword:(NSString *)password;
+ (SEL)getParseDataMethod;
+ (void)setParseDataMethod:(SEL)parseMethod;
// Finders
+ (NSArray *)findAll;
+ (NSArray *)findAllWithResponse:(NSError **)aError;
+ (id)find:(NSString *)elementId;
+ (id)find:(NSString *)elementId withResponse:(NSError **)aError;
// URL construction accessors
+ (NSString *)elementName;
+ (NSString *)collectionName;
+ (NSString *)protocolExtension;
+ (NSString *)elementPath:(NSString *)elementId;
+ (NSString *)collectionPath;
+ (NSString *)collectionPathWithParameters:(NSDictionary *)parameters;
+ (NSString *)populatePath:(NSString *)path withParameters:(NSDictionary *)parameters;
// Instance-specific methods
- (id)getId;
- (NSString *)classIdName;
- (BOOL)create;
- (BOOL)createWithResponse:(NSError **)aError;
- (BOOL)createWithParameters:(NSDictionary *)parameters;
- (BOOL)createWithParameters:(NSDictionary *)parameters andResponse:(NSError **)aError;
- (BOOL)destroy;
- (BOOL)destroyWithResponse:(NSError **)aError;
- (BOOL)update;
- (BOOL)updateWithResponse:(NSError **)aError;
- (BOOL)save;
- (BOOL)saveWithResponse:(NSError **)aError;
- (BOOL)createAtPath:(NSString *)path withResponse:(NSError **)aError;
- (BOOL)updateAtPath:(NSString *)path withResponse:(NSError **)aError;
- (BOOL)destroyAtPath:(NSString *)path withResponse:(NSError **)aError;
// Instance helpers for getting at commonly used class-level values
- (NSString *)collectionPath;
@end