module ForstokTrigger::Webhook::Repository::WebhookRepository
This TriggerRepository is class for connect to database
Public Class Methods
configuration()
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 67 def self.configuration @configuration ||= ForstokTrigger::Webhook.configuration end
configuration_event()
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 63 def self.configuration_event configuration.event end
configuration_list()
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 59 def self.configuration_list configuration.list end
webhook_insert_pending(event, url, event_payload, channel_id)
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 53 def self.webhook_insert_pending(event, url, event_payload, channel_id) sql = webhook_insert_query sql += webhook_insert_value(event, url, event_payload, channel_id) ForstokTrigger::Webhook::Repository.client.query(sql) end
webhook_insert_query()
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 39 def self.webhook_insert_query sql = 'INSERT INTO ' + configuration.db + '.' sql += configuration.buffer_table sql += '(url, event, event_payload, channel_id) VALUES ' sql end
webhook_insert_value(event, url, event_payload, channel_id)
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 46 def self.webhook_insert_value(event, url, event_payload, channel_id) sql = "('" + url.to_s + "', '" + event.to_s + "', '" sql += Mysql2::Client.escape(event_payload.to_s) + "', " sql += channel_id.to_s + ')' sql end
webhook_list(event, channel_id)
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 32 def self.webhook_list(event, channel_id) sql = webhook_list_query_select sql += webhook_list_query_condition(event, channel_id) results = ForstokTrigger::Webhook::Repository.client.query(sql) results end
webhook_list_query_condition(event, channel_id)
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 24 def self.webhook_list_query_condition(event, channel_id) sql = 'WHERE ' + configuration_list sql += '.channel_id=' + channel_id.to_s sql += ' AND ' + configuration_event sql += ".name like '" + event.to_s + "'" sql end
webhook_list_query_join()
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 16 def self.webhook_list_query_join sql = ' FROM ' + configuration_list sql += ' JOIN ' + configuration_event sql += ' on ' + configuration_list + '.event_id=' sql += configuration_event + '.id ' sql end
webhook_list_query_select()
click to toggle source
# File lib/forstok_trigger/webhook/repository/webhook_repository.rb, line 8 def self.webhook_list_query_select sql = 'SELECT ' + configuration_list + '.id, ' sql += configuration_list + '.url, ' sql += configuration_event + '.name ' sql += webhook_list_query_join sql end