Example #1
0
    def load(self, dependencies):
        api = dependencies['api']
        config = dependencies['config']
        token_changed_subscribe = dependencies['token_changed_subscribe']

        provd_client = ProvdClient(**config['provd'])
        token_changed_subscribe(provd_client.set_token)

        device_dao = build_device_dao(provd_client)
        device_updater = build_device_updater(provd_client)
        service = build_service(provd_client, device_updater)

        api.add_resource(
            LineDeviceAssociation,
            '/lines/<int:line_id>/devices/<device_id>',
            endpoint='line_devices',
            resource_class_args=(line_dao, device_dao, service),
        )

        api.add_resource(
            LineDeviceGet,
            '/lines/<int:line_id>/devices',
            resource_class_args=(line_dao, device_dao, service),
        )

        api.add_resource(
            DeviceLineGet,
            '/devices/<device_id>/lines',
            resource_class_args=(line_dao, device_dao, service),
        )
Example #2
0
def build_user_funckey_template_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)

    return UserFuncKeyTemplateService(
        user_dao_module,
        build_user_template_validator(),
        build_notifier(),
        device_updater,
    )
Example #3
0
def build_service(registrar_dao, provd_client):
    validator = build_validator()
    notifier = RegistrarNotifier(bus)
    line_service = build_line_service(provd_client)
    device_updater = build_device_updater(provd_client)

    registrar_service = RegistrarService(registrar_dao, validator, notifier,
                                         line_service, device_updater,
                                         provd_client)
    return registrar_service
Example #4
0
def build_template_service(provd_client, pjsip_doc):
    device_updater = device_builder.build_device_updater(provd_client)

    return SipEndpointService(
        endpoint_sip_dao_module,
        build_validator(pjsip_doc),
        build_template_notifier(),
        device_updater,
        template=True,
    )
Example #5
0
def build_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)

    return TemplateService(
        template_dao_module,
        user_dao_module,
        build_validator(),
        build_validator_bsfilter(),
        build_notifier(),
        device_updater,
    )
Example #6
0
def build_service(provd_client):
    device_dao = device_builder.build_dao(provd_client)
    device_updater = device_builder.build_device_updater(provd_client)
    registrar_dao = RegistrarDao(provd_client)

    return LineService(
        line_dao_module,
        build_validator(registrar_dao),
        build_notifier(),
        device_updater,
        device_dao,
        user_line_build_service(),
        line_device_build_service(provd_client, device_updater),
    )
Example #7
0
def build_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)

    return SipEndpointService(endpoint_sip_dao_module, build_validator(),
                              build_notifier(), device_updater)
Example #8
0
def build_service(provd_client):
    updater = build_device_updater(provd_client)
    return UserService(user_dao, build_validator(), build_notifier(), updater,
                       func_key_dao)
Example #9
0
def build_service(provd_client):
    device_updater = device_builder.build_device_updater(provd_client)
    return ExtensionService(extension_dao_module, build_validator(),
                            build_notifier(), device_updater)