def __init__(self, **kwargs): self.name = fields.StringField(name='name') self.created_date = fields.DateField(name='created-date') self.created_datetime = fields.DatetimeField(name='created-datetime') self.tags = fields.ListField(name='tags', init_class=Tag) self.category = fields.ObjectField(name='category', init_class=Category) super().__init__(**kwargs)
def __init__(self, **kwargs): from highton.models import ( Tag, ContactData, SubjectData, ) self.author_id = fields.IntegerField(name=HightonConstants.AUTHOR_ID) self.background = fields.StringField(name=HightonConstants.BACKGROUND) self.created_at = fields.DatetimeField( name=HightonConstants.CREATED_AT) self.group_id = fields.IntegerField(name=HightonConstants.GROUP_ID) self.owner_id = fields.IntegerField(name=HightonConstants.OWNER_ID) self.updated_at = fields.DatetimeField( name=HightonConstants.UPDATED_AT) self.visible_to = fields.StringField(name=HightonConstants.VISIBLE_TO) self.linkedin_url = fields.StringField( name=HightonConstants.LINKEDIN_URL) self.avatar_url = fields.StringField(name=HightonConstants.AVATAR_URL) self.tags = fields.ListField(name=HightonConstants.TAGS, init_class=Tag) self.contact_data = fields.ObjectField( name=HightonConstants.CONTACT_DATA, init_class=ContactData) self.subject_datas = fields.ListField( name=HightonConstants.SUBJECT_DATAS, init_class=SubjectData) super().__init__(**kwargs)
def me(cls): """ Returns information about the currently authenticated user. :return: :rtype: User """ return fields.ObjectField(name=cls.ENDPOINT, init_class=cls).decode( cls.element_from_string( cls._get_request(endpoint=cls.ENDPOINT + '/me').text))
def __init__(self, **kwargs): """ Init a deal with the attributes :param kwargs: :type kwargs: """ from highton.models import ( Tag, ContactData, SubjectData, Party, AssociatedParty, Category, ) self.author_id = fields.IntegerField(name=HightonConstants.AUTHOR_ID) self.account_id = fields.IntegerField(name=HightonConstants.ACCOUNT_ID) self.background = fields.StringField(name=HightonConstants.BACKGROUND) self.category_id = fields.IntegerField(name=HightonConstants.CATEGORY_ID) self.created_at = fields.DatetimeField(name=HightonConstants.CREATED_AT) self.currency = fields.StringField(name=HightonConstants.CURRENCY) self.duration = fields.IntegerField(name=HightonConstants.DURATION) self.group_id = fields.IntegerField(name=HightonConstants.GROUP_ID) self.name = fields.StringField(name=HightonConstants.NAME) self.owner_id = fields.IntegerField(name=HightonConstants.OWNER_ID) self.party_id = fields.IntegerField(name=HightonConstants.PARTY_ID) self.price = fields.IntegerField(name=HightonConstants.PRICE) self.price_type = fields.StringField(name=HightonConstants.PRICE_TYPE) self.responsible_party_id = fields.IntegerField(name=HightonConstants.RESPONSIBLE_PARTY_ID) self.status = fields.StringField(name=HightonConstants.STATUS) self.status_changed_on = fields.DatetimeField(name=HightonConstants.STATUS_CHANGED_ON) self.updated_at = fields.DatetimeField(name=HightonConstants.UPDATED_AT) self.visible_to = fields.StringField(name=HightonConstants.VISIBLE_TO) self.party = fields.ObjectField(name=HightonConstants.PARTY, init_class=Party) self.category = fields.ObjectField(name=HightonConstants.CATEGORY, init_class=Category) self.tags = fields.ListField(name=HightonConstants.TAGS, init_class=Tag) self.parties = fields.ListField(name=HightonConstants.PARTIES, init_class=Party) self.contact_data = fields.ObjectField(name=HightonConstants.CONTACT_DATA, init_class=ContactData) self.subject_datas = fields.ListField(name=HightonConstants.SUBJECT_DATAS, init_class=SubjectData) self.associated_parties = fields.ListField(name=HightonConstants.ASSOCIATED_PARTIES, init_class=AssociatedParty) super().__init__(**kwargs)
def get(cls, object_id): """ Retrieves a single model :param object_id: the primary id of the model :type object_id: integer :return: the object of the parsed xml object :rtype: object """ return fields.ObjectField(name=cls.ENDPOINT, init_class=cls).decode( cls.element_from_string( cls._get_request(endpoint=cls.ENDPOINT + '/' + str(object_id)).text))