コード例 #1
0
ファイル: models.py プロジェクト: vadfabi/aiohttp-demo
class User(Model):
    id = types.UUIDType(required=False)
    name = types.StringType(required=False)
    email = EmailType(required=True)
    created_at = types.DateTimeType(required=False)
    updated_at = types.DateTimeType(required=False)
    deleted_at = types.DateTimeType(required=False)
    profile = types.DictType(types.StringType, default={}, required=False)
コード例 #2
0
class FromQueue(models.Model):
    '''
        from a ACD Queue
    '''
    queue_name = types.StringType()
    on_queue_duration = types.IntType()
    with_agent_duration = types.IntType()
    enter_time = types.DateTimeType()
    answer_time = types.DateTimeType()
    hangup_time = types.DateTimeType()
コード例 #3
0
class HashOnlyModel(DynamoDBModel):
    TABLE_NAME = 'hash_only'

    agency_subdomain = fields.StringType(required=True)
    external_id = fields.IntType()
    name = fields.StringType()
    is_enabled = fields.BooleanType()

    created = fields.DateTimeType(default=DynamoDBModel.utcnow)
    updated = fields.DateTimeType(default=DynamoDBModel.utcnow)

    non_field_class_attr = "This string should not be saved"
コード例 #4
0
class Password(models.Model):
    '''
        Password
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    assigned = types.BooleanType(default=False)
    password = types.StringType()
    raw = types.StringType()
    md5 = types.StringType()
    sha1 = types.StringType()
    sha256 = types.StringType()
    sha384 = types.StringType()
    sha512 = types.StringType()
    created_at = types.DateTimeType()
    last_modified = types.DateTimeType()
コード例 #5
0
ファイル: games.py プロジェクト: spacebeam/bw
class Game(models.Model):
    '''
        Game Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    game = types.IntType(required=True)
    status = types.StringType(
        choices=['new', 'starting', 'in-progress', 'completed', 'deleted'],
        default='new')
    labels = types.DictType(types.StringType)
    history = compound.ListType(types.StringType())
    address = types.IPAddressType()
    session = types.UUIDType()
    bots = types.StringType(required=True)
    map = types.StringType(required=True)
    replay = types.StringType()
    home = types.StringType()
    home_is_winner = types.BooleanType(default=False)
    home_crashed = types.BooleanType(default=False)
    home_timed_out = types.BooleanType(default=False)
    home_building_score = types.IntType()
    home_razing_score = types.IntType()
    home_unit_score = types.IntType()
    away = types.StringType()
    away_is_winner = types.BooleanType(default=False)
    away_crashed = types.BooleanType(default=False)
    away_timed_out = types.BooleanType(default=False)
    away_building_score = types.IntType()
    away_razing_score = types.IntType()
    away_unit_score = types.IntType()
    created_by = types.UUIDType()
    created_at = types.DateTimeType(default=datetime.datetime.utcnow)
    last_update_by = types.UUIDType()
    last_update_at = types.TimestampType()
コード例 #6
0
class WeatherReport(Model):
    """Some sample class for Weather report"""
    city = types.StringType(max_length=50, metadata={'readOnly': True})
    temperature = types.DecimalType(required=True)
    taken_at = types.DateTimeType(default=datetime.datetime.now)
    author = types.EmailType()
    some_url = types.URLType()
コード例 #7
0
class Plan(BaseModel):
    title = types.StringType(default='default')
    ends_at = types.DateTimeType(default=datetime.now)

    @serializable
    def is_expired(self):
        return self.ends_at < datetime.now()
コード例 #8
0
ファイル: reports.py プロジェクト: jh3rnand3z/mango
class BaseHistory(models.Model):
    '''
        base history

        Scopes: accounts, numbers
    '''
    uuid = types.UUIDType(default=_id.uuid4)
    record_uuid = types.UUIDType(default=_id.uuid4)
    ban = types.UUIDType(default=_id.uuid4)  # 'billing account number'
    country_number = types.IntType()
    number = types.StringType()
    campaign_uuid = types.UUIDType(default=_id.uuid4)
    start_time = types.DateTimeType()
    caller_id = types.StringType()
    caller_id_name = types.StringType()
    origin_number = types.StringType()
    origin_city = types.StringType()
    origin_state = types.StringType()
    origin_province = types.StringType()
    destination_type = types.IntType()
    destination_contry_code = types.StringType()
    destination_number = types.StringType()
    destination_city = types.StringType()
    destination_state = types.StringType()
    duration = types.IntType()
    duration_unrounded = types.IntType()
    cost = types.IntType()
    special_rate = types.IntType()
    lead_type = types.IntType()
    web_call = types.BooleanType(default=False)
