PageRenderTime 16ms CodeModel.GetById 1ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 1ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Books/GDataServiceGoogleBooks.m

http://macfuse.googlecode.com/
Objective C | 88 lines | 46 code | 24 blank | 18 comment | 3 complexity | 6cb1a37ad244aa8be1161c64fdf5c583 MD5 | raw file
 1/* Copyright (c) 2008 Google Inc.
 2 *
 3 * Licensed under the Apache License, Version 2.0 (the "License");
 4 * you may not use this file except in compliance with the License.
 5 * You may obtain a copy of the License at
 6 *
 7 *     http://www.apache.org/licenses/LICENSE-2.0
 8 *
 9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16//
17//  GDataServiceGoogleBooks.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE
21
22#define GDATASERVICEGOOGLEBOOKS_DEFINE_GLOBALS 1
23
24#import "GDataServiceGoogleBooks.h"
25#import "GDataQueryBooks.h"
26
27#import "GDataBookConstants.h"
28
29
30@implementation GDataServiceGoogleBooks
31
32+ (NSURL *)booksURLForVolumeID:(NSString *)volumeID {
33  
34  NSString *rootURLStr = [self serviceRootURLString];
35  NSString *urlStr;
36
37  if (volumeID) {
38    NSString *const templateStr = @"%@users/me/volumes/%@";
39    urlStr = [NSString stringWithFormat:templateStr, rootURLStr, volumeID];
40  } else {
41    // no volume ID, so return the volumes feed URL
42    NSString *const templateStr = @"%@users/me/volumes";
43    urlStr = [NSString stringWithFormat:templateStr, rootURLStr];
44  }
45  
46  return [NSURL URLWithString:urlStr];
47}
48
49+ (NSURL *)booksURLForCollectionID:(NSString *)collectionID {
50
51  NSString *rootURLStr = [self serviceRootURLString];
52
53  NSString *const templateStr = @"%@users/me/collections/%@/volumes";
54  NSString *urlStr = [NSString stringWithFormat:templateStr,
55                      rootURLStr, collectionID];
56
57  return [NSURL URLWithString:urlStr];
58}
59
60+ (NSURL *)collectionsURL {
61  NSString *rootURLStr = [self serviceRootURLString];
62
63  NSString *const templateStr = @"%@users/me/collections";
64  NSString *urlStr = [NSString stringWithFormat:templateStr,
65                      rootURLStr];
66
67  return [NSURL URLWithString:urlStr];
68}
69
70+ (NSString *)serviceID {
71  return @"print";
72}
73
74+ (NSString *)serviceRootURLString {
75  return @"http://books.google.com/books/feeds/";
76}
77
78+ (NSString *)defaultServiceVersion {
79  return kGDataBooksDefaultServiceVersion;
80}
81
82+ (NSDictionary *)standardServiceNamespaces {
83  return [GDataBookConstants booksNamespaces];
84}
85
86@end
87
88#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE