Skip to content

Instantly share code, notes, and snippets.

@greenisus
Created April 14, 2014 18:14
Show Gist options
  • Save greenisus/10670762 to your computer and use it in GitHub Desktop.
Save greenisus/10670762 to your computer and use it in GitHub Desktop.
HS Event Routing
- (void)handleEvent:(NSDictionary *)json {
NSData *data = [json[@"json"] dataUsingEncoding:NSUTF8StringEncoding];
NSString *type = json[@"event_type"];
NSDictionary *object = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
if ([type isEqualToString:@"new_tweet"]) {
[self handleNewTweet:object];
} else if ([type isEqualToString:@"tweet_tags_updated"]) {
[self handleTweetTagsUpdated:object];
} else if ([type isEqualToString:@"tweet_update_sentiment"]) {
} else if ([type isEqualToString:@"tweet_update_response_status"]) {
} else if ([type isEqualToString:@"tweet_replied"]) {
} else if ([type isEqualToString:@"note_created"]) {
} else if ([type isEqualToString:@"note_updated"]) {
} else if ([type isEqualToString:@"note_deleted"]) {
} else if ([type isEqualToString:@"tweet_assigned"]) {
} else if ([type isEqualToString:@"tweet_unclaimed"]) {
} else if ([type isEqualToString:@"account_number_added"]) {
} else if ([type isEqualToString:@"account_number_updated"]) {
} else if ([type isEqualToString:@"account_number_deleted"]) {
} else if ([type isEqualToString:@"tweet_favorited"]) {
} else if ([type isEqualToString:@"tweet_unfavorited"]) {
} else if ([type isEqualToString:@"tweet_deleted"]) {
} else if ([type isEqualToString:@"followed_user"]) {
} else if ([type isEqualToString:@"unfollowed_user"]) {
} else if ([type isEqualToString:@"alert_dismissed"]) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment