/gdata/books/data.py

http://radioappz.googlecode.com/ · Python · 90 lines · 41 code · 25 blank · 24 comment · 0 complexity · fbe61870f115641adda03bcee01a33a2 MD5 · raw file

  1. #!/usr/bin/python
  2. #
  3. # Copyright (C) 2009 Google Inc.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. """Contains the data classes of the Google Book Search Data API"""
  17. __author__ = 'j.s@google.com (Jeff Scudder)'
  18. import atom.core
  19. import atom.data
  20. import gdata.data
  21. import gdata.dublincore.data
  22. import gdata.opensearch.data
  23. GBS_TEMPLATE = '{http://schemas.google.com/books/2008/}%s'
  24. class CollectionEntry(gdata.data.GDEntry):
  25. """Describes an entry in a feed of collections."""
  26. class CollectionFeed(gdata.data.BatchFeed):
  27. """Describes a Book Search collection feed."""
  28. entry = [CollectionEntry]
  29. class Embeddability(atom.core.XmlElement):
  30. """Describes an embeddability."""
  31. _qname = GBS_TEMPLATE % 'embeddability'
  32. value = 'value'
  33. class OpenAccess(atom.core.XmlElement):
  34. """Describes an open access."""
  35. _qname = GBS_TEMPLATE % 'openAccess'
  36. value = 'value'
  37. class Review(atom.core.XmlElement):
  38. """User-provided review."""
  39. _qname = GBS_TEMPLATE % 'review'
  40. lang = 'lang'
  41. type = 'type'
  42. class Viewability(atom.core.XmlElement):
  43. """Describes a viewability."""
  44. _qname = GBS_TEMPLATE % 'viewability'
  45. value = 'value'
  46. class VolumeEntry(gdata.data.GDEntry):
  47. """Describes an entry in a feed of Book Search volumes."""
  48. comments = gdata.data.Comments
  49. language = [gdata.dublincore.data.Language]
  50. open_access = OpenAccess
  51. format = [gdata.dublincore.data.Format]
  52. dc_title = [gdata.dublincore.data.Title]
  53. viewability = Viewability
  54. embeddability = Embeddability
  55. creator = [gdata.dublincore.data.Creator]
  56. rating = gdata.data.Rating
  57. description = [gdata.dublincore.data.Description]
  58. publisher = [gdata.dublincore.data.Publisher]
  59. date = [gdata.dublincore.data.Date]
  60. subject = [gdata.dublincore.data.Subject]
  61. identifier = [gdata.dublincore.data.Identifier]
  62. review = Review
  63. class VolumeFeed(gdata.data.BatchFeed):
  64. """Describes a Book Search volume feed."""
  65. entry = [VolumeEntry]