Esempio n. 1
0
 def new_event(self):
     web_hook_list = yield threads.deferToThread(self.__list_web_hook)
     for web_hook in web_hook_list:
         event = KeepAliveEvent(web_hook_id=str(web_hook.id),
                                status=web_hook.status,
                                url=web_hook.url,
                                shared_secret=web_hook.shared_secret)
         dispatcher.new_event(event)
Esempio n. 2
0
 def on_success(token_dict_list):
     for token_dict in token_dict_list:
         email_changed_event = UserEmailChangeEvent(token_id=token_dict['token_id'],
                                                    email=email,
                                                    web_hook_id=token_dict['web_hook']['id'],
                                                    web_hook_url=token_dict['web_hook']['url'],
                                                    shared_secret=token_dict['web_hook']['shared_secret'])
         dispatcher.new_event(email_changed_event)
Esempio n. 3
0
 def new_event(self):
     web_hook_list = yield threads.deferToThread(self.__list_web_hook)
     for web_hook in web_hook_list:
         event = KeepAliveEvent(web_hook_id=str(web_hook.id),
                                status=web_hook.status,
                                url=web_hook.url,
                                shared_secret=web_hook.shared_secret)
         dispatcher.new_event(event)
Esempio n. 4
0
 def on_success(token_dict_list):
     for token_dict in token_dict_list:
         email_changed_event = UserEmailChangeEvent(
             token_id=token_dict['token_id'],
             email=email,
             web_hook_id=token_dict['web_hook']['id'],
             web_hook_url=token_dict['web_hook']['url'],
             shared_secret=token_dict['web_hook']['shared_secret'])
         dispatcher.new_event(email_changed_event)
Esempio n. 5
0
def initialize_web_hook(web_hook_id, web_hook_url, shared_secret):
    """
    when a web hook receive this event, it should invoke the revive API with empty token list
     to update its status to alive.
    :param web_hook_id:
    :param web_hook_url:
    :param shared_secret:
    :return:
    """
    event = InitialEvent(web_hook_id=web_hook_id,
                         url=web_hook_url,
                         shared_secret=shared_secret)

    dispatcher.new_event(event)
Esempio n. 6
0
def initialize_web_hook(web_hook_id, web_hook_url, shared_secret):
    """
    when a web hook receive this event, it should invoke the revive API with empty token list
     to update its status to alive.
    :param web_hook_id:
    :param web_hook_url:
    :param shared_secret:
    :return:
    """
    event = InitialEvent(web_hook_id=web_hook_id,
                         url=web_hook_url,
                         shared_secret=shared_secret)

    dispatcher.new_event(event)
Esempio n. 7
0
 def on_success(token_fav_dict):
     for token in token_fav_dict:
         user_favorite_event = UserFavoriteEvent(
             token=token, favorites=token_fav_dict[token])
         dispatcher.new_event(user_favorite_event)
Esempio n. 8
0
def token_remove(web_hook_id, token_id):
    token_remove_event = TokenRemovedEvent(web_hook_id=web_hook_id,
                                           token_id=token_id)
    dispatcher.new_event(token_remove_event)
Esempio n. 9
0
 def on_success(fav_dict_list):
     token_add_event = TokenAddedEvent(web_hook_id=web_hook_id,
                                       favorites=fav_dict_list,
                                       email=email,
                                       token_id=token_id)
     dispatcher.new_event(token_add_event)
Esempio n. 10
0
 def on_success(episode):
     episode_event = EpisodeEvent(episode=episode)
     dispatcher.new_event(episode_event)
Esempio n. 11
0
 def on_success(token_fav_dict):
     for token in token_fav_dict:
         user_favorite_event = UserFavoriteEvent(token=token,
                                                 favorites=token_fav_dict[token])
         dispatcher.new_event(user_favorite_event)
Esempio n. 12
0
def token_remove(web_hook_id, token_id):
    token_remove_event = TokenRemovedEvent(web_hook_id=web_hook_id,
                                           token_id=token_id)
    dispatcher.new_event(token_remove_event)
Esempio n. 13
0
 def on_success(fav_dict_list):
     token_add_event = TokenAddedEvent(web_hook_id=web_hook_id,
                                       favorites=fav_dict_list,
                                       email=email,
                                       token_id=token_id)
     dispatcher.new_event(token_add_event)
Esempio n. 14
0
 def on_success(episode):
     episode_event = EpisodeEvent(episode=episode)
     dispatcher.new_event(episode_event)