コード例 #9
0
class Payment(models.Model):
    '''
        Payment structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)

    account = types.StringType(required=True)
    credit_card_type = types.StringType(required=False)

    merchant = types.StringType()

    address = types.StringType()

    phone = types.StringType()

    email = types.EmailType()
    
    card_name = types.StringType()

    amount_funds = types.StringType() 
    
    credit_card_number = types.StringType()
    credit_card_cvc = types.StringType()

    exp_month = types.StringType()
    exp_year = types.StringType()

    CustomerToken = types.StringType(default='None')

    Status = compound.ModelType(Status)
    Transaction = compound.ModelType(Transaction)
    AuthorizationNum = types.IntType(default=__None_Id__)

    created = types.DateTimeType(default=arrow.utcnow().naive)
コード例 #10
0
ファイル: tasks.py プロジェクト: jh3rnand3z/mango
class SimpleEntry(models.Model):
    '''
        Simple comment Entry
    '''
    count = types.IntType()
    account = types.StringType()
    comment = types.StringType()
    created = types.DateTimeType(default=arrow.utcnow().naive)
コード例 #11
0
class CameraValidator(Model):
    T = types.DateTimeType(required=True)
    name = types.StringType(required=True)
    link = types.URLType(required=True)
    price = types.NumberType(required=True, min_value=1)
    spider = types.StringType(required=True, min_length=1)
    uid = types.StringType()
    ean = types.StringType()
    mfr = types.StringType()
コード例 #12
0
class TestModel(models.Model):
    __redis_client__ = client
    __expire__ = 120

    pk = types.StringType()
    id = types.IntType(required=True)
    name = types.StringType()
    created = types.DateTimeType()
    good_number = types.IntType()
コード例 #13
0
 class Schema:
     foo = types.StringType(required=True)
     bar = types.StringType(required=True)
     baz = types.StringType(required=True)
     count = types.IntType()
     child = compound.DictType(types.StringType)
     things = compound.ListType(types.BaseType)
     when = types.DateTimeType()
     created = DynamoTimestampType()
コード例 #14
0
ファイル: companies.py プロジェクト: jh3rnand3z/extractor
class Company(models.Model):
    '''
        Company Object Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    state_province = types.StringType()
    incorporated_state_province = types.StringType()
    fax = types.StringType()
    vat_tax_id_file_number = types.StringType()
    incorporated_number = types.StringType()
    zip_postal = types.StringType()
    dba = types.StringType()
    federal_tax_id = types.StringType()
    incoportated_country = types.StringType()
    telephone = types.StringType()
    city_town = types.StringType()
    country_company = types.StringType()
    subsidiary_reg_num = types.StringType()
    company_name = types.StringType()
    company_email = types.StringType()
    account_type = types.StringType()
    password = types.StringType()
    subsidiary_name = types.StringType()
    email = types.StringType()
    street_address = types.StringType()
    incorporated_address = types.StringType()

    status = types.StringType()
    account = types.StringType()

    checked = types.BooleanType(default=False)
    checked_by = types.StringType()

    #details = compound.ModelType(Log)
    #comments = compound.ModelType(Comment)

    created = types.DateTimeType(default=arrow.utcnow().naive)
    #created_at = types.DateTimeType()
    last_modified = types.DateTimeType()
    updated_by = types.DateTimeType()
    updated_at = types.DateTimeType()

    uri = types.StringType()
コード例 #15
0
class Payment(models.Model):
    id = types.StringType()
    payee_payment_reference = types.StringType(serialized_name='payeePaymentReference')
    payment_reference = types.StringType(serialized_name='paymentReference')
    callback_url = types.URLType(serialized_name='callbackUrl')
    payer_alias = types.StringType(serialized_name='payerAlias')
    payee_alias = types.StringType(serialized_name='payeeAlias')
    amount = types.FloatType()
    currency = types.StringType()
    message = types.StringType()
    status = types.StringType()
    date_created = types.DateTimeType(serialized_name='dateCreated')
    date_paid = types.DateTimeType(serialized_name='datePaid')
    location = types.URLType()
    request_token = types.StringType()
    error_code = types.StringType(serialized_name='errorCode')
    error_message = types.StringType(serialized_name='errorMessage')

    class Options:
        serialize_when_none = False
