/Source/externals/GData/Source/Clients/Books/GDataServiceGoogleBooks.m

http://google-email-uploader-mac.googlecode.com/ · Objective C · 88 lines · 46 code · 24 blank · 18 comment · 3 complexity · 7d2846c456c4d7402e3538b982c0d06c 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. // GDataServiceGoogleBooks.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE
  19. #define GDATASERVICEGOOGLEBOOKS_DEFINE_GLOBALS 1
  20. #import "GDataServiceGoogleBooks.h"
  21. #import "GDataQueryBooks.h"
  22. #import "GDataBookConstants.h"
  23. @implementation GDataServiceGoogleBooks
  24. + (NSURL *)booksURLForVolumeID:(NSString *)volumeID {
  25. NSString *rootURLStr = [self serviceRootURLString];
  26. NSString *urlStr;
  27. if (volumeID) {
  28. NSString *templateStr = @"%@users/me/volumes/%@";
  29. urlStr = [NSString stringWithFormat:templateStr, rootURLStr, volumeID];
  30. } else {
  31. // no volume ID, so return the volumes feed URL
  32. NSString *templateStr = @"%@users/me/volumes";
  33. urlStr = [NSString stringWithFormat:templateStr, rootURLStr];
  34. }
  35. return [NSURL URLWithString:urlStr];
  36. }
  37. + (NSURL *)booksURLForCollectionID:(NSString *)collectionID {
  38. NSString *rootURLStr = [self serviceRootURLString];
  39. NSString *templateStr = @"%@users/me/collections/%@/volumes";
  40. NSString *urlStr = [NSString stringWithFormat:templateStr,
  41. rootURLStr, collectionID];
  42. return [NSURL URLWithString:urlStr];
  43. }
  44. + (NSURL *)collectionsURL {
  45. NSString *rootURLStr = [self serviceRootURLString];
  46. NSString *templateStr = @"%@users/me/collections";
  47. NSString *urlStr = [NSString stringWithFormat:templateStr,
  48. rootURLStr];
  49. return [NSURL URLWithString:urlStr];
  50. }
  51. + (NSString *)serviceID {
  52. return @"print";
  53. }
  54. + (NSString *)serviceRootURLString {
  55. return @"http://books.google.com/books/feeds/";
  56. }
  57. + (NSString *)defaultServiceVersion {
  58. return kGDataBooksDefaultServiceVersion;
  59. }
  60. + (NSDictionary *)standardServiceNamespaces {
  61. return [GDataBookConstants booksNamespaces];
  62. }
  63. @end
  64. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE