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()
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)
class BaseAccount(models.Model): ''' Base account ''' uuid = types.UUIDType(default=uuid.uuid4) passwords = compound.ListType(compound.ModelType(Password)) # api samples, remove after finish work on passwords or otherwise secret keys. api_key = types.StringType(required=False) # api_keys = compound.ListType(compound.ModelType(Mon)) # system admin account is_admin = types.BooleanType(default=False) active = types.BooleanType(default=True) account = types.StringType(required=True) name = types.StringType(required=False) email = types.EmailType(required=True) phone_number = types.StringType() country_code = types.StringType() timezone = types.StringType() location = types.StringType() resources = compound.ModelType(Resource) routes = compound.ListType(compound.ModelType(Route)) uri = types.StringType(required=False) url = types.URLType() # move this to howler and spider? max_channels = types.IntType()
class RequiredBase(models.Model): ''' Very self explanatory ''' status = types.StringType(required=False) account = types.StringType(required=True) role = types.StringType(required=False) email = types.EmailType(required=True) phone_number = types.StringType() extension = types.StringType() country_code = types.StringType() timezone = types.StringType() affiliation = types.StringType() location = types.StringType() phones = compound.ListType(compound.ModelType(Phone)) emails = compound.ListType(compound.ModelType(Email)) labels = types.DictType(types.StringType) history = compound.ListType(types.StringType()) checked = types.BooleanType(default=False) checked_by = types.StringType() checked_at = types.TimestampType() created_by = types.StringType(required=True) created_at = types.TimestampType(default=arrow.utcnow().timestamp) last_update_by = types.StringType() last_update_at = types.TimestampType()
class Email(models.Model): ''' Email ''' name = types.StringType() address = types.EmailType() validated = types.BooleanType(default=False) primary = types.BooleanType(default=False)
class User(models.Model): ''' Cuallix User ''' CellPhone = types.StringType() CountryCode = types.StringType() Email = types.EmailType() LastName = types.StringType() Name = types.StringType() Password = types.StringType()
class TestCollection(ResourceCollection): foo = types.StringType(required=True) bar = types.StringType(default="") baz = types.EmailType(required=True) def create_resources(self): pass def validate_foo(self, data, value): if not value.endswith("!"): raise schematics.exceptions.ValidationError( "foo must end in !")
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
class ModifyContact(models.Model): ''' Modify contact This model is similar to Contact. 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() account = types.StringType() tags = compound.ListType(types.StringType()) number_type = types.IntType() first_name = types.StringType() last_name = types.StringType() phone_number = types.StringType() phone = types.StringType() cell_phone = types.StringType() other_phone = types.StringType() number_type = types.IntType() description = types.StringType() country = types.StringType() location = types.StringType() timezone = types.StringType() comment = types.StringType() tags = types.StringType() status = types.StringType() email = types.EmailType() client_email = types.StringType() address = types.StringType() city = types.StringType() state = types.StringType() zip_code = types.StringType() dog = types.StringType() pool = types.StringType() date_of_birth = types.StringType() checked = types.BooleanType() do_not_disturb = types.BooleanType() has_directory = types.BooleanType() directory_uuid = types.UUIDType() # -- godzilla nigthmare start in 3, 2, 1... gender = types.StringType() auto_priority_code = types.StringType() lead_source = types.StringType() writing_agent = types.StringType() partner = types.StringType() healt_writing_agent = types.StringType() lead_type = types.StringType() healt_lead_status = types.StringType() renewal_source_2016 = types.StringType() renewal_agent_2016 = types.StringType() home_lead_status = types.StringType() renewal_submitter_2016 = types.StringType() auto_lead_status = types.StringType() presold_processor_2016 = types.StringType() flood_lead_status = types.StringType() scrubber = types.StringType() other_policy_sold = types.StringType() last_modified_by = types.StringType() dental_lead_status = types.StringType() federal_do_not_call = types.StringType() do_you_own_your_home = types.StringType() renew_as_is_email_received = types.StringType() language_preference = types.StringType() social_security_number = types.StringType() us_citizen_or_legal_permanent_resident = types.StringType() mailing_address = types.StringType() property_address_different = types.StringType() county = types.StringType() marketplace_email = types.StringType() property_address = types.StringType() property_city = types.StringType() property_state = types.StringType() property_zip_code = types.StringType() total_individual_income = types.StringType() total_household_income = types.StringType() primary_applicants_income_source = types.StringType() primary_applicants_employers_name = types.StringType() applicant_employers_phone_number = types.StringType() marital_status = types.StringType() number_of_dependent_children_in_house = types.StringType() spouse_first_name = types.StringType() spouse_last_name = types.StringType() spouse_gender = types.StringType() spouse_dob = types.StringType() do_you_have_a_social_security_number = types.StringType() spouse_social = types.StringType() spouse_yearly_income = types.StringType() spouse_employers_name = types.StringType() spouse_employers_phone_number = types.StringType() child_1_name = types.StringType() child_1_dob = types.StringType() child_1_gender = types.StringType() child_1_social = types.StringType() child_2_name = types.StringType() child_2_dob = types.StringType() child_2_gender = types.StringType() child_2_social = types.StringType() child_3_name = types.StringType() child_3_dob = types.StringType() child_3_gender = types.StringType() child_3_social = types.StringType() child_4_name = types.StringType() child_4_dob = types.StringType() child_4_gender = types.StringType() child_4_social = types.StringType() lead_has_a_marketplace_account = types.StringType() current_coverage = types.StringType() marketplace_2015_app_id = types.StringType() current_premium = types.StringType() subsidy_amount = types.StringType() current_net_premium = types.StringType() effective_2015_date = types.StringType() application_id_2015 = types.StringType() health_premium_2015 = types.StringType() health_carrier_2015 = types.StringType() subsidy_2015 = types.StringType() adult_on_plan_2015 = types.StringType() children_on_plan_2015 = types.StringType() income_verification_needed = types.StringType() citizenship_documents_needed = types.StringType() health_policy = types.StringType() agent_code = types.StringType() wants_to_renew_same_plan_for_2016 = types.StringType() quoted_renewal_gross_premium_2016 = types.StringType() quoted_renewal_subsidy_2016 = types.StringType() quoted_renewal_net_premium_2016 = types.StringType() adults_applying_for_coverage_2016 = types.StringType() total_household_size_2016 = types.StringType() cloud_gross_premium_2016 = types.StringType() children_applying_for_coverage_2016 = types.StringType() cloud_subsidy_2016 = types.StringType() cloud_premium_after_subsidy_2016 = types.StringType() binder_payment_option_2016 = types.StringType() payment_charge_request_date = types.StringType() credit_card_type_2016 = types.StringType() name_on_cc_2016 = types.StringType() credit_card_type_2016 = types.StringType() name_on_cc_2016 = types.StringType() credit_card_number_2016 = types.StringType() cc_expiration_date_2016 = types.StringType() cc_cvv_2016 = types.StringType() bank_account_type_2016 = types.StringType() bank_name_2016 = types.StringType() bank_routin_number_2016 = types.StringType() bank_account_number_2016 = types.StringType() application_number_2016 = types.StringType() effective_date_2016 = types.StringType() marketplace_policy_2016 = types.StringType() total_income_used_on_application = types.StringType() final_gross_premium_2016 = types.StringType() final_subsidy_2016 = types.StringType() heatlh_plan_2016 = types.StringType() final_premium_after_subsidy_2016 = types.StringType() verification_documents_needed_2016 = types.StringType() new_purchase = types.StringType() home_exp_date_closing_date = types.StringType() occupancy_status = types.StringType() type_of_dwelling = types.StringType() current_home_carrier = types.StringType() current_home_premium = types.StringType() current_dwelling_coverage = types.StringType() year_built = types.StringType() square_ft_under_air = types.StringType() garage = types.StringType() construction_type = types.StringType() stories = types.StringType() age_roof = types.StringType() roof_material = types.StringType() bathrooms = types.StringType() fence_or_screen_enclosure = types.StringType() bankrupcy_or_foreclosure_in_the_past_5_years = types.StringType() centrally_monitored_alarm = types.StringType() gated_community = types.StringType() how_many_claims_in_the_last_5_years = types.StringType() realtor_mortgage_broker = types.StringType() amount_of_personal_property = types.StringType() number_of_stories_in_the_building = types.StringType() what_floor_is_condo_on = types.StringType() quote_update_request = types.StringType() home_policy_effective_date = types.StringType() four_point_if_applicable = types.StringType() quoted_home_company = types.StringType() wind_mit = types.StringType() quoted_home_premium = types.StringType() quoted_home_number = types.StringType() home_payment_option = types.StringType() mortgage_clause_new = types.StringType() loan_number = types.StringType() home_insurance_carrier = types.StringType() home_insurance_premium = types.StringType() home_insurance_policy_number = types.StringType()