コード例 #16
0
class Refund(models.Model):
    id = types.StringType()
    original_payment_reference = types.StringType(serialized_name='originalPaymentReference')
    amount = types.FloatType()
    currency = types.StringType()
    message = types.StringType()
    payer_alias = types.StringType(serialized_name='payerAlias')
    payee_alias = types.StringType(serialized_name='payeeAlias')
    callback_url = types.URLType(serialized_name='callbackUrl')
    payer_payment_reference = types.StringType(serialized_name='payerPaymentReference')
    payment_reference = types.StringType(serialized_name='paymentReference')
    status = types.StringType()
    date_created = types.DateTimeType(serialized_name='dateCreated')
    date_paid = types.DateTimeType(serialized_name='datePaid')
    location = types.URLType()
    error_code = types.StringType(serialized_name='errorCode')
    error_message = types.StringType(serialized_name='errorMessage')
    additional_information = types.StringType(serialized_name='additionalInformation')

    class Options:
        serialize_when_none = False
コード例 #17
0
ファイル: tasks.py プロジェクト: jh3rnand3z/mango
class ModifyTask(models.Model):
    '''
        Modify task

        This model is similar to Task.

        It lacks of require and default values on it's fields.

        The reason of it existence is that we need to validate
        every input data that came from outside the system, with 
        this we prevent users from using PATCH to create fields 
        outside the scope of the resource.
    '''
    uuid = types.UUIDType()
    title = types.StringType()
    first_name = types.StringType()
    last_name = types.StringType()
    description = types.StringType()
    label = types.StringType()
    category = types.StringType()
    email = types.StringType()
    account = types.StringType()
    accountcode = types.StringType()
    userfield = types.StringType()
    assigned = types.BooleanType()
    checked = types.BooleanType()
    public = types.BooleanType()
    source = types.StringType()
    destination = types.StringType()
    channel = types.StringType()
    source_channel = types.StringType()
    context = types.StringType()
    destination_context = types.StringType()
    destination_number = types.StringType()
    destination_channel = types.StringType()
    start = types.DateTimeType()
    answer = types.DateTimeType()
    end = types.DateTimeType()
    duration = types.IntType()
    billsec = types.IntType()
    billing = types.IntType()
    rate = types.IntType()
    disposition = types.StringType()
    status = types.StringType()
    priority = types.StringType()
    severity = types.StringType()
    checked = types.BooleanType()
    checked_by = types.StringType()
    created = types.DateTimeType()
    comments = compound.ModelType(Comment)
    last_modified = types.DateTimeType()
    updated_by = types.StringType()
    updated_at = types.DateTimeType()
    uri = types.StringType()
コード例 #18
0
class SchematicsFieldsModel(BaseModel):
    # base fields
    type_string = types.StringType()
    type_int = types.IntType()
    type_uuid = types.UUIDType()
    type_IPv4 = types.IPv4Type()
    type_url = types.URLType()
    type_email = types.EmailType()
    type_number = types.NumberType(int, "integer")
    type_int = types.IntType()
    type_long = types.LongType()
    type_float = types.FloatType()
    type_decimal = types.DecimalType()
    type_md5 = types.MD5Type()
    type_sha1 = types.SHA1Type()
    type_boolean = types.BooleanType()
    type_date = types.DateType()
    type_datetime = types.DateTimeType()
    type_geopoint = types.GeoPointType()
    # type_multilingualstring = types.MultilingualStringType(default_locale='localized_value')

    # compound fields
    type_list = compound.ListType(types.StringType)
    type_dict = compound.DictType(
        types.IntType)  # dict values can be only integers
    type_list_of_dict = compound.ListType(compound.DictType,
                                          compound_field=types.StringType)
    type_dict_of_list = compound.DictType(compound.ListType,
                                          compound_field=types.IntType)
    type_model = compound.ModelType(NestedModel)
    type_list_model = compound.ListType(compound.ModelType(NestedModel))

    # reference fields
    type_ref_simplemodel = ModelReferenceType(SimpleModel)
    type_ref_usermodel = ModelReferenceType(User)

    class Options:
        # namespace = 'st'
        collection = 'st'
        serialize_when_none = False
