blob: e8c76a25bc2c97da99bd2418c5482fb29dbbfcc2 [file] [log] [blame]
#!/usr/bin/python
#
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Data model for parsing and generating XML for the Google Apps Marketplace Licensing API."""
__author__ = 'Alexandre Vivien <alex@simplecode.fr>'
import atom.core
import gdata
import gdata.data
LICENSES_NAMESPACE = 'http://www.w3.org/2005/Atom'
LICENSES_TEMPLATE = '{%s}%%s' % LICENSES_NAMESPACE
class Enabled(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'enabled'
class Id(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'id'
class CustomerId(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'customerid'
class DomainName(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'domainname'
class InstallerEmail(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'installeremail'
class TosAcceptanceTime(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'tosacceptancetime'
class LastChangeTime(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'lastchangetime'
class ProductConfigId(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'productconfigid'
class State(atom.core.XmlElement):
""" """
_qname = LICENSES_TEMPLATE % 'state'
class Entity(atom.core.XmlElement):
""" The entity representing the License. """
_qname = LICENSES_TEMPLATE % 'entity'
enabled = Enabled
id = Id
customer_id = CustomerId
domain_name = DomainName
installer_email = InstallerEmail
tos_acceptance_time = TosAcceptanceTime
last_change_time = LastChangeTime
product_config_id = ProductConfigId
state = State
class Content(atom.data.Content):
entity = Entity
class LicenseEntry(gdata.data.GDEntry):
""" Represents a LicenseEntry object. """
content = Content
class LicenseFeed(gdata.data.GDFeed):
""" Represents a feed of LicenseEntry objects. """
# Override entry so that this feed knows how to type its list of entries.
entry = [LicenseEntry]