コード例 #19
0
ファイル: models.py プロジェクト: VitaliiFisenko95/StolenCars
class Car(Model):
    _id = ObjectIdType(metadata={'readOnly': True})
    created_at = types.DateTimeType(metadata={'readOnly': True})
    updated_at = types.DateTimeType(metadata={'readOnly': True})
    vin = types.StringType()
    color = types.StringType()
    name = types.StringType()
    car_number = types.StringType()
    model = types.StringType()
    make = types.StringType()
    production_year = types.StringType()
    status = types.StringType(choices={'active', 'deleted'}, default='active')

    def _on_production_year_set(self, value):
        if not value:
            return
        try:
            datetime.strptime(value, '%Y')
        except ValueError:
            raise DataError({'production_year': "productionYear should match pattern '%Y'"})

    def _on_make_set(self, value):
        if not value:
            return
        if not value.isupper():
            raise DataError({'make': 'make should be uppercase'})

    def _on_model_set(self, value):
        if not value:
            return
        if not value.isupper():
            raise DataError({'model': 'model should be uppercase'})

    def update_car(self, data):
        if self.status == 'deleted':
            raise errors.ForbiddenStatusError(self._id)
        if 'status' in data:
            raise DataError({'status': "Can not be set with this endpoint. "
                                       "Please use /api/cars/:obj_id/status"})
        if 'vin' in data:
            raise DataError({'vin': "Can not be set with this endpoint. "
                                    "Please use /api/cars/:obj_id/vin"})
        self.import_data(data)

    def update_car_vin(self, data):
        if self.status == 'deleted':
            raise errors.ForbiddenStatusError(self._id)
        vin = data.pop('vin')
        if data:
            raise DataError({'vin': "This is the only field that can be updated with this endpoint"})
        if not isinstance(vin, str):
            raise DataError({'vin': f"Value must be string, but found {type(vin).__name__}"})
        self.import_data({'vin': vin})

    def update_status(self, data):
        if self.status == 'deleted':
            raise errors.ForbiddenStatusError(self._id)
        status = data.pop('status')
        if data:
            raise DataError({'status': "This is the only field that can be updated with this endpoint"})
        if not isinstance(status, str):
            raise DataError({'status': f"Value must be string, but found {type(status).__name__}"})
        self.import_data({'status': status})
コード例 #20
0
ファイル: schema.py プロジェクト: smaggs/wistiapy
class Project(models.Model):
    """Wrapper for project results."""

    id = types.IntType(
        required=True,
        metadata=dict(
            description="A unique numeric identifier for the project within the system."
        ),
    )
    name = types.StringType(
        required=True, metadata=dict(description="The project's display name.")
    )
    hashed_id = types.StringType(
        required=True,
        metadata=dict(
            description=(
                "A private hashed id, uniquely identifying the project within the"
                "system. Used for playlists and RSS feeds"
            )
        ),
    )
    media_count = types.IntType(
        required=True,
        default=0,
        serialized_name="mediaCount",
        metadata=dict(
            description="The number of different medias that have been uploaded to the project."
        ),
    )
    created = types.DateTimeType(
        required=True,
        serialized_format=DATETIME_FORMAT,
        metadata=dict(description="The date that the project was originally created."),
    )
    updated = types.DateTimeType(
        required=True,
        serialized_format=DATETIME_FORMAT,
        metadata=dict(description="The date that the project was last updated"),
    )
    anonymous_can_upload = types.BooleanType(
        required=True,
        serialized_name="anonymousCanUpload",
        metadata=dict(
            description=(
                "A boolean indicating whether or not anonymous uploads are enabled for the project"
            )
        ),
    )
    anonymous_can_download = types.BooleanType(
        required=True,
        serialized_name="anonymousCanDownload",
        metadata=dict(
            description=(
                "A boolean indicating whether or not anonymous downloads are enabled for this project"
            )
        ),
    )
    public = types.BooleanType(
        required=True,
        metadata=dict(
            description=(
                "A boolean indicating whether the project is available for public (anonymous) viewing"
            )
        ),
    )
    public_id = types.StringType(
        required=False,
        serialized_name="publicId",
        metadata=dict(
            description=(
                "If the project is public, this field contains a string representing the "
                "ID used for referencing the project in public URLs"
            )
        ),
    )
    medias = types.ListType(
        types.ModelType(Media),
        required=False,  # Not present in lists of Projects
        serialize_when_none=False,
        metadata=dict(description="A list of the media associated with a project"),
    )
コード例 #21
0
ファイル: schema.py プロジェクト: smaggs/wistiapy
class Media(models.Model):
    """ Wrapper for Wistia Media results """

    id = types.IntType(
        required=True,
        metadata=dict(
            description="A unique numeric identifier for the media within the system."
        ),
    )
    name = types.StringType(
        required=True, metadata=dict(description="The display name of the media.")
    )
    hashed_id = types.StringType(
        required=True,
        metadata=dict(description="A unique alphanumeric identifier for this media."),
    )
    description = types.StringType(
        required=True,
        metadata=dict(
            description=(
                "A description for the media which usually appears near the top of the"
                "sidebar on the media’s page"
            )
        ),
    )
    project = types.ModelType(
        ProjectReference,
        required=False,
        metadata=dict(
            description="Information about the project in which the media resides"
        ),
    )
    type = types.StringType(
        required=True,
        metadata=dict(description="A string representing what type of media this is"),
        choices=[
            "Video",
            "Image",
            "Audio",
            "Swf",
            "MicrosoftOfficeDocument",
            "PdfDocument",
            "UnknownType",
        ],
    )
    status = types.StringType(
        required=True,
        default="ready",
        metadata=dict(description="Post upload processing status"),
        choices=["queued", "processing", "ready", "failed"],
    )
    progress = types.FloatType(
        required=False,
        default=1.0,
        metadata=dict(
            description=(
                "(optional) After a file has been uploaded to Wistia, it needs to be"
                "processed before it is available for online viewing. This field is"
                "a floating point value between 0 and 1 that indicates the progress of"
                "that processing."
            )
        ),
    )
    section = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(
            description=(
                "(optional) The title of the section in which the media appears."
                "This attribute is omitted if the media is not in a section (default)."
            )
        ),
    )
    thumbnail = types.ModelType(
        Thumbnail,
        required=True,
        metadata=dict(
            description="An object representing the thumbnail for this media"
        ),
    )
    duration = types.FloatType(
        required=False,
        metadata=dict(
            description=(
                "(optional) For Audio or Video files, this field specifies the length"
                "(in seconds). For Document files, this field specifies the number of"
                "pages in the document. For other types of media, or if the duration"
                "is unknown, this field is omitted."
            )
        ),
    )
    created = types.DateTimeType(
        required=True,
        serialized_format=DATETIME_FORMAT,
        metadata=dict(description="The date when the media was originally uploaded."),
    )
    updated = types.DateTimeType(
        required=True,
        serialized_format=DATETIME_FORMAT,
        metadata=dict(description="The date when the media was last changed."),
    )
    assets = types.ListType(
        types.ModelType(Asset),
        required=False,
        metadata=dict(description="An array of the assets available for this media"),
    )
    embed_code = types.StringType(
        serialized_name="embedCode",
        required=False,
        metadata=dict(
            description=r"""
            DEPRECATED
            The HTML code that would be used for embedding the media into a web page.
            Please note that in JSON format, all quotes are escaped with a
            backslash (\) character. In XML, angle brackets (< and >) and
            ampersands (&) are converted to their equivalent XML entities
            ("&lt;", "&gt;", and "&amp;" respectively) to prevent XML parser errors.
            """
        ),
    )
コード例 #22
0
ファイル: defs.py プロジェクト: ofw/pong
class SaveItemIn(Model):

    tz_offset = UpdateItemIn.tz_offset
    what = UpdateItemIn.what
    when = t.DateTimeType(required=False)
コード例 #23
0
ファイル: defs.py プロジェクト: ofw/pong
class UpdateItemIn(Model):

    tz_offset = t.IntType(required=True)
    uid = t.StringType(required=True)
    what = t.StringType(required=True, max_length=255)
    when = t.DateTimeType(required=True)
コード例 #24
0
class WeatherStats(Model):
    last_report = types.ModelType(WeatherReport)
    prev_reports = types.ListType(types.ModelType(WeatherReport))
    date_list = types.ListType(types.DateTimeType())
コード例 #25
0
ファイル: tasks.py プロジェクト: jh3rnand3z/mango
class Task(models.Model):
    '''
        Task Object Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)

    title = types.StringType()

    first_name = types.StringType()
    last_name = types.StringType()
    description = types.StringType()
    
    label = types.StringType()
    
    category = types.StringType()

    email = types.StringType()
    
    account = types.StringType()
    accountcode = types.StringType()
    userfield = types.StringType()
    
    assigned = types.BooleanType(default=False)
    checked = types.BooleanType(default=False)

    public = types.BooleanType(default=False)

    source = types.StringType()
    destination = types.StringType()
    
    channel = types.StringType()
    source_channel = types.StringType()
    
    context = types.StringType()
    
    destination_context = types.StringType()

    destination_number = types.StringType()
   
    destination_channel = types.StringType()
    
    start = types.DateTimeType()
    answer = types.DateTimeType()
    end = types.DateTimeType()

    duration = types.IntType()
    billsec = types.IntType()
    billing = types.IntType()
    rate = types.IntType()

    disposition = types.StringType()
    status = types.StringType(choices=['now',
                                       'later',
                                       'done'],
                              default='now',
                              required=True)
    
    priority = types.StringType(choices=['small',
                                       'medium',
                                       'hight'],
                              default='small',
                              required=True)
    
    severity = types.StringType(choices=['info',
                                       'warning',
                                       'error'],
                              default='info',
                              required=True)

    checked = types.BooleanType(default=False)
    checked_by = types.StringType()
    
    created = types.DateTimeType(default=arrow.utcnow().naive)
    created_at = types.DateTimeType(default=arrow.utcnow().naive)

    comments = compound.ModelType(Comment)

    last_modified = types.DateTimeType()
    updated_by = types.StringType()
    updated_at = types.DateTimeType()

    uri = types.StringType()
コード例 #26
0
ファイル: models.py プロジェクト: franagustin/bori-models
class MutedMember(MongoModel):
    guild_id = types.IntType(required=True)
    user_id = types.IntType(required=True)
    start_time = types.DateTimeType()
    end_time = types.DateTimeType(required=True)
    duration = types.IntType()
コード例 #27
0
class Record(models.Model):
    '''
        Record Object Data Structure
    '''
    uuid = types.UUIDType(default=uuid.uuid4)
    uniqueid = types.StringType()

    callerid = types.StringType()

    account = types.StringType()
    accountcode = types.StringType()
    userfield = types.StringType()

    queue = compound.ModelType(FromQueue)

    assigned = types.BooleanType(default=False)
    checked = types.BooleanType(default=False)

    public = types.BooleanType(default=False)

    source = types.StringType()
    destination = types.StringType()

    channel = types.StringType()
    source_channel = types.StringType()

    context = types.StringType()

    destination_context = types.StringType()

    destination_number = types.StringType()

    destination_channel = types.StringType()

    strdate = types.StringType()

    start = types.DateTimeType()
    answer = types.DateTimeType()
    end = types.DateTimeType()

    duration = types.IntType()
    seconds = types.IntType()
    minutes = types.IntType()
    billsec = types.IntType()
    billing = types.IntType()

    disposition = types.StringType()
    status = types.StringType()

    amaflags = types.StringType()

    lastapp = types.StringType()
    lastdata = types.StringType()

    recorded = types.BooleanType(default=False)
    record_uri = types.StringType()

    checked = types.BooleanType(default=False)
    checked_by = types.StringType()

    #details = compound.ModelType(Log)
    #comments = compound.ModelType(Comment)

    created = types.DateTimeType(default=arrow.utcnow().naive)
    #created_at = types.DateTimeType()
    last_modified = types.DateTimeType()
    updated_by = types.DateTimeType()
    updated_at = types.DateTimeType()

    uri = types.StringType()
コード例 #28
0
class Event(models.Model):
    received_at = types.DateTimeType(
        required=True,
        serialized_format=DATETIME_FORMAT,
        metadata=dict(description="The date time that the event happened.")
    )

    event_key = types.StringType(
        required=True,
        serialize_when_none=True,
        metadata=dict(description="The ID for that event.")
    )

    visitor_key = types.StringType(
        required=True,
        serialize_when_none=True,
        metadata=dict(description="The id of the visitor, which can be used to"
                                "retrieve further information about them.")
    )

    embed_url = types.StringType(
        required=True,
        serialize_when_none=False,
        metadata=dict(description="The URL of the page where the video was used.")
    )

    percent_viewed = types.FloatType(
        required=False,
        metadata=dict(description="The decimal number denoting how much of the"
                            "video was watched during this session (0 to 1).")
    )

    ip = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="The viewer's IP address.")
    )

    org = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="The organization that the IP address belongs to.")
    )

    country = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="The viewer’s country, based on IP.")
    )

    region = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="The viewer’s region, based on IP.")
    )

    city = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="The viewer's city, based on IP.")
    )

    lat = types.FloatType(
        required=False,
        metadata=dict(description="The latitude of the viewer’s IP.")
    )

    lon = types.FloatType(
        required=False,
        metadata=dict(description="The longitude of the viewer’s IP.")
    )

    email = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="The viewer’s email address, if available.")
    )

    media_id = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="An identifier indicating which video was watched.")
    )

    media_url = types.StringType(
        required=False,
        serialize_when_none=False,
        metadata=dict(description="An identifier indicating which video was watched.")
    )